hi_venc_intra_refresh

Description

Defines the parameters for controlling Islice refresh in P-frames.

Prototype

hi_venc_intra_refresh = {"refresh_enable": refresh_enable,
                         "intra_refresh_mode": hi_venc_intra_refresh_mode,
                         "refresh_num": refresh_num,
                         "req_i_qp": req_i_qp}

Members

Member

Description

refresh_enable

Int, whether to enable the Islice refresh function.

  • 0: disabled (default).
  • 1: enabled.

intra_refresh_mode

Int, I-macroblock refresh mode, by row or by column. By default, refresh by row is adopted.

refresh_num

Number of rows or columns refreshed for an I-macroblock each time. This variable controls the refresh speed and stream stability.

A larger value indicates faster refresh and lower stream stability. A smaller value indicates slower refresh and higher stream stability.

Ensure that the configured refresh_num can complete Islice refresh within a GOP. Note that in advanced frame skipping reference mode, Islice refresh is performed only in P-frames at the base layer (which can be referenced by other frames at the base layer). Table 1 lists the formulas for calculating the value of refresh_num.

req_i_qp

Int, QP value of the I-frame.

When acl.himpi.venc_set_intra_refresh and acl.himpi.venc_request_idr work together, this value is used to control the quality of the inserted IDR frame. A smaller value indicates better quality and a larger IDR frame size.

The value range is [0, 51] and the default value is 51.

References

Table 1 Formulas for calculating the value of refresh_num

Default Value

Calculation Formula

Description

For H.264, the default value of refresh_num is as follows:

(pic_height +lcu_size-1)>>6

  • Row: refresh_num x (max_refresh_frame_in_gop - 1) ≥ (pic_height + lcu_size - 1) // lcu_size
  • Column: refresh_num x (max_refresh_frame_in_gop - 1) ≥ (pic_width + lcu_size - 1) // lcu_size

In the formulas, "//" indicates rounding down.

  • max_refresh_frame_in_gop specifies the maximum number of P-frames for Islice refresh in a GOP, whose values are described as follows:
    • If advanced frame skipping reference is not used: max_refresh_frame_in_gop = gop
    • If advanced frame skipping reference is used: max_refresh_frame_in_gop = (gop + (base x (enhance+1) -1))/(base x (enhance+1))
  • The values of lcu_size (coding unit size) are described as follows:
    • For H.264, this parameter has a fixed value of 16.
    • For H.265:

For H.265, the default value of refresh_num is as follows:

((pic_height + lcu_size - 1) / lcu_size) >> 2