hi_vdec_pic_info

Description

Defines the dictionary of a source video frame.

Prototype

hi_vdec_pic_info = {"width": width,
                    "height": height,
                    "width_stride": width_stride,
                    "height_stride": height_stride,
                    "pixel_format": hi_pixel_format,
                    "vir_addr": vir_addr,
                    "buffer_size": buffer_size,
                    "offset_top": offset_top,
                    "offset_bottom": offset_bottom,
                    "offset_left": offset_left,
                    "offset_right": offset_right}

Members

Member

Description

width

Int, image width. This parameter is used during video decoding.

height

Int, image height. This parameter is used during video decoding.

width_stride

Int, image width stride. If the video decoder outputs YUV420 Semi-Planar or YVU420 Semi-Planar format images, round the image width up to the nearest multiple of 16. If the video decoder outputs RGB888 or BGR888 format images, round the image width up to the nearest multiple of 16 and then multiply the result by 3.

Value range: [32, 16384].

height_stride

Int, image height stride. If the video decoder outputs YUV420 Semi-Planar or YVU420 Semi-Planar format images, round the image height up to the nearest multiple of 2. If the video decoder outputs RGB888 or BGR888 format images, retain the image height.

Value range: [6, 16384].

pixel_format

Int, image pixel format. This parameter is used for image or video decoding. For the supported VDEC output formats, see VDEC Functions and Restrictions. For the supported JPEGD output formats, see JPEGD Functions and Restrictions.

vir_addr

Int, start address of the decoding output data in the memory.

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, the user needs to free the memory in time.

buffer_size

Int, buffer size of a decoded image.

offset_top

Int, top offset of the decoded region to the original image. This parameter is required when JPEG images are decoded based on the specified region, as shown in Figure 1. If JPEG images do not need to be decoded based on the specified region, initialize this parameter to 0.

offset_bottom

Int, bottom offset of the decoded region to the original image. This parameter is required when JPEG images are decoded based on the specified region, as shown in Figure 1. If JPEG images do not need to be decoded based on the specified region, initialize this parameter to 0.

offset_left

Int, left side offset of the decoded region to the original image. This parameter is required when JPEG images are decoded based on the specified region, as shown in Figure 1. If JPEG images do not need to be decoded based on the specified region, initialize this parameter to 0.

offset_right

Int, right side offset of the decoded region to the original image. This parameter is required when JPEG images are decoded based on the specified region, as shown in Figure 1. If JPEG images do not need to be decoded based on the specified region, initialize this parameter to 0.

Precautions

The 10-bit data becomes 8-bit data after VPC image processing.

References

The following figure shows the function of decoding a JPEG image by region.

The restrictions on regional decoding are as follows:

  • In JPEG image decoding by region, rotation and software decoding are not supported.
  • The size of the region to be decoded cannot exceed that of the original image. The minimum size is 32 x 32, and the maximum size is 16384 x 16384.
  • When the following image formats are used, restrictions on the offset values are as follows:
    • HI_PIXEL_FORMAT_YUV_SEMIPLANAR_420 or HI_PIXEL_FORMAT_YVU_SEMIPLANAR_420 format: The values of offset_top and offset_left must be even numbers, and the values of (height - offset_bottom) and (width - offset_right) also must be even numbers.
    • HI_PIXEL_FORMAT_YUV_SEMIPLANAR_422 or HI_PIXEL_FORMAT_YVU_SEMIPLANAR_422 format: The value of offset_left must be an even number, and the value of (width - offset_right) also must be an even number.
    • HI_PIXEL_FORMAT_YUV_SEMIPLANAR_440 or HI_PIXEL_FORMAT_YVU_SEMIPLANAR_440 format: The value of offset_top must be an even number, and the value of (height - offset_bottom) also must be an even number.
Figure 1 Regional decoding