hi_mpi_venc_set_cu_pred

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

Adjusts the tendency of selecting the coding unit (CU) or macroblock (MB) mode of a channel and supports the tendency adjustment of the inter/intra-frame prediction and encoding block size.

In the encoding protocol, pixel blocks are used as basic processing units, such as the CUs in H.265 and MBs in H.264. The CU mode in this API refers to the selection of pixel blocks of different sizes in inter/intra-frame prediction mode.

Prototype

hi_s32 hi_mpi_venc_set_cu_pred (hi_venc_chn chn, const hi_venc_cu_prediction *cu_pred)

Parameters

Parameter

Input/Output

Description

chn

Input

Encoding channel ID.

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.

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.

cu_pred

Input

Tendency to use the CU mode.

This structure contains the following parameters:
  • pred_mode: Sets the tendency configuration mode. The auto and manual modes are supported. In auto mode, the driver internally performs the tendency configuration. In manual mode, you can define the tendency configuration as needed.
  • intra32_cost, intra16_cost, intra8_cost, intra4_cost, inter64_cost, inter32_cost, inter16_cost, or inter8_cost: Sets each of their tendency values based on each mode. The default value of each parameter is 8, that is, no tendency is configured. The larger the value, the weaker the tendency to use the mode.

Returns

Restrictions

  • Only H.264/H.265 encoding channels support this API.
  • It is recommended that this API be called after an encoding channel is created and before encoding is started. This can reduce the number of API calls during encoding. If this API is called during encoding, the configuration takes effect when the next frame is encoded.
  • Before calling this API, you are advised to call hi_mpi_venc_get_cu_pred to obtain the tendency configuration of the CU mode.
  • Note that specific modes are disabled in some scenarios. For example, when the maximum MB size is 16 x 16 in H.264, inter16_cost is disabled in the baseline and main profile, or inter8_cost is disabled in the high profile, they do not take effect, even if you have set the tendency parameter.