aclmdlSetAIPPCscParams

Applicability

Product

Supported

Atlas 350 Accelerator Card

×

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Function Usage

Sets CSC parameters in the dynamic AIPP scenario. If the CSC switch is turned off, the following parameters set by using this API call are invalid.

YUV-to-BGR conversion:
| B |   | cscMatrixR0C0 cscMatrixR0C1 cscMatrixR0C2 | | Y - cscInputBiasR0 |
| G | = | cscMatrixR1C0 cscMatrixR1C1 cscMatrixR1C2 | | U - cscInputBiasR1 | >> 8
| R |   | cscMatrixR2C0 cscMatrixR2C1 cscMatrixR2C2 | | V - cscInputBiasR2 |
BGR-to-YUV conversion:
| Y |   | cscMatrixR0C0 cscMatrixR0C1 cscMatrixR0C2 | | B |        | cscOutputBiasR0 |
| U | = | cscMatrixR1C0 cscMatrixR1C1 cscMatrixR1C2 | | G | >> 8 + | cscOutputBiasR1 |
| V |   | cscMatrixR2C0 cscMatrixR2C1 cscMatrixR2C2 | | R |        | cscOutputBiasR2 |

CSC parameters are closely related to the source and destination image formats. You can refer to "Advanced Features > AIPP > CSC Configuration" in the ATC for CSC parameter configuration. Configure CSC parameters as required if the listed image formats do not meet your requirements.

Prototype

1
2
3
4
5
6
aclError aclmdlSetAIPPCscParams(aclmdlAIPP *aippParmsSet, int8_t cscSwitch,
int16_t cscMatrixR0C0, int16_t cscMatrixR0C1, int16_t cscMatrixR0C2,
int16_t cscMatrixR1C0, int16_t cscMatrixR1C1,int16_t cscMatrixR1C2,
int16_t cscMatrixR2C0, int16_t cscMatrixR2C1, int16_t cscMatrixR2C2,
uint8_t cscOutputBiasR0, uint8_t cscOutputBiasR1, uint8_t cscOutputBiasR2,
uint8_t cscInputBiasR0, uint8_t cscInputBiasR1, uint8_t cscInputBiasR2)

Parameters

Parameter

Input/Output

Description

aippParmsSet

Output

Pointer to the dynamic AIPP parameter object

Call aclmdlCreateAIPP in advance to create data of the aclmdlAIPP type.

cscSwitch

Input

CSC switch

  • 0: CSC disabled. If it is set to 0, the following parameters are invalid.
  • 1: CSC enabled.

cscMatrixR0C0

Input

CSC matrix parameter

Value range: [–32677, 32676]

cscMatrixR0C1

Input

CSC matrix parameter

Value range: [–32677, 32676]

cscMatrixR0C2

Input

CSC matrix parameter

Value range: [–32677, 32676]

cscMatrixR1C0

Input

CSC matrix parameter

Value range: [–32677, 32676]

cscMatrixR1C1

Input

CSC matrix parameter

Value range: [–32677, 32676]

cscMatrixR1C2

Input

CSC matrix parameter

Value range: [–32677, 32676]

cscMatrixR2C0

Input

CSC matrix parameter

Value range: [–32677, 32676]

cscMatrixR2C1

Input

CSC matrix parameter

Value range: [–32677, 32676]

cscMatrixR2C2

Input

CSC matrix parameter

Value range: [–32677, 32676]

cscOutputBiasR0

Input

Output bias for RGB2YUV conversion

Value range: [0, 255]

cscOutputBiasR1

Input

Output bias for RGB2YUV conversion

Value range: [0, 255]

cscOutputBiasR2

Input

Output bias for RGB2YUV conversion

Value range: [0, 255]

cscInputBiasR0

Input

Input bias for YUV2RGB conversion

Value range: [0, 255]

cscInputBiasR1

Input

Input bias for YUV2RGB conversion

Value range: [0, 255]

cscInputBiasR2

Input

Input bias for YUV2RGB conversion

Value range: [0, 255]

Returns

0 on success; else, failure. For details, see aclError.

Restrictions

If the original image format is set to YUV400 by the aclmdlSetAIPPInputFormat call, it is not supported to set the CSC attributes by this API.