hi_venc_intra_refresh

Description

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

Prototype

typedef struct {
    hi_bool                    refresh_enable;
    hi_venc_intra_refresh_mode intra_refresh_mode;
    hi_u32                     refresh_num;
    hi_u32                     req_i_qp;
} hi_venc_intra_refresh;

Members

Member

Description

refresh_enable

Whether to enable the Islice refresh function.

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

intra_refresh_mode

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

QP value of the I-frame.

When hi_mpi_venc_set_intra_refresh and hi_mpi_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

-

Calculation Formula

Remarks

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 ((pic_height + lcu_size - 1)/lcu_size) >> 2.