venc_set_ref_param

Applicability

Product

Supported

Atlas 350 Accelerator Card

x

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas training product

x

Atlas inference product

Atlas 200I/500 A2 inference product

Description

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)
    

Parameters

Parameter

Description

chn

Int, encoding channel ID.
  • For the Atlas inference product, the value range of the encoding channel ID is [0, 256). The JPEGE and VENC functions share channels. The maximum number of channels is 256.
  • For the Atlas 200I/500 A2 inference product, the value range of the encoding channel ID is [0, 128). The JPEGE and VENC functions share channels. 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

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 Gop Mode is set to HI_VENC_GOP_MODE_DUAL_P, sp_interval can only be set to sp_interval =(enhance + 1) * base. If sp_interval is not set to 0, pred_en can only 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