VideoDecodeConfig

Description

Stores video decoding parameters.

Structure Definition

1
2
3
4
5
6
7
8
9
struct VideoDecodeConfig {
    uint32_t width = 1920;
    uint32_t height = 1080;
    StreamFormat inputVideoFormat = StreamFormat::H264_MAIN_LEVEL;
    ImageFormat outputImageFormat = ImageFormat::YUV_SP_420;
    VideoDecodeCallBack callbackFunc = nullptr;
    uint32_t skipInterval = 0;
    uint32_t cscMatrix = 0;
};

Parameters

Parameter

Description

width

Width of the video decoding buffer. The value range is [128, 4096]. The default value is 1920. The value must be an even number of a multiple of 16.

Set this parameter based on the actual video frame data. The value must be greater than or equal to the actual width of video frame data. Otherwise, no decoding output will be generated. If the value is too large, redundant memory resource overheads are generated.

height

Height of the video decoding buffer. The value range is [128, 4096]. The default value is 1080. The value must be an even number.

Set this parameter based on the actual video frame data. The value must be greater than or equal to the actual height of video frame data. Otherwise, no decoding output will be generated. If the value is too large, redundant memory resource overheads are generated.

inputVideoFormat

Input video format.

  • H.264 videos can be in h264_baseline_level, h264_main_level, or h264_high_level format.
  • H.265 videos support only the h265_main_level format. The default value is StreamFormat::H264_MAIN_LEVEL.

outputImageFormat

Output image format after decoding. The default value is ImageFormat::YUV_SP_420.

  • For the Atlas 200/300/500 inference product, YUV_SP_420 and YVU_SP_420 are supported.
  • For the Atlas 200I/500 A2 inference product, YUV_SP_420, YVU_SP_420, RGB_888, and BGR_888 are supported.
  • For the Atlas inference product, YUV_SP_420, YVU_SP_420, RGB_888, and BGR_888 are supported.
  • For the Atlas 800I A2 inference product, YUV_SP_420, YVU_SP_420, RGB_888, and BGR_888 are supported.

callbackFunc

Callback function after decoding. It cannot be a null pointer.

skipInterval

Skipped frames during video decoding. The value range is [0, 250]. The default value is 0.

cscMatrix

CSC option. The default value is 0, that is, HI_CSC_MATRIX_BT601_WIDE. It is supported only by Atlas inference products.

  • HI_CSC_MATRIX_BT601_WIDE = 0: CSC matrix based on the BT.601 Wide standard. The parameter values are as follows:
    1
    2
    3
    4
    5
    6
    7
    8
    # YUV-to-RGB conversion:
    # | R |   | 1.000  0.000   1.402 |   | Y - 0 |
    # | G | = | 1.000 -0.344  -0.714 | * | U - 128 | 
    # | B |   | 1.000  1.772   0.000 |   | V - 128 |
    # RGB-to-YUV conversion:
    # | Y |   |-0.5  |   |  0.299  0.587  0.114  |   | R |        
    # | U | = |127.5 | + | -0.168 -0.331  0.500  | * | G | 
    # | V |   |127.5 |   |  0.500 -0.419  -0.081 |   | B | 
    
  • HI_CSC_MATRIX_BT601_NARROW = 1: CSC matrix based on the BT.601 Narrow standard. The parameter values are as follows:
    1
    2
    3
    4
    5
    6
    7
    8
    # YUV-to-RGB conversion:
    # | R |   | 1.16438  0.00000   1.59602 |   | Y - 16 |
    # | G | = | 1.16438 -0.39176  -0.81297 | * | U - 128 | 
    # | B |   | 1.16438  2.01723   0.00000 |   | V - 128 |
    # RGB-to-YUV conversion:
    # | Y |   |16 |   |  0.25679  0.51564  0.10014 |   | R |        
    # | U | = |128| + | -0.14491 -0.29099  0.43922 | * | G | 
    # | V |   |128|   |  0.42941 -0.36779 -0.07143 |   | B | 
    
  • HI_CSC_MATRIX_BT709_WIDE = 2: CSC matrix based on the BT.709 Wide standard. The parameter values are as follows:
    1
    2
    3
    4
    5
    6
    7
    8
    # YUV-to-RGB conversion:
    # | R |   | 1.00000  0.00000   1.57480 |   | Y - 0 |
    # | G | = | 1.00000 -0.18732  -0.46812 | * | U - 128 | 
    # | B |   | 1.00000  1.85560   0.00000 |   | V - 128 |
    # RGB-to-YUV conversion:
    # | Y |   |0  |   |  0.21260  0.71520  0.07220 |   | R |        
    # | U | = |128| + | -0.11457 -0.38543  0.50000 | * | G | 
    # | V |   |128|   |  0.50000 -0.45415 -0.04585 |   | B | 
    
  • HI_CSC_MATRIX_BT709_NARROW = 3: CSC matrix based on the BT.709 Narrow standard. The parameter values are as follows:
    1
    2
    3
    4
    5
    6
    7
    8
    # YUV-to-RGB conversion:
    # | R |   | 1.16438  0.00000   1.79274 |   | Y - 16 |
    # | G | = | 1.16438 -0.21325  -0.53291 | * | U - 128 | 
    # | B |   | 1.16438  2.11240   0.00000 |   | V - 128 |
    # RGB-to-YUV conversion:
    # | Y |   |16 |   |  0.18259  0.62825  0.06342 |   | R |        
    # | U | = |128| + | -0.09840 -0.33857  0.43922 | * | G | 
    # | V |   |128|   |  0.42941 -0.39894 -0.04027 |   | B | 
    
  • HI_CSC_MATRIX_BT2020_WIDE = 4: CSC matrix based on the BT.2020 Wide standard. The parameter values are as follows:
    1
    2
    3
    4
    5
    6
    7
    8
    # YUV-to-RGB conversion:
    # | R |   | 1.00000  0.00000   1.47460 |   | Y - 0 |
    # | G | = | 1.00000 -0.16455  -0.57135 | * | U - 128 | 
    # | B |   | 1.00000  1.88140   0.00000 |   | V - 128 |
    # RGB-to-YUV conversion:
    # | Y |   |0  |   |  0.26270  0.67800  0.05930 |   | R |        
    # | U | = |128| + | -0.13963 -0.36037  0.50000 | * | G | 
    # | V |   |128|   |  0.50000 -0.45979 -0.04021 |   | B | 
    
  • HI_CSC_MATRIX_BT2020_NARROW = 5: CSC matrix based on the BT.2020 Narrow standard. The parameter values are as follows:
    1
    2
    3
    4
    5
    6
    7
    8
    # YUV-to-RGB conversion:
    # | R |   | 1.16438  0.00000   1.67868 |   | Y - 16 |
    # | G | = | 1.16438 -0.18733  -0.65042 | * | U - 128 | 
    # | B |   | 1.16438  2.14177   0.00000 |   | V - 128 |
    # RGB-to-YUV conversion:
    # | Y |   |16 |   |  0.22564  0.59558  0.05209 |   | R |        
    # | U | = |128| + | -0.11992 -0.31656  0.43922 | * | G | 
    # | V |   |128|   |  0.42941 -0.40389 -0.03533 |   | B |