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.

TDA2P-ACD: Link with One input (System_VideoFrameBuffer) with 1 channel and 4 output buffers (System_VideoFrameBuffer).

Part Number: TDA2P-ACD

Hi All,

I'm working on TDA2P-ACD board and Vision sdk 3.5 version

I'm getting output from capture link as one single frame which contains data of 4 cameras which I can differentiate using header information.

I want to separate out 4 frames to 4 separate buffers i. e. I want my link to output 4 SystemVideoBuffers. I cannot use Composite buffer as my next link is VPE which doesn't support composite buffer as input .

Please suggest how can I configure link with 1 input with 1 channel and gives 4 outputs

Is there any existing link in visionsdk that I can refer ?

Regards,

Megha

  • Megha,

    Well, you could write a simple split link to split the buffers into multiple system video frames. In the output frame, you could just pointer pointing to offset in the input buffer for each channel..

    Rgds,

    Brijesh

  • Hi,

    I referred the existing split link which is available at vision_sdk/apps/src/rtos/modules which splits input buffer horizontally.

    I need to split input buffer vertically into 4 frames so I changed numSplits=4 and modified the process function as follows:

    if (pObj->inBufList.numBuf)
        {
            pObj->getFrameCount += pObj->inBufList.numBuf;
            pObj->stats.recvCount += pObj->inBufList.numBuf;

            pObj->outBufList.numBuf = 0;

            for (bufId = 0; bufId < pObj->inBufList.numBuf; bufId++)
            {
                pOrgBuf = pObj->inBufList.buffers[bufId];

                if(pOrgBuf == NULL)
                    continue;

                pOrgBuf->splitCount = pCreateArgs->numSplits;
            
                for (splitId = 0; splitId < pCreateArgs->numSplits; splitId++)
                {
                    status = Utils_bufGetEmptyBuffer(&pObj->outFrameQue,
                                                     &pBuf,
                                                     BSP_OSAL_NO_WAIT);
                    UTILS_assert(status == SYSTEM_LINK_STATUS_SOK);
                    UTILS_assert(pBuf != NULL);

                    payloadBkp = pBuf->payload;
                    memcpy(pBuf, pOrgBuf, sizeof(*pBuf));
                    pBuf->payload = payloadBkp;
                    memcpy(pBuf->payload,
                           pOrgBuf->payload,
                           sizeof(System_VideoFrameBuffer));
                           
                    pBuf->pSplitOrgFrame = (System_Buffer *)pOrgBuf;
                    
                    pObj->outBufList.buffers[pObj->outBufList.numBuf] = pBuf;
                    
                    chOffset = pObj->info.queInfo[0].numCh / pCreateArgs->numSplits;
                    
                    pBuf->chNum = pBuf->chNum + chOffset*splitId;
                    pSysVidFrmBufs = pBuf->payload;
                    
                    pQueChInfo = &pObj->info.queInfo[0].chInfo[pBuf->chNum];

                    dataFormat = (Fvid2_DataFormat) System_Link_Ch_Info_Get_Flag_Data_Format(
                                        pQueChInfo->flags);

                    if(Fvid2_isDataFmtSemiPlanar(dataFormat))
                    {
                        offset = pQueChInfo->width;
                    }
                    else
                    {
                        offset = 640*240*2;////pQueChInfo->width*2;
                    }

                    pSysVidFrmBufsTemp = pBuf->pSplitOrgFrame->payload;
                    pDataBuf = pSysVidFrmBufsTemp->bufAddr[0];

                    pDataBuf += (splitId * offset);
                    
                    memcpy(pSysVidFrmBufs->bufAddr[0],
                           pDataBuf,
                           offset);
                     
                    pObj->outBufList.numBuf++;       
                 }
                           
            }

            status = Utils_bufPutFull(&pObj->outFrameQue,
                                      &pObj->outBufList);
            UTILS_assert(status == SYSTEM_LINK_STATUS_SOK);

            System_sendLinkCmd(pCreateArgs->outQueParams.nextLink,
                                                    SYSTEM_CMD_NEW_DATA, NULL);
        }

    I got black screen at the output .

    Could you please suggest what all changes are needed to be done to split buffer vertically?

    Regards,

    Megha

  • Hi,

    If i understood correctly then you have header information of all 4 frames and using this you can separate 1 buffer into 4 buffers.

    The issue you are facing is how to send all 4 buffer to VPE link.

    You can create a link which receives a single input queue with single channel and output 4 queue with single channel and in your usecase use a merge link after your created link so that vpe will get all 4 buffer in a single channel.

    For copying you have to use dma as you want 4 different output buffers.

    Regards,

    Anuj

  • Hi Anuj,

    Thanks for the reply.

    I referred a SynthesisLink plugin and created a plugin which has 1 input queue and 4 outQueues. As you suggested I have given the output of New Plugin to Merge link.

    Now I'm getting below assertion:

    [IPU1-0]     17.170377 s:  Assertion @ Line: 156 in mergeLink_tsk.c: pPrm->inQueParams[inQue].prevLinkQueId < pObj->inTskInfo[inQue].
    numQue : failed !!!
    [IPU1-0]     17.171018 s:  Assertion @ Line: 156 in mergeLink_tsk.c: pPrm->inQueParams[inQue].prevLinkQueId < pObj->inTskInfo[inQue].
    numQue : failed !!!

    Could you please suggest what can be the issue and how to resole it?

    Best Regards,

    Megha

  • Hi,

    Can you create your usecase like below

    your_link -> merge

    your_link -> merge

    your_link -> merge

    your_link -> merge

    I think you are doing it only once but you have to do it times.

    Anyhow you can also take a reference of merge link and accumulate all video frame buffer in 4 separate channel of a single output queue of your link.

    So here you do not have to handle multiple output queue and do not have to use merge link.

    Regards,

    Anuj  

  • Hi Anuj,

    I created the usecase as you suggested using vsdk_linux.out. But I got (pObj->MergePrm).numInQue = 1; in priv.c file generated using usecase generation tool.

    Best Regards,

    Megha

  • Hi,

    Somehow merge link is not taking input from all 4 queue.

    its better to use the 2nd option.

    Anyhow you can also take a reference of merge link and accumulate all video frame buffer in 4 separate channel of a single output queue of your link.

    So here you do not have to handle multiple output queue and do not have to use merge link.

    Regards,

    Anuj

  • Hi,

    Its been long since any update on this thread.

    I hope the issue is resolved.

    Please verify answer or if not resolved then please reply below or create a new thread for a different query.

    Regards,

    Anuj