Function

vImageLookupTable_PlanarFtoPlanar8(_:_:_:_:)

Uses a lookup table to transform an image in PlanarF format to an image in Planar8 format.

Declaration

func vImageLookupTable_PlanarFtoPlanar8(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ table: UnsafePointer<Pixel_8>, _ flags: vImage_Flags) -> vImage_Error

Parameters

src

A pointer to a vImage buffer structure that contains the source image.

dest

A pointer to a vImage buffer data structure. You're responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer this structure points to contains the destination image data. When you no longer need the data buffer, you must deallocate the memory

table

A lookup table that contains 4096 values.

flags

The options to use when performing the operation. If you plan to perform your own tiling or use multithreading, pass kvImageDoNotTile.

Return Value

kvImageNoError; otherwise, one of the error codes described in Data Types and Constants.

Discussion

The per-pixel conversion calculation is equivalent to

uint8_t table[4096];
uint32_t index = (uint32_t) MIN( MAX( input_float_pixel * 4096.0f, 0.0f), 4095.0f);
uint8_t result_pixel = table[ index ];
additional channels. All channels will use the same table.

The input is a buffer of floating-point pixels. The output is a buffer of 8-bit pixels. This function can also work for multichannel data by scaling the width of the image to compensate for the additional channels. All channels will use the same table.

This function works in place, provided that src->data == dest->data and src->rowBytes >= dest->rowBytes. If src->rowBytes > dest->rowBytes, you must pass the kvImageDoNotTile flag.

See Also

Transforming with a Lookup Table

func vImageLookupTable_8to64U(UnsafePointer<vImage_Buffer>, UnsafePointer<vImage_Buffer>, UnsafePointer<UInt64>, vImage_Flags) -> vImage_Error

Uses a lookup table to remap 8-bit unsigned integers in a source image to 64-bit unsigned values.