hi_venc_attr

Description

Defines the VENC attributes.

Prototype

typedef struct {
    hi_payload_type type;
    hi_u32 max_pic_width;
    hi_u32 max_pic_height;
    hi_u32 buf_size;
    hi_u32 profile;
    hi_bool is_by_frame;
    hi_u32 pic_width;
    hi_u32 pic_height;
    union {
        hi_venc_h264_attr h264_attr; 
        hi_venc_h265_attr h265_attr; 
        hi_venc_jpeg_attr jpeg_attr; 
        hi_venc_prores_attr prores_attr; 
    };
}hi_venc_attr;

Members

Member

Description

type

Encode protocol.

max_pic_width

Maximum width of the source image. Must be an integral multiple of 2. This is a static attribute.

Value range: [MIN_WIDTH, MAX_WIDTH], in pixels.

max_pic_height

Maximum height of the source image. Must be an integral multiple of 2. This is a static attribute and does not apply to JPEG encoding.

Value range: [MIN_HEIGHT, MAX_HEIGHT], in pixels.

buf_size

Size of the stream buffer, in bytes. This is a static attribute.

  • When hi_mpi_venc_send_jpege_frame is called to send source images for encoding, buf_size must be set to 0 during channel creation.
  • When hi_mpi_venc_send_frame is called to send source images for video or image encoding, buf_size must be set to an integral multiple of 64 within the range [Min, Max] during channel creation. The unit is byte. Min indicates 32 x 1024, and Max indicates the maximum value representable by the data type.
    hi_mpi_venc_set_mod_param can be called to set the mini_buf_mode parameter.
    • For H.264/H.265:
      • mini_buf_mode = 0:

        Min = 1/2 of the size of the largest image to be decoded

        Max = 1 x 1024 x 1024 x 1024

      • mini_buf_mode = 1. Users need to ensure appropriate sizes of buffer allocations.

        Min = 32 x 1024

        Max = 1 x 1024 x 1024 x 1024

    • For JPEG:
      • mini_buf_mode = 0:

        Min (YUV420) = Source width 16-aligned x Source height 16-aligned x 3/2. Min (YUV422 Packed) = Source width 16-aligned x Source height 16-aligned x 2.

        Max = 1 x 1024 x 1024 x 1024

      • mini_buf_mode = 1. Users need to ensure appropriate sizes of buffer allocations.

        Min = 32 x 1024

        Max = 1 x 1024 x 1024 x 1024

    NOTE:

    When implementing the JPEGE function, you can set the JPEGE buffer allocation for each channel based on the largest-resolution image to be encoded to save the memory overhead. The formula is as follows: Source width x Source height x Multiple (5 is recommended).

    For example, if the resolutions of user images are 720p (1280 x 720), 1080p (1080 x 1920), and 4K (3840 x 2160), the required JPEGE buffer allocation is calculated based on 4K, that is, 3840 x 2160 x 5.

    The minimum and recommended JPEGE buffer allocation is 320 x 240 x 5. This prevents the buffer from being completely occupied, which affects the JPEGE functionality when low-resolution (128 x 128 or less, for example) user images are input.

profile

Encoding profile. A larger value indicates better encoding quality. This is a static attribute.

  • H.264:
    • 0: baseline.
    • 1: main profile.
    • 2: high profile.
  • H.265:
    • 0: main profile.
    • 1 (reserved): main 10 profile.
  • Value range for JPEG:
    • 0: baseline.

is_by_frame

Stream fetching mode select. This is a static attribute.

  • HI_TRUE: frame mode.
  • HI_FALSE: packet mode.

pic_width

Width of the source image. Must be an integral multiple of MIN_ALIGN.

Value range: [MIN_WIDTH, MAX_WIDTH], in pixels.

pic_height

Height of the source image. Must be an integral multiple of MIN_ALIGN. Not applicable to JPEG encoding.

Value range: [MIN_HEIGHT, MAX_HEIGHT], in pixels.

h264_attr/h265_attr/jpeg_attr/prores_attr

Attributes of the encode protocol.

Reserved.