Function

vImageConvert_FTo16S

Converts a PlanarF image into a special format in which each pixel is a 16-bit signed integer.

Declaration

vImage_Error vImageConvert_FTo16S(const vImage_Buffer *src, const vImage_Buffer *dest, float offset, float scale, vImage_Flags flags);

Parameters

src

A pointer to a vImage buffer structure that contains the source image whose data you want to convert.

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.

offset

The offset value to subtract from every pixel.

scale

The scale value to divide each pixel by.

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

Each pixel value is first offset and scaled by the provided values, and then changed to a 16-bit signed integer (rounded and clipped as necessary). The calculation is as follows:

    resultPixel = SATURATED_CLIP_SHRT_MIN_to_SHRT_MAX( (srcPixel - offset)
                    / scale + 0.5f)

The functions vImageConvert_16SToF and vImageConvert_FTo16S are inverse transformations when you use the same offset and scale values for each. (The inversion is not precise due to round-off error.) This requires the two functions to use these values differently (and in a different order).

See Also

Converting from Planar Formats

vImageConvert_Planar8ToARGBFFFF

Combines four Planar8 images into one ARGBFFFF image.

vImageConvert_Planar8toARGB1555

Combines four Planar8 images into one ARGB1555 image.

vImageConvert_Planar8toARGB8888

Combines four Planar8 images into one ARGB8888 image.

vImageConvert_Planar8ToBGRX8888

Interleaves three Planar8 images into one BGRX8888 image.

vImageConvert_Planar8ToBGRXFFFF

Combines three Planar8 images into one BGRXFFFF image.

vImageConvert_Planar8toRGB565

Combines three Planar8 images into one RGB565 image.

vImageConvert_Planar8toRGB888

Combines three Planar8 images into one RGB888 image.

vImageConvert_Planar8ToXRGBFFFF

Combines three Planar8 images into one XRGBFFFF image.

vImageConvert_Planar8ToXRGB8888

Interleaves three Planar8 images into one XRGB8888 image.

vImageConvert_Planar8To16U

Converts a Planar8 image to a 16U image .

vImageConvert_Planar8ToRGBXFFFF

Combines three Planar8 images into one RGBXFFFF image.

vImageConvert_Planar8ToRGBX8888

Interleaves three Planar8 images into one RGBX8888 image.

vImageConvert_Planar8toIndexed1

Converts a Planar8 image to an indexed 1-bit image.

vImageConvert_Planar8toIndexed2

Converts a Planar8 image to an indexed 2-bit image.

vImageConvert_Planar8toIndexed4

Converts a Planar8 image to an indexed 4-bit image.

vImageConvert_Planar16Q12toARGB16F

Combines three 16Q12 images into one ARGB16F image.

vImageConvert_Planar16UtoARGB16U

Combines four 16U images into one ARGB16U image.

vImageConvert_Planar16Q12toRGB888

Combines three 16Q12 images into one RGB888 image.

vImageConvert_Planar16Q12toARGB8888

Combines three 16Q12 images into one ARGB8888 image.

vImageConvert_Planar16Q12toRGB16F

Combines three 16Q12 images into one RGB16F image.

vImageConvert_Planar16UtoRGB16U

Combines three 16U images into one RGB16U image.

vImageConvert_FTo16U

Converts a PlanarF image into a special format in which each pixel is a 16-bit unsigned integer.

vImageConvert_PlanarFtoARGBFFFF

Combines four PlanarF images into one ARGBFFFF image.

vImageConvert_PlanarFToARGB8888

Converts four PlanarF images into one ARGB8888 image.

vImageConvert_PlanarFtoRGBFFF

Combines three PlanarF images into one RGBFFF image.

vImageConvert_PlanarFToBGRX8888

Converts three PlanarF images into one BGRX8888 image.

vImageConvert_PlanarFToBGRXFFFF

Converts three PlanarF images into one BGRXFFFF image.

vImageConvert_PlanarFToXRGBFFFF

Converts three PlanarF images into one XRGBFFFF image.

vImageConvert_PlanarFToXRGB8888

Converts three PlanarF images into one XRGB8888 image.

vImageConvert_PlanarFToRGBXFFFF

Converts three PlanarF images into one RGBXFFFF image.

vImageConvert_PlanarFToRGBX8888

Converts three PlanarF images into one RGBX8888 image.