Updated on 2022-03-13 GMT+08:00

SetCscParams (Setting the Default Parameter Value)

Syntax

AIStatus SetCscParams(AippInputFormat srcFormat,

AippModelFormat dstFormat,

ImageFormat imageFormat = BT_601NARROW);

Function Description

You can call this API to implement the CSC function. The default values of CSC parameters in AIPP are automatically generated based on the original input type, target input type, and image type specified in the input parameters. In addition, the RB/UV channel switching function is enabled or disabled based on the original input type and target input type.

Parameter Description

Parameter

Input/Output

Type

Description

srcFormat

Input

AippInputFormat

Original input type of a model.

enum AippInputFormat

{

YUV420SP_U8 = 1,

XRGB8888_U8,

RGB888_U8,

YUV400_U8,

RESERVED

};

dstFormat

Input

AippModelFormat

Target input type after CSC in AIPP.

enum AippModelFormat

{

MODEL_RGB888_U8 = 1,

MODEL_BGR888_U8,

MODEL_GRAY,

MODEL_YUV444SP_U8,

MODEL_YVU444SP_U8

};

imageFormat

Input

ImageFormat

Image type. Currently, only JPEG and BT_601NARROW are supported.

enum ImageFormat

{

BITMAP,

PNG,

JPEG,

BT_601NARROW

};

Return Value

Parameter

Type

Description

-

AIStatus

If the parameter is set successfully, 0 is returned. If the input is invalid, other values are returned.

The AIStatus type is defined as follows:

AIStatus = uint32_t

Exception Handling

None

Restriction

This API is used to quickly set CSC parameters. The system provides a group of default CSC parameters. For details, see "AIPP Configuration" in Model Conversion Guide.

The supported input formats of images before and after CSC in AIPP are as follows:

AippInputFormat::YUV420SP_U8 to AippModelFormat::MODEL_YVU444SP_U8

AippInputFormat::YUV420SP_U8 to AippModelFormat::MODEL_RGB888_U8

AippInputFormat::YUV420SP_U8 to AippModelFormat::MODEL_BGR888_U8

AippInputFormat::YUV420SP_U8 to AippModelFormat::MODEL_GRAY

AippInputFormat::XRGB8888_U8 to AippModelFormat::MODEL_YUV444SP_U8

AippInputFormat::XRGB8888_U8 to AippModelFormat::MODEL_YVU444SP_U8

AippInputFormat::XRGB8888_U8 to AippModelFormat::MODEL_GRAY

AippInputFormat::RGB888_U8 to AippModelFormat::MODEL_BGR888_U8

AippInputFormat::RGB888_U8 to AippModelFormat::MODEL_YUV444SP_U8

AippInputFormat::RGB888_U8 to AippModelFormat::MODEL_YVU444SP_U8

AippInputFormat::RGB888_U8 to AippModelFormat::MODEL_GRAY

If the supported image types or image processing formats do not meet the requirements, call another API in SetCscParams (Setting the Default Parameter Value) to set CSC parameters.