Converts a Planar8 image to a Planar4 image.
SDKs
- iOS 7.0+
- macOS 10.9+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Accelerate
Declaration
func vImageConvert_Planar8toPlanar4(_ src: Unsafe Pointer<v Image _Buffer>, _ dest: Unsafe Pointer<v Image _Buffer>, _ tempBuffer: Unsafe Mutable Raw Pointer!, _ dither: Int32, _ flags: v Image _Flags) -> v Image _Error
Parameters
src
A pointer to the source vImage buffer object.
dest
A pointer to the destination vImage buffer object. Because the source pixel format is smaller than a byte, there are multiple pixels in each byte of the data buffer. These pixels are interpreted as being in big endian order (that is, the low-indexed pixel is in the high-order bits of the byte).
Sub-byte indexing of scanlines is unsupported, because the data and rowBytes fields of the buffer are specified in whole bytes.
Widths, however, are measured in pixels, so a scanline may end in the middle of a byte. If this occurs, the contents of any unused bits of the final byte are ignored.
tempBuffer
A pointer to temporary buffer for the routine to use for scratch space. If non-NULL, the buffer must be at least as large as the value returned by calling this function with the
kv
flag. If NULL, this function will still work, but may allocate and free a scratch buffer internally.Image Get Temp Buffer Size dither
Type of dithering, if any, to apply to the image.
flags
The options to use when performing the operation. If you plan to perform your own tiling or use multithreading, pass
kv
.Image Do Not Tile
Return Value
kv
; otherwise, one of the error codes described in Data Types and Constants.
Discussion
This function supports the following dithering options:
kv
Image Convert _Dither None This option applies no dithering. Input values are rounded to the nearest value representable in the destination format.
kv
Image Convert _Dither Ordered Precomputed blue noise is added to the image before the values are rounded to the destination format. The offset into the blue noise is randomized per call to avoid visible artifacts if you do your own tiling or call the function on sequential frames of video.
kv
Image Convert _Dither Ordered Reproducible Precomputed blue noise is added to the image before the values are rounded to the destination format. The offset into the blue noise is the same for every call to allow users to get reproducible results.
kv
Image Convert _Dither Floyd Steinberg Floyd-Steinberg dithering is applied to the image.
kv
Image Convert _Dither Atkinson Atkinson dithering is applied to the image.
You can further influence the ordered dither methods by shaping the noise distribution using the Gaussian and uniform options below. These options are OR-ed with kv
or kv
:
kv
Image Convert _Ordered Gaussian Blue When using an ordered dither pattern, distribute the noise according to a Gaussian distribution. This generally gives more pleasing images—less noisy and perhaps a little more saturated—but color fidelity can suffer. Its effect is between
kv
andImage Convert _Dither None kv
Image Convert _Dither Ordered |
kv
. This option is the default forImage Convert _Dither Uniform kv
andImage Convert _Dither Ordered kv
.Image Convert _Dither Ordered Reproducible kv
Image Convert _Ordered Uniform Blue When using an ordered dither pattern, distribute the noise uniformly. This generally gives the best color fidelity, but the resulting image is noisier and more obviously dithered. This is usually the best choice when low bit depth content is drawn next to high bit depth content and in other circumstances where subtle changes to color arising from the conversion could be easily noticed. It may be a poor choice when the image is likely to be enlarged—which would cause the noise to become more evident—and for very flat or synthetic content with little inherent noise. You can avoid the enlargement problem by enlarging first at high bit depth, then converting to lower bit depth.