Converts an ARGB2101010 format image to an ARGB16F format image.


func vImageConvert_ARGB2101010ToARGB16F(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ RGB101010RangeMin: Int32, _ RGB101010RangeMax: Int32, _ permuteMap: UnsafePointer<UInt8>!, _ flags: vImage_Flags) -> vImage_Error



A pointer to the vImage buffer that references 10-bit RGB interleaved source pixels.


A pointer to the vmage buffer that references 16-bit float ARGB interleaved destination pixels.


The minimum value for the range of 10-bit RGB pixels.


The maximum value for the range of 10-bit RGB pixels.


An array of four 8-bit integers with the values 0, 1, 2, and 3, in some order. Each value specifies a channel from the source image that should be copied to that channel in the destination image. 0 denotes the alpha channel, 1 the red channel, 2 the green channel, and 3 the blue channel. 


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.


RGB101010RangeMin and RGB101010RangeMax are available for non-full-range pixel values. You can set full-range pixel values as:

 RGB101010RangeMin  = 0;
 RGB101010RangeMax  = 1023;

The per-pixel operation is:

 uint32_t *srcPixel =;
 uint32_t pixel = ntohl(srcPixel[0]);
 srcPixel += 1;
 int32_t R10 = (pixel >> 20) & 0x3ff;
 int32_t G10 = (pixel >> 10) & 0x3ff;
 int32_t B10 = (pixel >>  0) & 0x3ff;
 int32_t range10 = RGB101010RangeMax - RGB101010RangeMin;
 float RF, GF, BF;
 RF = (R10 - RGB101010RangeMin) / (float)range10;
 GF = (G10 - RGB101010RangeMin) / (float)range10;
 BF = (B10 - RGB101010RangeMin) / (float)range10;
 if (!(flags & kvImageDoNotClamp)) {
    RF = CLAMP(RF, 0.0f, 1.0f);
    GF = CLAMP(GF, 0.0f, 1.0f);
    BF = CLAMP(BF, 0.0f, 1.0f);
 float ARGB[4];
 ARGB[0] = alpha;
 ARGB[1] = RF;
 ARGB[2] = GF;
 ARGB[3] = BF;
 uint16_t *destPixel =;
 destPixel[0] = ConvertFloatToHalf(ARGB[permA]);
 destPixel[1] = ConvertFloatToHalf(ARGB[permR]);
 destPixel[2] = ConvertFloatToHalf(ARGB[permG]);
 destPixel[3] = ConvertFloatToHalf(ARGB[permB]);
 destPixel += 4;

See Also

Converting from ARGB Formats

func vImageConvert_ARGBFFFFtoRGBFFF(UnsafePointer<vImage_Buffer>!, UnsafePointer<vImage_Buffer>!, vImage_Flags) -> vImage_Error

Converts a four-channel ARGBFFFF image to a three-channel RGBFFF image by removing the alpha channel.

func vImageConvert_ARGB8888toRGB888(UnsafePointer<vImage_Buffer>, UnsafePointer<vImage_Buffer>, vImage_Flags) -> vImage_Error

Converts a four-channel ARGB8888 image to a three-channel RGB888 image by removing the alpha channel..