-
Notifications
You must be signed in to change notification settings - Fork 518
vImage tvOS xcode14.0 beta1
Alex Soto edited this page Jun 7, 2022
·
2 revisions
#vImage.framework
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h 2022-02-23 08:00:42.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h 2022-06-03 18:07:51.000000000 -0400
@@ -1151,6 +1151,46 @@
#define vImagePremultiplyData_BGRAFFFF( _src, _dest, _flags ) vImagePremultiplyData_RGBAFFFF((_src), (_dest), (_flags))
/*!
+ * @function vImagePremultiplyData_RGBA16F
+ * @abstract Multiply a RGBA16F color channel by its corresponding alpha
+ * @discussion
+ * This function multiplies color channels by the alpha channel.
+ * <pre>@textblock
+ * For each color channel:
+ *
+ * float destColor = src * alpha;
+ * float destAlpha = alpha;
+ *
+ * This function can work in place provided the following are true:
+ * If src overlaps with dest, src->data must be equal to dest->data
+ * If src also has a different rowBytes from dest, kvImageDoNotTile must be also passed in the flags
+ * (It is not necessary to pass kvImageDoNotTile if src and dest do not overlap.)
+ * @/textblock </pre>
+ *
+ * This function will for all 4 channel 16F / channel image formats with alpha first in memory.
+ * It does not have to be RGBA. Also available as vImagePremultiplyData_BGRA16F().
+ *
+ * @param src The color data to multiply with alpha
+ * @param dest A preallocated vImage_Buffer where the results are written
+ * @param flags The following flags are allowed:
+ * <pre>@textblock
+ * kvImageNoFlags Default operation
+ *
+ * kvImageDoNotTile Turn off internal multithreading. This might be useful if you are already multithreading
+ * the work in your own tiling engine.
+ * @/textblock </pre>
+ * @result The following result codes may occur:
+ * <pre>@textblock
+ * kvImageNoError Success.
+ *
+ * kvImageRoiLargerThanInputBuffer dest->width and dest->height must be less than or equal to corresponding
+ * dimensions in src and alpha
+ * @/textblock</pre>
+ */
+VIMAGE_PF vImage_Error vImagePremultiplyData_RGBA16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+#define vImagePremultiplyData_BGRA16F( _src, _dest, _flags ) vImagePremultiplyData_RGBA16F((_src), (_dest), (_flags))
+
+/*!
* @function vImagePremultiplyData_ARGB16U
* @abstract Multiply a unsigned 16-bit ARGB color channel by its corresponding alpha
* @discussion
@@ -1532,6 +1572,43 @@
/*!
+ * @function vImageUnpremultiplyData_RGBA16F
+ * @abstract Divide the alpha channel from the color channels in a RGBA16F image
+ * @discussion
+ * This function divides color channels by the alpha channel.
+ * For each color channel:
+ * <pre>@textblock
+ * float destColor = destColor / alpha;
+ * float destAlpha = alpha;
+ * @/textblock </pre>
+ *
+ * The positioning of only the alpha channel is important for interleaved formats for these functions.
+ * This function will work with other channel orders that have alpha last. It is also available as vImageUnpremultiplyData_BGRA16F().
+ *
+ * This function can work in place provided the following are true:
+ * src->data must be equal to dest->data
+ * src->rowBytes must be equal to dest->rowBytes
+ *
+ * @param src The input image
+ * @param dest A preallocated 16F destination buffer into which the result will be written.
+ * @param flags The following flags are allowed:
+ * <pre>@textblock
+ * kvImageNoFlags Default operation
+ *
+ * kvImageDoNotTile Disable internal multithreading.
+ * @/textblock </pre>
+ *
+ * @result The following error codes may be returned:
+ * <pre>@textblock
+ * kvImageNoError Success
+ *
+ * kvImageRoiLargerThanInputBuffer dest->height or width is larger than the corresponding src or alpha dimension
+ * @/textblock </pre>
+ */
+VIMAGE_PF vImage_Error vImageUnpremultiplyData_RGBA16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+#define vImageUnpremultiplyData_BGRA16F( _src, _dest, _flags ) vImageUnpremultiplyData_RGBA16F((_src), (_dest), (_flags))
+
+/*!
* @function vImageUnpremultiplyData_ARGB16U
* @abstract Divide the alpha channel from the color channels in a ARGB16U image
* @discussion
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h 2022-02-23 08:00:42.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h 2022-05-31 14:50:28.000000000 -0400
@@ -1225,6 +1225,28 @@
const vImage_Buffer *dest, /* A planar buffer */
vImage_Flags flags ) VIMAGE_NON_NULL(2) API_AVAILABLE(macos(10.10), ios(8.0), watchos(1.0), tvos(8.0));
+/*!
+ @function vImageOverwriteChannelsWithScalar_Planar16F
+
+ @abstract Fill the dest buffer with the scalar value.
+
+ @param scalar
+ A scalar value to fill the destination buffer.
+
+ @param dest
+ A pointer to a valid and initialized vImage_Buffer struct, that points to a buffer containing destination pixels.
+
+ @param flags
+ \p kvImageNoFlags Default operation
+ \p kvImageDoNotTile Disable internal multithreading.
+
+ @return kvImageNoError Success
+ @return kvImageRoiLargerThanInputBuffer The height and width of the destination must be less than or equal to the height and width of the src buffer, respectively.
+ */
+VIMAGE_PF vImage_Error vImageOverwriteChannelsWithScalar_Planar16F( Pixel_16F scalar,
+ const vImage_Buffer *dest, /* A planar buffer */
+ vImage_Flags flags ) VIMAGE_NON_NULL(2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+
/*!
@function vImageExtractChannel_ARGB8888
@@ -1442,6 +1464,26 @@
VIMAGE_PF vImage_Error vImageBufferFill_ARGBFFFF( const vImage_Buffer *dest, const Pixel_FFFF color, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
/*!
+ @function vImageBufferFill_ARGB16F
+
+ @abstract Fill the dest buffer with the pixel value.
+
+ @param color
+ A pixel value to fill the destination buffer.
+
+ @param dest
+ A pointer to a valid and initialized vImage_Buffer struct, that points to a buffer containing destination pixels.
+
+ @param flags
+ \p kvImageNoFlags Default operation
+ \p kvImageDoNotTile Disable internal multithreading.
+
+ @return kvImageNoError Success
+ @return kvImageRoiLargerThanInputBuffer The height and width of the destination must be less than or equal to the height and width of the src buffer, respectively.
+ */
+VIMAGE_PF vImage_Error vImageBufferFill_ARGB16F( const vImage_Buffer *dest, const Pixel_ARGB_16F color, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+
+/*!
@function vImageBufferFill_CbCr8
@abstract Fill the dest buffer with the pixel value.
@@ -1779,7 +1821,53 @@
vImage_Flags flags ) VIMAGE_NON_NULL(1,2,3)
API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
-
+/*!
+ @function vImagePermuteChannels_ARGB16F
+
+ @abstract Reorder color channels within the buffer according to the permute map.
+
+ @discussion For each pixel in src, do the following:
+ @code
+ Pixel_ARGB_16F srcPixel, result;
+ for( int i = 0; i < 4; i++ )
+ result[i] = srcPixel[ permuteMap[i] ];
+ @endcode
+
+ The src buffer must be at least as large as the dest buffer in each dimension. (src.height >= dest.height && src.width >= dest.width)
+
+ This function can work in place provided the following are true:
+ For each buffer "buf" that overlaps with dest, buf->data must be equal to dest->data and buf->rowBytes >= dest->rowBytes
+ If an overlapping buffer has a different rowBytes from dest, kvImageDoNotTile must be also passed in the flags
+
+ This function may be used with any 4 channel 16-bit/channel format, such as RGBA16F, BGRA16F or AYUV16F.
+
+ @param src
+ A pointer to a valid and initialized vImage_Buffer struct, that points to a buffer containing the source pixels.
+
+ @param dest
+ A pointer to a valid and initialized vImage_Buffer struct, that points to a buffer containing destination pixels.
+
+ @param permuteMap
+ The map describing the permutation of the 4 color channels.
+ Each value in the map must be 0,1,2, or 3. A map of 0,1,2,3
+ is a copy from src->dest while a map of 3,2,1,0 is permutes
+ ARGB -> BGRA. Providing a map value greater than 3 will
+ result in the return of error kvImageInvalidParameter.
+
+ @param flags
+ \p kvImageNoFlags Default operation
+ \p kvImageDoNotTile Disable internal multithreading.
+
+ @return kvImageNoError Success
+ @return kvImageInvalidParameter When permuteMap > 3, which is invalid.
+ @return kvImageRoiLargerThanInputBuffer The height and width of the destination must be less than or equal to the height and width of the src buffer, respectively.
+ */
+VIMAGE_PF vImage_Error vImagePermuteChannels_ARGB16F(const vImage_Buffer *src,
+ const vImage_Buffer *dest,
+ const uint8_t permuteMap[4],
+ vImage_Flags flags )
+VIMAGE_NON_NULL(1,2,3)
+API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
/*!
@function vImagePermuteChannelsWithMaskedInsert_ARGB8888
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h 2022-02-23 07:57:19.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h 2022-05-31 15:02:55.000000000 -0400
@@ -385,6 +385,150 @@
*/
VIMAGE_PF vImage_Error vImageConvolve_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, Pixel_F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
+/*!
+ * @function vImageConvolve_Planar16F
+ * @abstract General convolution on a Planar16F image.
+ * @discussion This filter applies a convolution filter of your choosing to a Planar16F image.
+ * The kernel values are specified as 32-bit single-precision floats and the
+ * weighted average is also computed in single precision by default. However, if
+ * the flag kvImageUseFP16Accumulator is set all internal filtering operations will
+ * use 16-bit half-precision floating-point arithmetic when the CPU architecture
+ * supports it. This results in up to 2x performance improvements but at the
+ * expense of a less precise result; typically 2-3 bits of precision is lost.
+ *
+ * For each pixel:
+ * <pre>@textblock
+ * for each pixel[y][x] in image{
+ * // sum is declared as type _Float16 when the flag kvImageUseFP16Accumulator is set
+ * float sum = 0;
+ *
+ * // Calculate weighted average over kernel area
+ * for each kernel_element[i][j] in kernel{
+ * sum += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
+ * }
+ *
+ * // write out result
+ * result[y][x] = (_Float16)sum;
+ * }
+ * @/textblock </pre>
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
+ * kernel_width.)
+ *
+ * This filter does not work in place.
+ *
+ * @param src The input image
+ *
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
+ * This may not alias the src image.
+ *
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
+ * computation. The size of the tempBuffer is given by calling the function
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
+ * the size is returned instead of an error code from the left hand side.
+ * You may pass NULL here, in which case a region of memory of similar size
+ * will be allocated by the function and freed before it returns. Temp Buffers
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
+ * buffers. If you will be calling this function repeatedly with similar parameters
+ * you should use a temp buffer. If the function is called from different threads
+ * concurrently, a different temp buffer should be used for each.
+ *
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
+ * when the destination tile is not aligned with the left edge of the image.
+ *
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
+ * when the destination tile is not aligned with the top edge of the image.
+ *
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
+ * For example, for a simple 3x3 blur, it might be:
+ * <pre>@textblock
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
+ * 2./16, 4./16, 2./16,
+ * 1./16, 2./16, 1./16 };
+ * @/textblock </pre>
+ *
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
+ *
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
+ *
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
+ * parameter provides the background color to be used for missing pixels when the
+ * kernel extends off the edge of the image.
+ *
+ * @param flags The following flags are allowed:
+ * <pre>@textblock
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
+ * copy the corresponding source pixel to the destination. This
+ * will result in a ring off unconvolved content at the edges
+ * and convolved content in the middle.
+ *
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
+ * For a blur filter this will look like the edges of the image
+ * have been blurred into a particular color. This is usually
+ * appropriate when the color of the surface onto which the image
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
+ * as a background color, and let the downstream image compositor
+ * blend in the background color. In this case, the result image
+ * should be treated as a premultiplied image.
+ *
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
+ * This is better when the image is drawn into a frame or other
+ * context where the background is not expected to contribute to
+ * the final content.
+ *
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
+ * simply ignored, and the bias and divisor are adjusted accordingly.
+ * Because of the complication at the edges, this edging mode can
+ * be significantly slower than the others. It can be numerically
+ * unstable if the sum over any rectangular subsection of the kernel
+ * is zero, which can result in division by zero during the computation.
+ * The results for this edging mode are usually quite visually similar
+ * to kvImageEdgeExtend.
+ *
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
+ * size of the temp buffer needed for this set of parameters. Does
+ * not touch the src or dest image.
+ *
+ * kvImageDoNotTile Disable internal multithreading.
+ *
+ * kvImageUseFP16Accumulator Enable 16-bit half-precision floating-point arithmetic when computing the
+ * kernel averages when the CPU architecture supports it.
+ *
+ * @/textblock </pre>
+ * The first four flags listed are edging modes. One and only one edging mode must be
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
+ * be returned.
+ *
+ * @return One of the following error codes may be returned:
+ * <pre>@textblock
+ * kvImageNoError Success.
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
+ * the temp buffer to use with this function and this set of
+ * parameters.
+ *
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
+ * kvImageEdgeExtend, kvImageTruncateKernel }
+ *
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
+ * to corresponding dimensions of the source buffer.
+ *
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
+ *
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
+ *
+ * kvImageNullPointerArgument kernel may not be NULL
+ *
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
+ *
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
+ * @/textblock </pre>
+ */
+VIMAGE_PF vImage_Error vImageConvolve_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, Pixel_16F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
/*!
* @function vImageConvolve_ARGB8888
@@ -693,27 +837,44 @@
*/
VIMAGE_PF vImage_Error vImageConvolve_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, const Pixel_FFFF backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
-
/*!
- * @function vImageConvolveWithBias_Planar8
- * @abstract General convolution on a Planar8 image with added bias.
- * @discussion This filter applies a convolution filter of your choosing to a Planar8 image.
+ * @function vImageConvolve_ARGB16F
+ * @abstract General convolution on a ARGB16F image of any channel order.
+ * @discussion This filter applies a convolution filter of your choosing to a ARGB16F image.
+ * This filter will work on any four-channel, half-float per component image format, not just ARGB.
+ * The kernel values are specified as 32-bit single-precision floats and the
+ * weighted average is also computed in single precision by default. However, if
+ * the flag kvImageUseFP16Accumulator is set all internal filtering operations will
+ * use 16-bit half-precision floating-point arithmetic when the CPU architecture
+ * supports it. This results in up to 2x performance improvements but at the
+ * expense of a less precise result; typically 2-3 bits of precision is lost.
+ *
* For each pixel:
* <pre>@textblock
* for each pixel[y][x] in image{
- * int sum = 0;
+ * // Sums are declared as type _Float16 when the flag kvImageUseFP16Accumulator is set
+ * float sumA = 0;
+ * float sumR = 0;
+ * float sumG = 0;
+ * float sumB = 0;
*
* // Calculate weighted average over kernel area
* for each kernel_element[i][j] in kernel{
- * sum += kernel_element[i][j] *
- * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
- * [x+j+srcOffsetToROI_X- kernel_width/2];
+ * sumA += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][0];
+ * sumR += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][1];
+ * sumG += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][2];
+ * sumB += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][3];
* }
- * // Correct for the scaling introduced by multiplying by the weights table
- * sum = (sum + bias) / divisor;
*
* // write out result
- * result[y][x] = CLAMP(sum, 0, 255);
+ * result[y][x][0] = (_Float16)sumA;
+ * result[y][x][1] = (_Float16)sumR;
+ * result[y][x][2] = (_Float16)sumG;
+ * result[y][x][3] = (_Float16)sumB;
* }
* @/textblock </pre>
* (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
@@ -749,29 +910,15 @@
* @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
* For example, for a simple 3x3 blur, it might be:
* <pre>@textblock
- * const int16_t kernel[9] = { 1, 2, 1,
- * 2, 4, 2,
- * 1, 2, 1 };
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
+ * 2./16, 4./16, 2./16,
+ * 1./16, 2./16, 1./16 };
* @/textblock </pre>
*
- * The kernel values may not sum in any combination to be outside the range
- * [-2**23, 2**23), or modulo overflow in the accumulator may result.
- *
* @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
*
* @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
*
- * @param divisor The weighted sum of nearby pixels is typically a large number, which must be corrected
- * to fit back into the image format of the destination image. The correction factor
- * is passed in as divisor here, and is divided from the sum before the result is
- * returned. Typically, the divisor is the sum over the area of the kernel. If the divisor
- * is 0, 1 will be used instead.
- *
- * @param bias This value is added to the sum of weighted pixels before the divisor is applied.
- * It can serve to both control rounding and adjust the brightness of the result.
- * A large bias (e.g 128 * divisor) may be required for some kernels to return
- * representable results, such as edge detection filters.
- *
* @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
* parameter provides the background color to be used for missing pixels when the
* kernel extends off the edge of the image.
@@ -810,7 +957,10 @@
* size of the temp buffer needed for this set of parameters. Does
* not touch the src or dest image.
*
- * kvImageDoNotTile Disable internal multithreading.
+ * kvImageDoNotTile Disable internal multithreading.
+ *
+ * kvImageUseFP16Accumulator Enable 16-bit half-precision floating-point arithmetic when computing the
+ * kernel averages when the CPU architecture supports it.
*
* @/textblock </pre>
* The first four flags listed are edging modes. One and only one edging mode must be
@@ -842,26 +992,476 @@
* kvImageInvalidKernelSize The kernel height and width must be odd numbers.
* @/textblock </pre>
*/
-VIMAGE_PF vImage_Error vImageConvolveWithBias_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, int32_t bias, Pixel_8 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
+VIMAGE_PF vImage_Error vImageConvolve_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, const Pixel_ARGB_16F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
/*!
- * @function vImageConvolveWithBias_PlanarF
- * @abstract General convolution on a PlanarF image with added bias.
- * @discussion This filter applies a convolution filter of your choosing to a PlanarF image.
+ * @function vImageConvolveWithBias_Planar8
+ * @abstract General convolution on a Planar8 image with added bias.
+ * @discussion This filter applies a convolution filter of your choosing to a Planar8 image.
+ * For each pixel:
+ * <pre>@textblock
+ * for each pixel[y][x] in image{
+ * int sum = 0;
+ *
+ * // Calculate weighted average over kernel area
+ * for each kernel_element[i][j] in kernel{
+ * sum += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
+ * }
+ * // Correct for the scaling introduced by multiplying by the weights table
+ * sum = (sum + bias) / divisor;
+ *
+ * // write out result
+ * result[y][x] = CLAMP(sum, 0, 255);
+ * }
+ * @/textblock </pre>
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
+ * kernel_width.)
+ *
+ * This filter does not work in place.
+ *
+ * @param src The input image
+ *
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
+ * This may not alias the src image.
+ *
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
+ * computation. The size of the tempBuffer is given by calling the function
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
+ * the size is returned instead of an error code from the left hand side.
+ * You may pass NULL here, in which case a region of memory of similar size
+ * will be allocated by the function and freed before it returns. Temp Buffers
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
+ * buffers. If you will be calling this function repeatedly with similar parameters
+ * you should use a temp buffer. If the function is called from different threads
+ * concurrently, a different temp buffer should be used for each.
+ *
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
+ * when the destination tile is not aligned with the left edge of the image.
+ *
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
+ * when the destination tile is not aligned with the top edge of the image.
+ *
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
+ * For example, for a simple 3x3 blur, it might be:
+ * <pre>@textblock
+ * const int16_t kernel[9] = { 1, 2, 1,
+ * 2, 4, 2,
+ * 1, 2, 1 };
+ * @/textblock </pre>
+ *
+ * The kernel values may not sum in any combination to be outside the range
+ * [-2**23, 2**23), or modulo overflow in the accumulator may result.
+ *
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
+ *
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
+ *
+ * @param divisor The weighted sum of nearby pixels is typically a large number, which must be corrected
+ * to fit back into the image format of the destination image. The correction factor
+ * is passed in as divisor here, and is divided from the sum before the result is
+ * returned. Typically, the divisor is the sum over the area of the kernel. If the divisor
+ * is 0, 1 will be used instead.
+ *
+ * @param bias This value is added to the sum of weighted pixels before the divisor is applied.
+ * It can serve to both control rounding and adjust the brightness of the result.
+ * A large bias (e.g 128 * divisor) may be required for some kernels to return
+ * representable results, such as edge detection filters.
+ *
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
+ * parameter provides the background color to be used for missing pixels when the
+ * kernel extends off the edge of the image.
+ *
+ * @param flags The following flags are allowed:
+ * <pre>@textblock
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
+ * copy the corresponding source pixel to the destination. This
+ * will result in a ring off unconvolved content at the edges
+ * and convolved content in the middle.
+ *
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
+ * For a blur filter this will look like the edges of the image
+ * have been blurred into a particular color. This is usually
+ * appropriate when the color of the surface onto which the image
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
+ * as a background color, and let the downstream image compositor
+ * blend in the background color. In this case, the result image
+ * should be treated as a premultiplied image.
+ *
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
+ * This is better when the image is drawn into a frame or other
+ * context where the background is not expected to contribute to
+ * the final content.
+ *
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
+ * simply ignored, and the bias and divisor are adjusted accordingly.
+ * Because of the complication at the edges, this edging mode can
+ * be significantly slower than the others. It can be numerically
+ * unstable if the sum over any rectangular subsection of the kernel
+ * is zero, which can result in division by zero during the computation.
+ * The results for this edging mode are usually quite visually similar
+ * to kvImageEdgeExtend.
+ *
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
+ * size of the temp buffer needed for this set of parameters. Does
+ * not touch the src or dest image.
+ *
+ * kvImageDoNotTile Disable internal multithreading.
+ *
+ * @/textblock </pre>
+ * The first four flags listed are edging modes. One and only one edging mode must be
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
+ * be returned.
+ *
+ * @return One of the following error codes may be returned:
+ * <pre>@textblock
+ * kvImageNoError Success.
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
+ * the temp buffer to use with this function and this set of
+ * parameters.
+ *
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
+ * kvImageEdgeExtend, kvImageTruncateKernel }
+ *
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
+ * to corresponding dimensions of the source buffer.
+ *
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
+ *
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
+ *
+ * kvImageNullPointerArgument kernel may not be NULL
+ *
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
+ *
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
+ * @/textblock </pre>
+ */
+VIMAGE_PF vImage_Error vImageConvolveWithBias_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, int32_t bias, Pixel_8 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
+
+/*!
+ * @function vImageConvolveWithBias_PlanarF
+ * @abstract General convolution on a PlanarF image with added bias.
+ * @discussion This filter applies a convolution filter of your choosing to a PlanarF image.
+ * For each pixel:
+ * <pre>@textblock
+ * for each pixel[y][x] in image{
+ * float sum = bias;
+ *
+ * // Calculate weighted average over kernel area
+ * for each kernel_element[i][j] in kernel{
+ * sum += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
+ * }
+ *
+ * // write out result
+ * result[y][x] = sum;
+ * }
+ * @/textblock </pre>
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
+ * kernel_width.)
+ *
+ * This filter does not work in place.
+ *
+ * @param src The input image
+ *
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
+ * This may not alias the src image.
+ *
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
+ * computation. The size of the tempBuffer is given by calling the function
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
+ * the size is returned instead of an error code from the left hand side.
+ * You may pass NULL here, in which case a region of memory of similar size
+ * will be allocated by the function and freed before it returns. Temp Buffers
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
+ * buffers. If you will be calling this function repeatedly with similar parameters
+ * you should use a temp buffer. If the function is called from different threads
+ * concurrently, a different temp buffer should be used for each.
+ *
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
+ * when the destination tile is not aligned with the left edge of the image.
+ *
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
+ * when the destination tile is not aligned with the top edge of the image.
+ *
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
+ * For example, for a simple 3x3 blur, it might be:
+ * <pre>@textblock
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
+ * 2./16, 4./16, 2./16,
+ * 1./16, 2./16, 1./16 };
+ * @/textblock </pre>
+ *
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
+ *
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
+ *
+ * @param bias This value is added to the sum of weighted pixels.
+ *
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
+ * parameter provides the background color to be used for missing pixels when the
+ * kernel extends off the edge of the image.
+ *
+ * @param flags The following flags are allowed:
+ * <pre>@textblock
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
+ * copy the corresponding source pixel to the destination. This
+ * will result in a ring off unconvolved content at the edges
+ * and convolved content in the middle.
+ *
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
+ * For a blur filter this will look like the edges of the image
+ * have been blurred into a particular color. This is usually
+ * appropriate when the color of the surface onto which the image
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
+ * as a background color, and let the downstream image compositor
+ * blend in the background color. In this case, the result image
+ * should be treated as a premultiplied image.
+ *
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
+ * This is better when the image is drawn into a frame or other
+ * context where the background is not expected to contribute to
+ * the final content.
+ *
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
+ * simply ignored, and the bias and divisor are adjusted accordingly.
+ * Because of the complication at the edges, this edging mode can
+ * be significantly slower than the others. It can be numerically
+ * unstable if the sum over any rectangular subsection of the kernel
+ * is zero, which can result in division by zero during the computation.
+ * The results for this edging mode are usually quite visually similar
+ * to kvImageEdgeExtend.
+ *
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
+ * size of the temp buffer needed for this set of parameters. Does
+ * not touch the src or dest image.
+ *
+ * kvImageDoNotTile Disable internal multithreading.
+ *
+ * @/textblock </pre>
+ * The first four flags listed are edging modes. One and only one edging mode must be
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
+ * be returned.
+ *
+ * @return One of the following error codes may be returned:
+ * <pre>@textblock
+ * kvImageNoError Success.
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
+ * the temp buffer to use with this function and this set of
+ * parameters.
+ *
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
+ * kvImageEdgeExtend, kvImageTruncateKernel }
+ *
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
+ * to corresponding dimensions of the source buffer.
+ *
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
+ *
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
+ *
+ * kvImageNullPointerArgument kernel may not be NULL
+ *
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
+ *
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
+ * @/textblock </pre>
+ */
+VIMAGE_PF vImage_Error vImageConvolveWithBias_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, Pixel_F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
+
+/*!
+ * @function vImageConvolveWithBias_Planar16F
+ * @abstract General convolution on a Planar16F image.
+ * @discussion This filter applies a convolution filter of your choosing to a Planar16F image.
+ * The kernel values are specified as 32-bit single-precision floats and the
+ * weighted average is also computed in single precision by default. However, if
+ * the flag kvImageUseFP16Accumulator is set all internal filtering operations will
+ * use 16-bit half-precision floating-point arithmetic when the CPU architecture
+ * supports it. This results in up to 2x performance improvements but at the
+ * expense of a less precise result; typically 2-3 bits of precision is lost.
+ *
+ * For each pixel:
+ * <pre>@textblock
+ * for each pixel[y][x] in image{
+ * // sum is declared as type _Float16 when the flag kvImageUseFP16Accumulator is set
+ * float sum = bias;
+ *
+ * // Calculate weighted average over kernel area
+ * for each kernel_element[i][j] in kernel{
+ * sum += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
+ * }
+ *
+ * // write out result
+ * result[y][x] = (_Float16)sum;
+ * }
+ * @/textblock </pre>
+ * (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
+ * However, in practice it is passed in as a contiguous 1D array of size kernel_height *
+ * kernel_width.)
+ *
+ * This filter does not work in place.
+ *
+ * @param src The input image
+ *
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
+ * This may not alias the src image.
+ *
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
+ * computation. The size of the tempBuffer is given by calling the function
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
+ * the size is returned instead of an error code from the left hand side.
+ * You may pass NULL here, in which case a region of memory of similar size
+ * will be allocated by the function and freed before it returns. Temp Buffers
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
+ * buffers. If you will be calling this function repeatedly with similar parameters
+ * you should use a temp buffer. If the function is called from different threads
+ * concurrently, a different temp buffer should be used for each.
+ *
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
+ * when the destination tile is not aligned with the left edge of the image.
+ *
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
+ * when the destination tile is not aligned with the top edge of the image.
+ *
+ * @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
+ * For example, for a simple 3x3 blur, it might be:
+ * <pre>@textblock
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
+ * 2./16, 4./16, 2./16,
+ * 1./16, 2./16, 1./16 };
+ * @/textblock </pre>
+ *
+ * @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
+ *
+ * @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
+ *
+ * @param bias This value is added to the sum of weighted pixels.
+ *
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
+ * parameter provides the background color to be used for missing pixels when the
+ * kernel extends off the edge of the image.
+ *
+ * @param flags The following flags are allowed:
+ * <pre>@textblock
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
+ * copy the corresponding source pixel to the destination. This
+ * will result in a ring off unconvolved content at the edges
+ * and convolved content in the middle.
+ *
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
+ * For a blur filter this will look like the edges of the image
+ * have been blurred into a particular color. This is usually
+ * appropriate when the color of the surface onto which the image
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
+ * as a background color, and let the downstream image compositor
+ * blend in the background color. In this case, the result image
+ * should be treated as a premultiplied image.
+ *
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
+ * This is better when the image is drawn into a frame or other
+ * context where the background is not expected to contribute to
+ * the final content.
+ *
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
+ * simply ignored, and the bias and divisor are adjusted accordingly.
+ * Because of the complication at the edges, this edging mode can
+ * be significantly slower than the others. It can be numerically
+ * unstable if the sum over any rectangular subsection of the kernel
+ * is zero, which can result in division by zero during the computation.
+ * The results for this edging mode are usually quite visually similar
+ * to kvImageEdgeExtend.
+ *
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
+ * size of the temp buffer needed for this set of parameters. Does
+ * not touch the src or dest image.
+ *
+ * kvImageDoNotTile Disable internal multithreading.
+ *
+ * kvImageUseFP16Accumulator Enable 16-bit half-precision floating-point arithmetic when computing the
+ * kernel averages when the CPU architecture supports it.
+ *
+ * @/textblock </pre>
+ * The first four flags listed are edging modes. One and only one edging mode must be
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
+ * be returned.
+ *
+ * @return One of the following error codes may be returned:
+ * <pre>@textblock
+ * kvImageNoError Success.
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
+ * the temp buffer to use with this function and this set of
+ * parameters.
+ *
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
+ * kvImageEdgeExtend, kvImageTruncateKernel }
+ *
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
+ * to corresponding dimensions of the source buffer.
+ *
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
+ *
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
+ *
+ * kvImageNullPointerArgument kernel may not be NULL
+ *
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
+ *
+ * kvImageInvalidKernelSize The kernel height and width must be odd numbers.
+ * @/textblock </pre>
+ */
+VIMAGE_PF vImage_Error vImageConvolveWithBias_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, Pixel_16F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+
+/*!
+ * @function vImageConvolveWithBias_ARGB8888
+ * @abstract General convolution on a ARGB888 image of any channel order with bias.
+ * @discussion This filter applies a convolution filter of your choosing to a ARGB8888 image.
+ * This filter will work on any four-channel, 8-bit per component image format, not just ARGB.
* For each pixel:
* <pre>@textblock
* for each pixel[y][x] in image{
- * float sum = bias;
+ * int sumA = 0;
+ * int sumR = 0;
+ * int sumG = 0;
+ * int sumB = 0;
*
* // Calculate weighted average over kernel area
* for each kernel_element[i][j] in kernel{
- * sum += kernel_element[i][j] *
- * pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
- * [x+j+srcOffsetToROI_X- kernel_width/2];
+ * sumA += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][0];
+ * sumR += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][1];
+ * sumG += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][2];
+ * sumB += kernel_element[i][j] *
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][3];
* }
+ * // Correct for the scaling introduced by multiplying by the weights table
+ * sumA = (sumA + bias[0]) / divisor;
+ * sumR = (sumR + bias[1]) / divisor;
+ * sumG = (sumG + bias[2]) / divisor;
+ * sumB = (sumB + bias[3]) / divisor;
*
* // write out result
- * result[y][x] = sum;
+ * result[y][x][0] = CLAMP(sumA, 0, 255);
+ * result[y][x][1] = CLAMP(sumR, 0, 255);
+ * result[y][x][2] = CLAMP(sumG, 0, 255);
+ * result[y][x][3] = CLAMP(sumB, 0, 255);
* }
* @/textblock </pre>
* (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
@@ -870,6 +1470,7 @@
*
* This filter does not work in place.
*
+ *
* @param src The input image
*
* @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
@@ -897,16 +1498,28 @@
* @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
* For example, for a simple 3x3 blur, it might be:
* <pre>@textblock
- * const float kernel[9] = { 1./16, 2./16, 1./16,
- * 2./16, 4./16, 2./16,
- * 1./16, 2./16, 1./16 };
+ * const int16_t kernel[9] = { 1, 2, 1,
+ * 2, 4, 2,
+ * 1, 2, 1 };
* @/textblock </pre>
*
+ * The kernel values may not sum in any combination to be outside the range
+ * [-2**23, 2**23), or modulo overflow in the accumulator may result.
+ *
* @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
*
* @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
*
- * @param bias This value is added to the sum of weighted pixels.
+ * @param divisor The weighted sum of nearby pixels is typically a large number, which must be corrected
+ * to fit back into the image format of the destination image. The correction factor
+ * is passed in as divisor here, and is divided from the sum before the result is
+ * returned. Typically, the divisor is the sum over the area of the kernel. If the divisor
+ * is 0, 1 will be used instead.
+ *
+ * @param bias This value is added to the sum of weighted pixels before the divisor is applied.
+ * It can serve to both control rounding and adjust the brightness of the result.
+ * A large bias (e.g 128 * divisor) may be required for some kernels, such as edge
+ * detection filters, to return representable results.
*
* @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
* parameter provides the background color to be used for missing pixels when the
@@ -978,44 +1591,38 @@
* kvImageInvalidKernelSize The kernel height and width must be odd numbers.
* @/textblock </pre>
*/
-VIMAGE_PF vImage_Error vImageConvolveWithBias_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, Pixel_F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
-
+VIMAGE_PF vImage_Error vImageConvolveWithBias_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, int32_t bias, const Pixel_8888 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
/*!
- * @function vImageConvolveWithBias_ARGB8888
- * @abstract General convolution on a ARGB888 image of any channel order with bias.
- * @discussion This filter applies a convolution filter of your choosing to a ARGB8888 image.
- * This filter will work on any four-channel, 8-bit per component image format, not just ARGB.
+ * @function vImageConvolveWithBias_ARGBFFFF
+ * @abstract General convolution on a ARGBFFFF image of any channel order with bias.
+ * @discussion This filter applies a convolution filter of your choosing to a ARGBFFFF image.
+ * This filter will work on any four-channel, float per component image format, not just ARGB.
* For each pixel:
* <pre>@textblock
* for each pixel[y][x] in image{
- * int sumA = 0;
- * int sumR = 0;
- * int sumG = 0;
- * int sumB = 0;
+ * float sumA = bias[0];
+ * float sumR = bias[1];
+ * float sumG = bias[2];
+ * float sumB = bias[3];
*
* // Calculate weighted average over kernel area
* for each kernel_element[i][j] in kernel{
* sumA += kernel_element[i][j] *
- * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][0];
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][0];
* sumR += kernel_element[i][j] *
- * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][1];
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][1];
* sumG += kernel_element[i][j] *
- * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][2];
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][2];
* sumB += kernel_element[i][j] *
- * pixel[y+i+srcOffsetToROI_Y-kernel_height/2][x+j+srcOffsetToROI_X- kernel_width/2][3];
+ * pixel[y+i+srcOffsetToROI_Y-kernel_height/2] [x+j+srcOffsetToROI_X- kernel_width/2][3];
* }
- * // Correct for the scaling introduced by multiplying by the weights table
- * sumA = (sumA + bias[0]) / divisor;
- * sumR = (sumR + bias[1]) / divisor;
- * sumG = (sumG + bias[2]) / divisor;
- * sumB = (sumB + bias[3]) / divisor;
*
* // write out result
- * result[y][x][0] = CLAMP(sumA, 0, 255);
- * result[y][x][1] = CLAMP(sumR, 0, 255);
- * result[y][x][2] = CLAMP(sumG, 0, 255);
- * result[y][x][3] = CLAMP(sumB, 0, 255);
+ * result[y][x][0] = sumA;
+ * result[y][x][1] = sumR;
+ * result[y][x][2] = sumG;
+ * result[y][x][3] = sumB;
* }
* @/textblock </pre>
* (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
@@ -1024,7 +1631,6 @@
*
* This filter does not work in place.
*
- *
* @param src The input image
*
* @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
@@ -1052,28 +1658,16 @@
* @param kernel A pointer to a 1D array of weights of dimension kernel_height x kernel_width.
* For example, for a simple 3x3 blur, it might be:
* <pre>@textblock
- * const int16_t kernel[9] = { 1, 2, 1,
- * 2, 4, 2,
- * 1, 2, 1 };
+ * const float kernel[9] = { 1./16, 2./16, 1./16,
+ * 2./16, 4./16, 2./16,
+ * 1./16, 2./16, 1./16 };
* @/textblock </pre>
*
- * The kernel values may not sum in any combination to be outside the range
- * [-2**23, 2**23), or modulo overflow in the accumulator may result.
- *
* @param kernel_height The height of the 2D table of weights passed in as kernel. It must be an odd number.
*
* @param kernel_width The width of the 2D table of weights passed in as kernel. It must be an odd number.
*
- * @param divisor The weighted sum of nearby pixels is typically a large number, which must be corrected
- * to fit back into the image format of the destination image. The correction factor
- * is passed in as divisor here, and is divided from the sum before the result is
- * returned. Typically, the divisor is the sum over the area of the kernel. If the divisor
- * is 0, 1 will be used instead.
- *
- * @param bias This value is added to the sum of weighted pixels before the divisor is applied.
- * It can serve to both control rounding and adjust the brightness of the result.
- * A large bias (e.g 128 * divisor) may be required for some kernels, such as edge
- * detection filters, to return representable results.
+ * @param bias This value is added to the sum of weighted pixels.
*
* @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
* parameter provides the background color to be used for missing pixels when the
@@ -1145,20 +1739,28 @@
* kvImageInvalidKernelSize The kernel height and width must be odd numbers.
* @/textblock </pre>
*/
-VIMAGE_PF vImage_Error vImageConvolveWithBias_ARGB8888( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, int32_t bias, const Pixel_8888 backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
+VIMAGE_PF vImage_Error vImageConvolveWithBias_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, const Pixel_FFFF backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
/*!
- * @function vImageConvolveWithBias_ARGBFFFF
- * @abstract General convolution on a ARGBFFFF image of any channel order with bias.
- * @discussion This filter applies a convolution filter of your choosing to a ARGBFFFF image.
- * This filter will work on any four-channel, float per component image format, not just ARGB.
+ * @function vImageConvolveWithBias_ARGB16F
+ * @abstract General convolution on a ARGB16F image of any channel order.
+ * @discussion This filter applies a convolution filter of your choosing to a ARGB16F image.
+ * This filter will work on any four-channel, half-float per component image format, not just ARGB.
+ * The kernel values are specified as 32-bit single-precision floats and the
+ * weighted average is also computed in single precision by default. However, if
+ * the flag kvImageUseFP16Accumulator is set all internal filtering operations will
+ * use 16-bit half-precision floating-point arithmetic when the CPU architecture
+ * supports it. This results in up to 2x performance improvements but at the
+ * expense of a less precise result; typically 2-3 bits of precision is lost.
+ *
* For each pixel:
* <pre>@textblock
* for each pixel[y][x] in image{
- * float sumA = bias[0];
- * float sumR = bias[1];
- * float sumG = bias[2];
- * float sumB = bias[3];
+ * // Sums are declared as type _Float16 when the flag kvImageUseFP16Accumulator is set
+ * float sumA = bias;
+ * float sumR = bias;
+ * float sumG = bias;
+ * float sumB = bias;
*
* // Calculate weighted average over kernel area
* for each kernel_element[i][j] in kernel{
@@ -1173,10 +1775,10 @@
* }
*
* // write out result
- * result[y][x][0] = sumA;
- * result[y][x][1] = sumR;
- * result[y][x][2] = sumG;
- * result[y][x][3] = sumB;
+ * result[y][x][0] = (_Float16)sumA;
+ * result[y][x][1] = (_Float16)sumR;
+ * result[y][x][2] = (_Float16)sumG;
+ * result[y][x][3] = (_Float16)sumB;
* }
* @/textblock </pre>
* (Above, we imagine the kernel to be a 2D array of size kernel_height by kernel_width.
@@ -1261,7 +1863,10 @@
* size of the temp buffer needed for this set of parameters. Does
* not touch the src or dest image.
*
- * kvImageDoNotTile Disable internal multithreading.
+ * kvImageDoNotTile Disable internal multithreading.
+ *
+ * kvImageUseFP16Accumulator Enable 16-bit half-precision floating-point arithmetic when computing the
+ * kernel averages when the CPU architecture supports it.
*
* @/textblock </pre>
* The first four flags listed are edging modes. One and only one edging mode must be
@@ -1293,8 +1898,7 @@
* kvImageInvalidKernelSize The kernel height and width must be odd numbers.
* @/textblock </pre>
*/
-VIMAGE_PF vImage_Error vImageConvolveWithBias_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, const Pixel_FFFF backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.4), ios(5.0), watchos(1.0), tvos(5.0));
-
+VIMAGE_PF vImage_Error vImageConvolveWithBias_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, const Pixel_ARGB_16F backgroundColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
/*!
* @function vImageConvolveMultiKernel_ARGB8888
@@ -3181,6 +3785,150 @@
float bias, Pixel_F backgroundColor, vImage_Flags flags)
VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
+/*!
+ * @function vImageSepConvolve_Planar16F
+ * @abstract Separable convolution on a Planar16F image.
+ * @discussion This filter applies two separate 1D filters along the rows and columns of a Planar16F image.
+ * The weighted average is computed with single-precision floating-point kernel values. However, if
+ * the flag kvImageUseFP16Accumulator is set all internal filtering operations will
+ * use 16-bit half-precision floating-point arithmetic when the CPU architecture
+ * supports it. This results in up to 2x performance improvements but at the
+ * expense of a less precise result; typically 2-3 bits of precision is lost.
+ *
+ * For each pixel:
+ * <pre>@textblock
+ * for each pixel[y][x] in image {
+ * float sum = bias;
+ *
+ * // Calculate weighted average over kernel area
+ * for each kernelY_element[i] in kernelY {
+ * for each kernelX_element[j] in kernelX {
+ * sum += kernelY_element[i] * kernelX_element[j] *
+ * (float)pixel[y+i+srcOffsetToROI_Y-kernel_height/2]
+ * [x+j+srcOffsetToROI_X- kernel_width/2];
+ * }
+ * }
+ *
+ * // Convert to half precisio and write out result
+ * result[y][x] = (_Float16)sum;
+ * }
+ * @/textblock </pre>
+ *
+ * This filter does not work in place.
+ *
+ * @param src The input image
+ *
+ * @param dest A pointer to a preallocated vImage_Buffer to receive the result image.
+ * This may not alias the src image.
+ *
+ * @param tempBuffer An optional pointer to a region of memory to use as a working area during
+ * computation. The size of the tempBuffer is given by calling the function
+ * with the same parameters and the kvImageGetTempBufferSize flag, in which case
+ * the size is returned instead of an error code from the left hand side.
+ * You may pass NULL here, in which case a region of memory of similar size
+ * will be allocated by the function and freed before it returns. Temp Buffers
+ * are a way of avoiding lost time due to VM faults to initialize newly allocated
+ * buffers. If you will be calling this function repeatedly with similar parameters
+ * you should use a temp buffer. If the function is called from different threads
+ * concurrently, a different temp buffer should be used for each.
+ *
+ * @param srcOffsetToROI_X An offset used in tiling to shift the position of the destination image
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
+ * when the destination tile is not aligned with the left edge of the image.
+ *
+ * @param srcOffsetToROI_Y An offset used in tiling to shift the position of the destination image
+ * relative to the src image. Typically this is 0. Non-Zero values are needed
+ * when the destination tile is not aligned with the top edge of the image.
+ *
+ * @param kernelX A pointer to a 1D array of weights of dimension kernelX_width.
+ *
+ * @param kernelX_width The width of the 1D array of weights passed in as kernelX. It must be an odd number.
+ *
+ * @param kernelY A pointer to a 1D array of weights of dimension kernelY_width.
+ *
+ * @param kernelY_width The width of the 1D array of weights passed in as kernelY. It must be an odd number.
+ *
+ * @param bias This value is added to the sum of weighted pixels.
+ *
+ * @param backgroundColor When the kvImageBackgroundColorFill edging mode is active, the backgroundColor
+ * parameter provides the background color to be used for missing pixels when the
+ * kernel extends off the edge of the image.
+ *
+ * @param flags The following flags are allowed:
+ * <pre>@textblock
+ * kvImageCopyInPlace If any pixels covered by the kernel do no not exist, simply
+ * copy the corresponding source pixel to the destination. This
+ * will result in a ring off unconvolved content at the edges
+ * and convolved content in the middle.
+ *
+ * kvImageBackgroundColorFill Substitute in the provided background color for missing pixels.
+ * For a blur filter this will look like the edges of the image
+ * have been blurred into a particular color. This is usually
+ * appropriate when the color of the surface onto which the image
+ * will be drawn is known. You can also use {Alpha = 0, color = 0}
+ * as a background color, and let the downstream image compositor
+ * blend in the background color. In this case, the result image
+ * should be treated as a premultiplied image.
+ *
+ * kvImageEdgeExtend Substitute in the nearest defined pixel for missing pixels.
+ * This is better when the image is drawn into a frame or other
+ * context where the background is not expected to contribute to
+ * the final content.
+ *
+ * kvImageTruncateKernel This is similar to kvImageEdgeExtend, except that edge pixels are
+ * simply ignored, and the bias and divisor are adjusted accordingly.
+ * Because of the complication at the edges, this edging mode can
+ * be significantly slower than the others. It can be numerically
+ * unstable if the sum over any rectangular subsection of the kernel
+ * is zero, which can result in division by zero during the computation.
+ * The results for this edging mode are usually quite visually similar
+ * to kvImageEdgeExtend.
+ *
+ * kvImageGetTempBufferSize Instead of calculating the convolution of the image, return the
+ * size of the temp buffer needed for this set of parameters. Does
+ * not touch the src or dest image.
+ *
+ * kvImageDoNotTile Disable internal multithreading.
+ *
+ * kvImageUseFP16Accumulator Enable 16-bit half-precision floating-point arithmetic when computing the
+ * kernel averages when the CPU architecture supports it.
+ *
+ * @/textblock </pre>
+ * The first four flags listed are edging modes. One and only one edging mode must be
+ * provided. If no edging mode is provided (e.g. kvImageNoFlags), then an error will
+ * be returned.
+ *
+ * @return One of the following error codes may be returned:
+ * <pre>@textblock
+ * kvImageNoError Success.
+ * >= 0 If kvImageGetTempBufferSize is passed, this is the size of
+ * the temp buffer to use with this function and this set of
+ * parameters.
+ *
+ * kvImageInvalidEdgeStyle One and only one of the following flags must be provided:
+ * { kvImageCopyInPlace, kvImageBackgroundColorFill,
+ * kvImageEdgeExtend, kvImageTruncateKernel }
+ *
+ * kvImageRoiLargerThanInputBuffer The dest->width and height must be less than or equal
+ * to corresponding dimensions of the source buffer.
+ *
+ * kvImageInvalidOffset_X The destination width + srcOffsetToROI_X > src->width
+ *
+ * kvImageInvalidOffset_Y The destination height + srcOffsetToROI_Y > src->height
+ *
+ * kvImageNullPointerArgument kernel may not be NULL
+ *
+ * kvImageMemoryAllocationError Could not allocate memory to serve as a temp buffer.
+ *
+ * kvImageInvalidKernelSize The kernel sizes must be odd numbers.
+ * @/textblock </pre>
+*/
+VIMAGE_PF vImage_Error
+vImageSepConvolve_Planar16F(const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer,
+ vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y,
+ const float *kernelX, uint32_t kernelX_width, const float *kernelY, uint32_t kernelY_width,
+ float bias, Pixel_16F backgroundColor, vImage_Flags flags)
+ VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
/*!
* @function vImageSepConvolve_Planar16U
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h 2022-02-23 07:16:42.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h 2022-05-31 15:02:55.000000000 -0400
@@ -145,6 +145,9 @@
VIMAGE_PF vImage_Error vImageRotate_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, float angleInRadians, const Pixel_ARGB_16U backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageRotate_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, float angleInRadians, const Pixel_ARGB_16S backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageRotate_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, float angleInRadians, const Pixel_FFFF backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
+VIMAGE_PF vImage_Error vImageRotate_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, float angleInRadians, const Pixel_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageRotate_CbCr16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, float angleInRadians, const Pixel_16F16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageRotate_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, float angleInRadians, const Pixel_ARGB_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
/*
* vImageScale_<fmt>
@@ -179,14 +182,22 @@
* of the filter.
*
* vImageScale_<fmt>() does not work in place
- * The ARGB8888, ARGB16U, ARGB16S and ARGBFFFF functions work equally well on
+ * The ARGB8888, ARGB16U, ARGB16S, ARGB16F and ARGBFFFF functions work equally well on
* other channel orderings of 4-channel images, such as RGBA or BGRA.
*
* Acceptable flags are kvImageEdgeExtend, kvImageDoNotTile,
- * kvImageHighQualityResampling, kvImageNoFlags.
+ * kvImageHighQualityResampling, kvImageNoFlags and, for 16F images,
+ * kvImageUseFP16Accumulator (see further details below).
* If no edging mode is passed, kvImageEdgeExtend is used.
- * Developers using vImageScale_<fmt> on MacOS X.3 should pass kvImageEdgeExtend
- * in the flags field to avoid ringing artifacts at the edges of images
+ *
+ * For the scaling functions operating on Planar16F, CbCr16F, and ARGB16F images,
+ * the flag kvImageUseFP16Accumulator is also allowed. This will enforce all
+ * internal filtering operations to use 16-bit half-precision floating-point
+ * arithmetic rather than the default 32-bit single-precision arithmetic when
+ * the architecture of the CPU supports it. This results in up to 2x performance
+ * improvements but at the expense of a less precise result; typically 2-3 bits
+ * of precision is lost.
+
*/
VIMAGE_PF vImage_Error vImageScale_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
VIMAGE_PF vImage_Error vImageScale_Planar16S( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.10), ios(8.0), watchos(1.0), tvos(8.0));
@@ -196,6 +207,9 @@
VIMAGE_PF vImage_Error vImageScale_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageScale_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageScale_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
+VIMAGE_PF vImage_Error vImageScale_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageScale_CbCr16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageScale_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
VIMAGE_PF vImage_Error
vImageScale_CbCr8(
@@ -258,6 +272,9 @@
VIMAGE_PF vImage_Error vImageAffineWarp_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform *transform, const Pixel_ARGB_16U backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageAffineWarp_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform *transform, const Pixel_ARGB_16S backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageAffineWarp_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform *transform, const Pixel_FFFF backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
+VIMAGE_PF vImage_Error vImageAffineWarp_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform *transform, const Pixel_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageAffineWarp_CbCr16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform *transform, const Pixel_16F16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageAffineWarp_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform *transform, const Pixel_ARGB_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
#if VIMAGE_AFFINETRANSFORM_DOUBLE_IS_AVAILABLE
/* A single precision transformation matrix is often not enough. This one uses double precision. */
@@ -267,6 +284,9 @@
VIMAGE_PF vImage_Error vImageAffineWarpD_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform_Double *transform, const Pixel_ARGB_16U backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageAffineWarpD_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform_Double *transform, const Pixel_ARGB_16S backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageAffineWarpD_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform_Double *transform, const Pixel_FFFF backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(10.8), ios(6.0), watchos(1.0), tvos(6.0));
+VIMAGE_PF vImage_Error vImageAffineWarpD_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform_Double *transform, const Pixel_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageAffineWarpD_CbCr16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform_Double *transform, const Pixel_16F16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageAffineWarpD_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, const vImage_AffineTransform_Double *transform, const Pixel_ARGB_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
#endif
#if VIMAGE_CGAFFINETRANSFORM_IS_AVAILABLE
@@ -310,6 +330,9 @@
VIMAGE_PF vImage_Error vImageHorizontalReflect_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageHorizontalReflect_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageHorizontalReflect_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
+VIMAGE_PF vImage_Error vImageHorizontalReflect_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageHorizontalReflect_CbCr16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageHorizontalReflect_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
VIMAGE_PF vImage_Error vImageVerticalReflect_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
VIMAGE_PF vImage_Error vImageVerticalReflect_Planar16U( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(6.0), watchos(1.0), tvos(6.0));
@@ -318,6 +341,9 @@
VIMAGE_PF vImage_Error vImageVerticalReflect_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageVerticalReflect_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageVerticalReflect_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
+VIMAGE_PF vImage_Error vImageVerticalReflect_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageVerticalReflect_CbCr16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
+VIMAGE_PF vImage_Error vImageVerticalReflect_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
/*
* The Rotate90 function does simple 0, 90, 180 or 270 degree rotation according to the value of a rotation constant
@@ -356,6 +382,9 @@
VIMAGE_PF vImage_Error vImageRotate90_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, uint8_t rotationConstant, const Pixel_ARGB_16U backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageRotate90_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, uint8_t rotationConstant, const Pixel_ARGB_16S backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageRotate90_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, uint8_t rotationConstant, const Pixel_FFFF backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2,4) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
+VIMAGE_PF vImage_Error vImageRotate90_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, uint8_t rotationConstant, const Pixel_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(11.1), ios(15.0), watchos(8.0), tvos(15.0));
+VIMAGE_PF vImage_Error vImageRotate90_CbCr16F( const vImage_Buffer *src, const vImage_Buffer *dest, uint8_t rotationConstant, const Pixel_16F16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(11.1), ios(15.0), watchos(8.0), tvos(15.0));
+VIMAGE_PF vImage_Error vImageRotate90_ARGB16F( const vImage_Buffer *src, const vImage_Buffer *dest, uint8_t rotationConstant, const Pixel_ARGB_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(11.1), ios(15.0), watchos(8.0), tvos(15.0));
/*
* The Shearing functions use resampling to rescale a image and offset it to
@@ -369,17 +398,26 @@
* is done by adjusting the resampling kernel.
*
* All four channel geometry functions (i.e. those that support ARGB8888,
- * ARGB16U, ARGB16S or ARGBFFFF images) work equally well on four channel
- * images with other channel orderings such as RGBA or BGRA.
+ * ARGB16U, ARGB16S, ARGB16F, or ARGBFFFF images) work equally well on four
+ * channel images with other channel orderings such as RGBA or BGRA.
*
* These functions do not work in place.
*
* Acceptable flags are kvImageEdgeExtend, kvImageBackgroundColor,
- * kvImageDoNotTile, kvImageNoFlags.
+ * kvImageDoNotTile, kvImageNoFlags and, for 16F images,
+ * kvImageUseFP16Accumulator (see further details below).
* Only one of kvImageEdgeExtend or kvImageBackgroundColor may be used.
* If none is used then the edging mode is undefined and the results may be
* unpredictable.
*
+ * For the geometry functions operating on Planar16F, CbCr16F, and ARGB16F images,
+ * the flag kvImageUseFP16Accumulator is also allowed. This will enforce all
+ * internal filtering operations to use 16-bit half-precision floating-point
+ * arithmetic rather than the default 32-bit single-precision arithmetic when
+ * the architecture of the CPU supports it. This results in up to 2x performance
+ * improvements but at the expense of a less precise result; typically 2-3 bits
+ * of precision is lost.
+ *
* The ResamplingFilter is created using vImageNewResamplingFilter or
* vImageNewResamplingFilterForFunctionUsingBuffer. The latter gives more
* precise control over where the memory is allocated and which filter function
@@ -394,6 +432,9 @@
VIMAGE_PF vImage_Error vImageHorizontalShear_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float xTranslate, float shearSlope, ResamplingFilter filter, const Pixel_ARGB_16U backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageHorizontalShear_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float xTranslate, float shearSlope, ResamplingFilter filter, const Pixel_ARGB_16S backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageHorizontalShear_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float xTranslate, float shearSlope, ResamplingFilter filter, const Pixel_FFFF backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
+VIMAGE_PF vImage_Error vImageHorizontalShear_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float xTranslate, float shearSlope, ResamplingFilter filter, const Pixel_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
+VIMAGE_PF vImage_Error vImageHorizontalShear_CbCr16F(const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float xTranslate, float shearSlope, ResamplingFilter filter, const Pixel_16F16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
+VIMAGE_PF vImage_Error vImageHorizontalShear_ARGB16F(const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float xTranslate, float shearSlope, ResamplingFilter filter, const Pixel_ARGB_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
VIMAGE_PF vImage_Error vImageVerticalShear_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float yTranslate, float shearSlope, ResamplingFilter filter, Pixel_8 backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
VIMAGE_PF vImage_Error vImageVerticalShear_Planar16S( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float yTranslate, float shearSlope, ResamplingFilter filter, Pixel_16S backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.10), ios(8.0), watchos(1.0), tvos(8.0));
@@ -403,6 +444,9 @@
VIMAGE_PF vImage_Error vImageVerticalShear_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float yTranslate, float shearSlope, ResamplingFilter filter, const Pixel_ARGB_16U backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageVerticalShear_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float yTranslate, float shearSlope, ResamplingFilter filter, const Pixel_ARGB_16S backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageVerticalShear_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float yTranslate, float shearSlope, ResamplingFilter filter, const Pixel_FFFF backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.3), ios(5.0), watchos(1.0), tvos(5.0));
+VIMAGE_PF vImage_Error vImageVerticalShear_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float yTranslate, float shearSlope, ResamplingFilter filter, const Pixel_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
+VIMAGE_PF vImage_Error vImageVerticalShear_CbCr16F(const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float yTranslate, float shearSlope, ResamplingFilter filter, const Pixel_16F16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
+VIMAGE_PF vImage_Error vImageVerticalShear_ARGB16F(const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, float yTranslate, float shearSlope, ResamplingFilter filter, const Pixel_ARGB_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
/* Versions of shear functions that take coordinates in double precision */
VIMAGE_PF vImage_Error vImageHorizontalShearD_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double xTranslate, double shearSlope, ResamplingFilter filter, Pixel_8 backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.8), ios(6.0), watchos(1.0), tvos(6.0));
@@ -411,6 +455,9 @@
VIMAGE_PF vImage_Error vImageHorizontalShearD_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double xTranslate, double shearSlope, ResamplingFilter filter, const Pixel_ARGB_16U backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageHorizontalShearD_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double xTranslate, double shearSlope, ResamplingFilter filter, const Pixel_ARGB_16S backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageHorizontalShearD_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double xTranslate, double shearSlope, ResamplingFilter filter, const Pixel_FFFF backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.8), ios(6.0), watchos(1.0), tvos(6.0));
+VIMAGE_PF vImage_Error vImageHorizontalShearD_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double xTranslate, double shearSlope, ResamplingFilter filter, const Pixel_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
+VIMAGE_PF vImage_Error vImageHorizontalShearD_CbCr16F(const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double xTranslate, double shearSlope, ResamplingFilter filter, const Pixel_16F16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
+VIMAGE_PF vImage_Error vImageHorizontalShearD_ARGB16F(const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double xTranslate, double shearSlope, ResamplingFilter filter, const Pixel_ARGB_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
VIMAGE_PF vImage_Error vImageVerticalShearD_Planar8( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double yTranslate, double shearSlope, ResamplingFilter filter, Pixel_8 backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.8), ios(6.0), watchos(1.0), tvos(6.0));
VIMAGE_PF vImage_Error vImageVerticalShearD_PlanarF( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double yTranslate, double shearSlope, ResamplingFilter filter, Pixel_F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.8), ios(6.0), watchos(1.0), tvos(6.0));
@@ -418,6 +465,9 @@
VIMAGE_PF vImage_Error vImageVerticalShearD_ARGB16U( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double yTranslate, double shearSlope, ResamplingFilter filter, const Pixel_ARGB_16U backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageVerticalShearD_ARGB16S( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double yTranslate, double shearSlope, ResamplingFilter filter, const Pixel_ARGB_16S backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.9), ios(7.0), watchos(1.0), tvos(7.0));
VIMAGE_PF vImage_Error vImageVerticalShearD_ARGBFFFF( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double yTranslate, double shearSlope, ResamplingFilter filter, const Pixel_FFFF backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(10.8), ios(6.0), watchos(1.0), tvos(6.0));
+VIMAGE_PF vImage_Error vImageVerticalShearD_Planar16F( const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double yTranslate, double shearSlope, ResamplingFilter filter, const Pixel_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
+VIMAGE_PF vImage_Error vImageVerticalShearD_CbCr16F(const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double yTranslate, double shearSlope, ResamplingFilter filter, const Pixel_16F16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
+VIMAGE_PF vImage_Error vImageVerticalShearD_ARGB16F(const vImage_Buffer *src, const vImage_Buffer *dest, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, double yTranslate, double shearSlope, ResamplingFilter filter, const Pixel_ARGB_16F backColor, vImage_Flags flags ) VIMAGE_NON_NULL(1,2) API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
VIMAGE_PF vImage_Error
vImageHorizontalShear_CbCr8(
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h 2022-02-23 07:14:35.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h 2022-05-31 14:50:28.000000000 -0400
@@ -303,6 +303,36 @@
typedef int16_t Pixel_ARGB_16S[4]; /* four-channel 16-bit signed pixel */
/*!
+ @typedef Pixel_16F
+ @abstract A 16-bit half precision floating-point planar pixel value.
+ @discussion Typically, these have range [0,1] though other values are generally allowed.
+ Defined as a 16-bit integer since this is a storage format only.
+ */
+typedef uint16_t Pixel_16F; /* 16-bit floating point planar pixel value */
+
+/*!
+ @typedef Pixel_16F16F
+ @abstract A two-channel, 16-bit floating-point per channel pixel.
+ @discussion The channel order is generally given by the function that consumes the value.
+ */
+typedef uint16_t Pixel_16F16F[2]; /* CbCr interleaved 16-bit floating point per channel pixel value. uint16_t[2] = { Cb, Cr } */
+
+/*!
+ @typedef Pixel_ARGB_16F
+ @abstract A four-channel, 16-bit floating-point per channel pixel.
+ @discussion The channel order is generally given by the function that consumes the value.
+ */
+typedef uint16_t Pixel_ARGB_16F[4]; /* ARGB interleaved 16-bit floating point per channel pixel value. uint16_t[2] = { Cb, Cr } */
+
+
+/*!
+ @typedef Pixel_FF
+ @abstract A two-channel, single precision floating-point per channel pixel.
+ @discussion The channel order is generally given by the function that consumes the value.
+ */
+typedef float Pixel_FF[2]; /* CbCr interleaved (floating point) pixel value. float[2] = { Cb, Cr } */
+
+/*!
@typedef ResamplingFilter
@abstract A ResamplingFilter is an opaque structure used by vImage to hold precalculated filter coefficients for a resampling filter,
such as a Lanczos or Gaussian resampling filter.
@@ -533,6 +563,13 @@
encounter precision issues with HDR content. For these cases, if you know you have HDR content,
pass kvImageHDRContent and a (typically slower) alternative method will be used for these
sources.
+
+ @constant kvImageUseFP16Accumulator Use a faster and lower precision internal arithmetic, when available,
+ for the functions operating on 16-bit half-precision floating-point pixels (Pixel16_F).
+ This will enforce for example convolutions to be computed with 16-bit half-precision floating-point
+ arithmetic internally, when architecture of the CPU supports it. The arm64e architectures supports it
+ but none of the Intel architectures.
+
*/
typedef VIMAGE_OPTIONS_ENUM(vImage_Flags, uint32_t)
{
@@ -583,9 +620,14 @@
/* Pass to disable clamping is some conversions to floating point formats. Use this if the input data
may describe values outside [0,1] which should be preserved.. */
- kvImageDoNotClamp VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_12, __IPHONE_9_3 ) = 2048
-};
+ kvImageDoNotClamp VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_10_12, __IPHONE_9_3 ) = 2048,
+ /* Use a lower precision, faster floating-point arithmetic for all internal computations when available.
+ This applies to all functions operating on 16-bit half-precision floating-point pixels, Pixel_16F. */
+ kvImageUseFP16Accumulator /*VIMAGE_ENUM_AVAILABLE_STARTING( __MAC_13_0, __IPHONE_16_0 )*/ = 4096,
+};
+
+
/*!
@class vImageConverterRef
@abstract An opaque type which contains a decription of a conversion from one CoreGraphics image format to another.
- README
- xcode13.0 Binding Status
- xcode13.1 Binding Status
- xcode13.2 Binding Status
- xcode13.3 Binding Status
- xcode13.4 Binding Status
- xcode14.0 Binding Status
- xcode14.1 Binding Status
- xcode14.2 Binding Status
- xcode14.3 Binding Status
- xcode15.0 Binding Status
- xcode15.1 Binding Status
- xcode15.3 Binding Status
- xcode15.4 Binding Status
- xcode16.0 Binding Status
- xcode16.1 Binding Status
- xcode16.2 Binding Status