2. GOP Structure and Applicable Scenarios

2.1. GOP Mode List

Mode

Description

NormalP

The P frame only refers to the previous reference frame

SmartP

The P frame only refers to the previous reference frame, and the VI frame refers to the previous IDR frame

2.2. Description and Usage of NormalP mode GOP structure

2.2.1. Description of NormalP mode GOP structure

• NormalP is the most common GOP structure, which only has forward reference to the previous frame, and is also known as IPPP coding.
• In case of no special requirements, it is recommended to use NormalP mode.
The GOP structure of NormalP mode is shown in the following figure.
_images/normal01.png
_images/normal02.png

2.2.2. Usage of NormalP mode GOP structure

  • Related interface

CVI_MPI_VENC_CreateChn

  • Related parameters

VENC_CHN_ATTR_S::stGopAttr.enGopMode = VENC_GOPMODE_NORMALP
VENC_CHN_ATTR_S::stRcAttr.u32Gop = 60;
VENC_CHN_ATTR_S::stGopAttr.stNormalP.s32IPQpDelta is recommended to set to 3.
The larger the value, the higher the bitrate of the I-frame and the better the image quality.

2.3. Description and Usage of SmartP mode GOP structure

2.3.1. Description of SmartP mode GOP structure

• The SmartP mode includes two types of P-frames: normal P-frames and virtual-I frames. The virtual-I frames use a long-term reference frame to refer to the previous IDR frame
• SmartP is mainly used in monitoring scenarios. Due to the fixed camera installation, the scene is mostly static background, and only people and objects move. Use virtual-I instead of I-frame to lengthen the IDR frame encoding period, thereby reducing the bit rate and reducing the breath-effect.
• Limited coding efficiency improvement for camera moving scenes due to no fixed background
The SmartP mode GOP structures are shown in the following figures.
_images/smart01.png
_images/smart02.png

2.3.2. Usage of SmartP mode GOP structure

  • Related interface

CVI_VENC_CreateChn

  • Related parameters

VENC_CHN_ATTR_S::stGopAttr.enGopMode = VENC_GOPMODE_SMARTP
VENC_CHN_ATTR_S::stGopAttr.stSmartP.u32BgInterval = 300;  //  10secs for fps=30
VENC_CHN_ATTR_S::stRcAttr.u32Gop = 60; // virtual I interval, 2 secs for fps=30
VENC_CHN_ATTR_S::stRcAttr.u32StatTime = 10 // secs
VENC_CHN_ATTR_S:: stGopAttr.stSmartP.s32BgQpDelta = 4

2.4. Memory usage, latency, application scenarios and compatibility of GOP Structure

Mode

DDR usage

Latency

Applicable Scenarios

H.264 / H.265 Enc

H.264 / H.265 Enc

NormalP

2*PicSize

N/A

General Scenarios

SmartP

2*PicSize

N/A

Monitoring Scenarios

Caculation of PicSize
  • The calculation method for the size of each variable block (VB) in the encoded frame memory (reference frame and reconstructed frame) is as follows:

    • H.264

      • PicSize= FrameBufSize

    • H.265

      • PicSize= FrameBufSize + mvColSize + fbcYTblSize + fbcCTblSize + subSampledSize

    • Please refer to the chapter “video coding” in the document 《cv180x media software development reference》for the calculation of each sub item of frame memory size

Compatibility
The compatibility of Cvitek backend products is shown in the following table

CV180x

H.264

H.265

NormalP

Yes

Yes

SmartP

Yes

Yes