This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Vdec_requestBitstreamBuffer max. BufSize

We use DM8168 at UDWORKS based hardware design and a DVRRDK 03.00.00.00 basewd software.

We do decoding of IP-camera RTSP stream. Some IP-camera types sometimes create frame information of very huge frame size. We use FFMPEG for demultiplexing RTSP. The invalid frames are not catched from FFMPEG. This means we also request buffer (reqInfo.bufSize) for decoding of oversized frames. Vdec_requestBitstreamBuffer() does not check the size. I did try to find out how DECLINK handles the size parameter, but we want to limit the size as early as possible. (before Vdec_requestBitstreamBuffer is called).

The packet size depends on frame type, format, compression, ....

Is a max. reqInfo.bufSize useful ? Does DECLINK know a max. value ?

 

  • Do you require to know the maxSize of bitstream buffer ? in RDK 3.0 bitstream buffers were of fixed size.

    If you are using reqType = IPC_BITSOUTHLOS_BITBUFREQTYPE_CHID you should populate bufReq->u[i].chNum correctly based on which channel you want buffers from

    Else you should set the minBufSize required. Setting minBufSze to 0 will return any free available buffer

    The returned VCODEC_BITSBUF_S.bufSize has maxSize size of buffer. The btstream length should be less than this.

    If you find bitstream size greater than bufSize you can do Vdec_putBitstreamBuffer with filledSize of 0 so that buffer is freed and not used.

  •  

    Thanks for Your reply,

    some further enquiry for a better understanding :

    >> Do you require to know the maxSize of bitstream buffer ? in RDK 3.0 bitstream buffers were of fixed size.

    I have checked this in my DVRRDK3 based application, The VCODEC_BITSBUF_S.bufSize is 414720 = 720 x 576, It depends on decoder setup parameter, is this right ?  

    vdecParams.decChannelParams[i].maxVideoWidth  = DECODER_MAX_FRAME_WIDTH;  vdecParams.decChannelParams[i].maxVideoHeight = DECODER_MAX_FRAME_HEIGHT;

     

    >> If you are using reqType = IPC_BITSOUTHLOS_BITBUFREQTYPE_CHID you should populate bufReq->u[i].chNum correctly based on which channel you want buffers from Else you should set the minBufSize required. Setting minBufSze to 0 will return any free available buffer

    Currently I use DVR_RDK 3.0, and I prepared using of DVRRDK 4.x

    #ifdef DVRRDK_BASE_04_00_00_XX

        reqInfo.chNum   = chn;     reqInfo.bufSize = packet[chn].size;

    #endif

    #ifdef DVRRDK_BASE_03_00_00_XX

        reqInfo.numBufs         = 1;

        reqInfo.reqType         = VDEC_BUFREQTYPE_BUFSIZE;

        reqInfo.u[0].minBufSize = packet[chn].size;

    #endif

     

    >> The returned VCODEC_BITSBUF_S.bufSize has maxSize size of buffer. The btstream length should be less than this. If you find bitstream size greater than bufSize you can do Vdec_putBitstreamBuffer with filledSize of 0 so that buffer is freed and not used.

    At this point I want to skip the invalid packets. If size is > bufsize we do not want to request a buffer.

     

     

  • Holger Eberhard102906 said:
    I have checked this in my DVRRDK3 based application, The VCODEC_BITSBUF_S.bufSize is 414720 = 720 x 576, It depends on decoder setup parameter, is this right ?  

    Vdec_requestBitstreamBuffer API gets the free buffers from ipcBitsOutLink on A8. In RDK 3.0 there were two ways ipcBitsOutLink would allocate buffers depending on createtime configuration

    1. Pool of buffers per resolution. If ipcBitsOutLink was created with createArgs->bufPoolPerCh = FALSE

    2. Dedicated pool of buffers per channel . If ipcBitsOutLink was created with createArgs->bufPoolPerCh = FALSE

    The size of each buffer depends on the ipcBitsOutLink channel resolution based on formula you mentioned

    \dvr_rdk\mcfw\src_linux\links\ipcBitsOut\ipcBitsOutLink_tsk.c

    #define UTILS_ENCDEC_GET_BITBUF_SIZE(width,height)   ( (  (width) * (height)  )/UTILS_ENCDEC_BITBUF_SCALING_FACTOR )

    Refer your usecase file under /dvr_rdk/mcfw/src_linux/mcfw_api/usecases/ti816x to see the ipcBitsOutLink create configuration.

    If you are using existing /dvr_rdk/mcfw/src_linux/mcfw_api/usecases/ti816x/multich_progressive_vcap_venc_vdec_vdis.c

    ipcBitsOut is created for bufPoolPerCh = FALSE.

    Holger Eberhard102906 said:
    At this point I want to skip the invalid packets. If size is > bufsize we do not want to request a buffer.

    You could either request buffer and if you find size greater than max size you could just free the buffer with filledSize = 0.

    OR

    You could store the bufSize in your app and check size of encoded frame before requesting free bitstream Buffer. If you dynamically change decoder resolution by deleting and creating decoder channel you have to be careful as bufSize will change on decoder channel delete/create

    OR

    Use the formula used in ipcBitsOutLink to determine maxBufSize from resolution. As long as you don't change ipcBitsOutLink logic this is fine.

  • Thanks for the detailed explanation, it helps me to understand.
    Best regards