8.2. Design Overview

8.2.1. Bitstream Delievry Method

The bitstream delievry method provided by VDEC is as follows:

  • Send by frame (VIDEO_MODE_FRAME): Every time a complete frame code stream is sent to the decoder, every time the sending interface is called, the decoder will consider the frame code stream has ended and start decoding the image.

    It is necessary to ensure that the code stream sent by the sending interface must be one frame each time.

8.2.2. Image Output Format

According to the H.264 video standard, before the input Stream is decoded, the sequence of output images is not necessarily equal to that of input. Therefore, there are two kinds of playback: Decoding order and Display order.

  • Decoding Order: the output order of images is the same as the input order of the stream

    • The decoded Frame can be obtained quickly, but the user needs to ensure the playback order.

      For example, if there is a B frame in the general Stream, the display order transformation is required, and the user needs to do related processing.

  • Display Order:the output order of images is the same as the playback order

    • The Frame the user obtains is already a Display order and can be played directly in that order.

The current Output order is set as Display order.

8.2.3. Timestamp (PTS) Processing

PTS refers to the time point when the current Frame is playing.

The PTS of the current Frame can be obtained from CVI_VENC_GetFrame, and the PTS of the frame will be equal to the PTS attached to CVI_VENC_SendStream.

8.2.4. Decoding Frame Buffer Allocation Mode

  • Common Mode:ION memory is automatically created for frame storage.

    ION size is automatically allocated according to the Width and Height after decoding. Users do not need to manage this memory

  • User Mode: Users need to use CVI_VB_CreatePool to create a VB Pool.

    After creating a channel, they can bind the VB Pool to the channel through CVI_VDEC_AttachVbPool

  • Private Mode: When creating a channel, a Private VB Pool will be created automatically.

    Users do not need to create their own VB pool.

    They can set u32FrameBufSize and u32FrameBufCnt of Private VB Pool through CVI_VDEC_CreateChn.

CVI_VDEC_SetModParam can be used to set enVdecVBSource to select decoding frame buffer allocation mode.

Currently only COMMON Mode and USER Mode are supported.

When using USER Mode, the VB pool cannot be destroyed directly before the channel is detached to VB pool.

You need to make sure that the decoder ends correctly before you can destroy it.