venc_set_ref_param

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

x

Atlas A2 training products/Atlas A2 inference products

x

Atlas training products

x

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Sets the advanced frame skipping reference parameters of an H.264/H.265 encoding channel to change the inter-frame reference relationship. For details about the advanced frame skipping mode, see Advanced Frame Skipping Modes.

Prototype

  • C Prototype
    1
    hi_s32 hi_mpi_venc_set_ref_param(hi_venc_chn chn, const hi_venc_ref_param *ref_param)
    
  • Python Function
    1
    ret = acl.himpi.venc_set_ref_param(chn, ref_param)
    

Parameter Description

Parameter

Description

chn

Int, encoding channel ID.
  • Atlas inference products: The value range of the encoding channel ID is [0, 256). The JPEGE and VENC functions share the same channels, and the maximum number of channels is 256.
  • Atlas 200I/500 A2 inference products: The value range of the encoding channel ID is [0, 128). The JPEGE and VENC functions share the same channels, and the maximum number of channels is 128.

ref_param

Dict, dictionary of advanced frame skipping reference parameters for an H.264/H.265 encoding channel. For details, see hi_venc_ref_param.

Return Value Description

Return Value

Description

ret

Int, error code.

Restrictions

  • When an H.264/H.265 encoding channel is created, the 1x frame skipping reference mode is used by default. To change the reference mode, you are advised to call this API after creating an encoding channel but before starting encoding. This reduces the number of the API calls during encoding.
  • If this API is called during encoding, the configuration takes effect only after the next I-frame is encoded.
  • To set the 1x frame skipping reference mode, set pred_en = HI_TRUE, enhance = 0, and base = 1. To set the 2x frame skipping reference mode, set pred_en = HI_TRUE, enhance = 1, and base = 1. To set the 4x frame skipping reference mode, set pred_en = HI_TRUE, enhance = 1, and base = 2.
  • If the GOP mode of the channel is set to HI_VENC_GOP_MODE_DUAL_P, the value of sp_interval must be set to (enhance + 1) x base. If sp_interval is not 0, pred_en must be set to HI_TRUE.
  • If the GOP mode of the channel is set to HI_VENC_GOP_MODE_SMART_P, the pred_en parameter must be set to HI_TRUE.
  • If the GOP mode of the channel is set to HI_VENC_GOP_MODE_BIPREDB, the value of enhance must be equal to that of b_frame_num.

Advanced Frame Skipping Modes

The advanced frame skipping reference modes involve three parameters: base, enhance, and pred_en. For details about their meanings, see hi_venc_ref_param. The following figures show the advanced frame skipping reference modes.

  • To configure the advanced frame skipping reference in dual_p mode when sp_interval is not 0, the following condition must be met: base x (enhance + 1) = sp_interval. Using the 4x advanced frame skipping reference (base = 2 and enhance = 1) as an example, sp_interval of the dual_p mode = 2 x (1 + 1) = 4.
  • Schematic diagram of advanced frame skipping reference in normal_p mode

  • Schematic diagram of advanced frame skipping reference in smart_p mode

  • Schematic diagram of advanced frame skipping reference in adv_smart_p mode

  • Schematic diagram of advanced frame skipping reference in dual_p (sp_interval! = 0) mode

  • Schematic diagram of advanced frame skipping reference in dual_p (sp_interval = 0) mode