Contents

vImageLookupTable_Planar16(_:_:_:_:)

Uses a lookup table to transform a 16-bit planar image.

Declaration

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

Parameters

  • src:

    The source vImage buffer.

  • dest:

    A pointer to the destination vImage buffer 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, deallocate the memory to prevent memory leaks.

  • table:

    A lookup table that contains 65,536 Pixel_16u values.

  • flags:

    The options to use when performing the operation. If your code implements its own tiling or its own multithreading, pass Kvimagedonottile; otherwise, pass Kvimagenoflags.

Return Value

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

Discussion

For each pixel, this function uses the value from the source image as an index to the 16-bit value from the table. The per-pixel conversion calculation is equivalent to the following:

Pixel_16U table[0x10000];
Pixel_16U result_pixel = table[ input_16_bit_pixel ];

You can use this function with multichannel data by scaling the width of the image to compensate for the additional channels. In this case, all channels use the same lookup table.

This function works in place.

See Also

Transforming planar-to-planar with a lookup table