Converts the image contents to the desired format, with optional pixel value scaling and offset. More...
Data Structures | |
struct | VPIConvertImageFormatParams |
Parameters for customizing image format conversion. More... | |
Enumerations | |
enum | VPIConversionPolicy |
Policy used when converting between image types. More... | |
Functions | |
VPIStatus | vpiInitConvertImageFormatParams (VPIConvertImageFormatParams *params) |
Initialize VPIConvertImageFormatParams with default values. More... | |
VPIStatus | vpiSubmitConvertImageFormat (VPIStream stream, uint32_t backend, VPIImage input, VPIImage output, const VPIConvertImageFormatParams *params) |
Converts the image contents to the desired format, with optional scaling and offset. More... | |
Converts the image contents to the desired format, with optional pixel value scaling and offset.
struct VPIConvertImageFormatParams |
Parameters for customizing image format conversion.
These parameters are used to customize how the conversion will be made. Make sure to call vpiInitConvertImageFormatParams to initialize this structure before updating its attributes. This guarantees that new attributes added in future versions will have a suitable default value assigned.
Definition at line 84 of file ConvertImageFormat.h.
Data Fields | ||
---|---|---|
VPIInterpolationType | chromaDownFilter |
Interpolation to use for chroma downsampling.
|
VPIInterpolationType | chromaUpFilter |
Interpolation to use for chroma upsampling.
|
uint32_t | flags | |
float | offset |
Offset factor. Pass 0 for no offset. Control flags. Valid values:
|
VPIConversionPolicy | policy | Conversion policy to be used. |
float | scale |
Scaling factor. Pass 1 for no scaling. |
enum VPIConversionPolicy |
#include <vpi/Types.h>
Policy used when converting between image types.
VPIStatus vpiInitConvertImageFormatParams | ( | VPIConvertImageFormatParams * | params | ) |
#include <vpi/algo/ConvertImageFormat.h>
Initialize VPIConvertImageFormatParams with default values.
The following parameters are set:
[out] | params | Pointer to structure to be filled. Must not be NULL. |
VPIStatus vpiSubmitConvertImageFormat | ( | VPIStream | stream, |
uint32_t | backend, | ||
VPIImage | input, | ||
VPIImage | output, | ||
const VPIConvertImageFormatParams * | params | ||
) |
#include <vpi/algo/ConvertImageFormat.h>
Converts the image contents to the desired format, with optional scaling and offset.
The input and output types are inferred from the corresponding images passed as parameters. When scaling and offset are fractional, input is converted to 32-bit floating point prior conversion takes place. The formula that relates input and output pixels is:
\[ out(x,y) = clamp_{[\mathsf{min_{out}},\mathsf{max_{out}}]}(in(x,y)*\alpha + \beta) \]
where:
float to integer conversion does returns the nearest integer number, rounding halfway cases away from zero.
When passing NULL as params argument, it'll use default values as the ones set by vpiInitConvertImageFormatParams.
[in] | stream | A stream handle where the operation will be queued into. |
[in] | backend | Backend that will execute the algorithm. |
[in] | input | Input image to be converted. |
[out] | output | Output image where result will be written to, with the desired type. |
[in] | params | Optional parameters. Pass NULL for default. |