hi_video_frame

Description

Defines a source video frame.

Definition

typedef struct {
    hi_u32              width;
    hi_u32              height;
    hi_video_field      field;
    hi_pixel_format     pixel_format;
    hi_video_format     video_format;
    hi_compress_mode    compress_mode;
    hi_dynamic_range    dynamic_range;
    hi_color_gamut      color_gamut;

    hi_u32              header_stride[HI_MAX_COLOR_COMPONENT];
    hi_u32              width_stride[HI_MAX_COLOR_COMPONENT];
    hi_u32              height_stride[HI_MAX_COLOR_COMPONENT];

    hi_u64              header_phys_addr[HI_MAX_COLOR_COMPONENT];
    hi_u64              phys_addr[HI_MAX_COLOR_COMPONENT];
    hi_void*            header_virt_addr[HI_MAX_COLOR_COMPONENT];
    hi_void*            virt_addr[HI_MAX_COLOR_COMPONENT];

    hi_u32              time_ref;
    hi_u64              pts;

    hi_u64              user_data[HI_MAX_USER_DATA_NUM];
    hi_u32              frame_flag; 
    hi_video_supplement supplement;
} hi_video_frame;

Members

Member

Description

width

Image width.

height

Image height.

field

Field mode. Reserved.

pixel_format

Pixel format.

video_format

Video format.

compress_mode

Video compression mode.

dynamic_range

Dynamic range. Reserved.

color_gamut

Color gamut. Reserved.

header_stride

Compression header stride. Reserved.

width_stride

Width stride of an output image component. For a YUV image, this member indicates the stride of the Y, U, and V components. For an RGB image, this member indicates the stride of the R, G, and B components.

height_stride

Height stride of an output image component. For a YUV image, this member indicates the stride of the Y, U, and V components. For an RGB image, this member indicates the stride of the R, G, and B components.

This parameter is reserved for VI video capture, ISP system control, VPSS video processing, VENC video encoding, and JPEGE image encoding.

header_phys_addr

Physical address of the compression header. Reserved.

phys_addr

Physical address. Reserved.

header_virt_addr

Virtual address of the compression header. Reserved.

virt_addr

Start virtual address of an image in the device buffer.

For an input YUV image, virt_addr[0] is the start address of the image or Y component, virt_addr[1] is the start address of the U component, and virt_addr[2] is the start address of the V component.

For an output YUV or RGB image, virt_addr[0] is the start address of the image on the device, and virt_addr[1] and virt_addr[2] are reserved.

time_ref

Sequence number of an image frame.

This parameter is reserved in the decoding scenario.

This parameter is reserved in the JPEGE scenario.

In the VENC scenario, set this parameter to an even number in ascending order based on the frame sequence. For example, set this parameter to 2 for the first frame, 4 for the second frame, and so on.

pts

Image presentation timestamp (PTS).

user_data

Private data. Reserved.

frame_flag

  • In the VDEC decoding scenario, this parameter indicates whether a frame is successfully decoded. You need to free the input and output buffer in time regardless of whether the frame is successfully decoded. The system does not guarantee that the output order of frames that fail to be decoded is in the display sequence or decoding sequence. Value options of this parameter are as follows:
    • 0: The frame is decoded successfully.
    • 1: The frame fails to be decoded due to abnormal input stream or inconsistency between the configured stream format and the actual stream format.
    • 2: can be ignored. In the interlaced scenario where two fields are transmitted every frame, one of every two transmitted fields has no decoding output. This is a normal phenomenon. The decoding output of an interlaced stream is stored in the output buffers of the odd fields. In this case, you need to free the buffer in time.
    • 3: The frame fails to be decoded because the number of reference frames is incorrectly set.
    • 4: The frame fails to be decoded due to incorrect size of VDEC frame buffer.
  • In the JPEGD scenario, this parameter indicates whether the frame is successfully decoded. You need to free the input and output buffers in time no matter whether the frame is successfully decoded. Value options are as follows:
    • 0: The frame is decoded successfully.
    • 1: The frame fails to be decoded due to abnormal input stream or inconsistency between the configured stream format and the actual stream format.
    • 4: The frame fails to be decoded because the size of the JPEGD decoding output buffer is insufficient. You can obtain the size of the output buffer by calling hi_mpi_vdec_get_jpegd_output_info in advance.
    • 5: The JPEGD decoding configuration parameters are incorrectly set. For example, the configured width or height exceeds the limit or the configured target decoding format is not supported. This value is used only in the JPEGD decoding scenario.
  • In the VENC scenario, different bits are used to enable different functions:
    • Bit 0 of this parameter indicates whether to enable the slice_temporal_mvp_enabled_flag syntax (whether to use TMV prediction for inter-frame prediction). Value options are as follows, but this parameter takes effect only when the H.265 protocol is used:
      • 0: TMV prediction enabled, with slice_temporal_mvp_enabled_flag set to True.
      • 1: TMV prediction disabled, with slice_temporal_mvp_enabled_flag set to False.
    • Bit 1 of this parameter indicates whether to enable image edge expansion. Value options are as follows, and this parameter takes effect when the H.264 or H.265 protocol is used:
      • 0: image edge expansion enabled.
      • 1: image edge expansion disabled.
    • Bits 2 to 7 of this parameter indicate the value of chroma_qp_index_offset (offset of the chroma component quantization parameter value) in the stream. The values of bits 2 to 7 take effect only when the H.264 protocol is used. The requirements for setting bits 2 to 7 are as follows:
      • Bit 7 indicates whether the values of bits 2 to 6 are positive. If bit 7 is set to 1, the values are negative. If bit 7 is set to 0, the values are positive.
      • The value range of bits 2 to 7 is [–6, 18]. The system subtracts 6 from the configured value to get the final value. Therefore, the value range of chroma_qp_index_offset in the encoded stream is [–12, 12].
  • In the JPEGE scenario, the value is 0 or 1. However, this parameter is not supported in the current version, and the parameter value is invalid.

supplement

Supplementary information about an image.

On the Atlas A3 training products/Atlas A3 inference products, this parameter is a pass-through parameter.

On the Atlas A2 training products/Atlas A2 inference products, this parameter is a pass-through parameter.

This parameter is used by the VI module of the Atlas 200I/500 A2 inference products and is automatically initialized by the VI module. For other functions, this parameter is a pass-through parameter.

On the Atlas inference products, this parameter is a pass-through parameter.

Precautions

In general, 10-bit data is compactly stored in the memory in non-compression mode.

For 10-bit YUV data, the first 8 bits and last 2 bits are stored separately in segment-based compressed mode.

For 10-bit tile 64 x 16 data, which is video decoder hardware (VDH) output, the first 8 bits and last 2 bits are stored separately in the memory, regardless of whether the data is compressed or not.