Content-type: text/html Man page of mlib_ImageReformat

mlib_ImageReformat

Section: mediaLib Library Functions (3MLIB)
Updated: 2 Mar 2007
Index Return to Main Contents
 

NAME

mlib_ImageReformat - image data buffer reformat  

SYNOPSIS

cc [ flag... ] file... -lmlib [ library... ]
#include <mlib.h>

mlib_status mlib_ImageReformat(void **dstData, const void **srcData,
    mlib_s32 numBands, mlib_s32 xSize, mlib_s32 ySize,
    mlib_type dstDataType, const mlib_s32 *dstBandoffsets,
    mlib_s32 dstScanlinestride, mlib_s32 dstPixelstride,
    mlib_type srcDataType, const mlib_s32 *srcBandoffsets,
    mlib_s32 srcScanlinestride, mlib_s32 srcPixelstride);

 

DESCRIPTION

The mlib_ImageReformat() function copies and casts, if needed, an image from one buffer to another. The formats and data types of the two buffers may be different.

dstPixel[x][y][i] = (dstDataType) srcPixel[x][y][i]

where the values of a pixel at position (x, y) and in channel i are:

srcPixel[x][y][i] = srcData[i][srcBandoffsets[i] +
                              srcScanlinestride*y +
                              srcPixelstride*x]

dstPixel[x][y][i] = dstData[i][dstBandoffsets[i] +
                              dstScanlinestride*y +
                              dstPixelstride*x]

It is the user's responsibility to make sure that the data buffers supplied are suitable for this operation. The srcData and dstData can have 1, 2, 3, or 4 channels, and they must have the same number of channels. The srcDataType and dstDataType can be MLIB_BYTE, MLIB_SHORT, MLIB_USHORT, MLIB_INT, MLIB_FLOAT, or MLIB_DOUBLE.

The conversions between different data types are implemented as described in the following table:

Source TypeDest. TypeAction

MLIB_SHORTMLIB_BYTE(mlib_u8)clamp(x, 0, 255)
MLIB_USHORT

MLIB_INT

MLIB_FLOAT

MLIB_DOUBLE

MLIB_BYTE

MLIB_USHORT

MLIB_INT

MLIB_FLOAT

MLIB_DOUBLE

MLIB_BYTE

MLIB_SHORT

MLIB_INT

MLIB_FLOAT

MLIB_DOUBLE

MLIB_BYTE

MLIB_SHORT

MLIB_USHORT

MLIB_FLOAT

MLIB_DOUBLE

MLIB_BYTE

MLIB_SHORT

MLIB_USHORT

MLIB_INT

MLIB_DOUBLE

MLIB_BYTE

MLIB_SHORT

MLIB_USHORT

MLIB_INT

MLIB_FLOAT

The actions are defined in C-style pseudo-code. All type casts follow the rules of standard C. clamp() can be defined as a macro: #define clamp(x, low, high) (((x) < (low)) ? (low) : (((x) > (high)) ? (high) : (x)))  

PARAMETERS

The function takes the following arguments:

dstData

The pointer to the destination image data buffer.

srcData

The pointer to the source image data buffer.

numBands

The number of channels of the image data buffers.

xSize

The width of the image.

ySize

The height of the image.

dstDataType

The data type of the dstData buffer.

dstBandoffsets

The initial pixel's offsets in the dstData buffer in terms of destination data buffer elements.

dstScanlinestride

The scanline stride of the dstData buffer in terms of destination data buffer elements.

dstPixelstride

The pixel stride of the dstData buffer in terms of destination data buffer elements.

srcDataType

The data type of the srcData buffer.

srcBandoffsets

The initial pixel's offsets in the srcData buffer in terms of source data buffer elements.

srcScanlinestride

The scanline stride of the srcData buffer in terms of source data buffer elements.

srcPixelstride

The pixel stride of the srcData buffer in terms of source data buffer elements.

 

RETURN VALUES

The function returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE.  

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE

Interface StabilityCommitted

MT-Level

 

SEE ALSO

mlib_ImageDataTypeConvert(3MLIB), attributes(5)


 

Index

NAME
SYNOPSIS
DESCRIPTION
PARAMETERS
RETURN VALUES
ATTRIBUTES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 02:37:56 GMT, October 02, 2010