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.

DM6437 queue & dequeue API

Other Parts Discussed in Thread: TVP5146

Good morning everyone,

I am a beginner working with a DM6437 and I have an issue that I can't solve no matter what I do.

First let me explain my issue:

I am working with a camera that sends only 9 different images every second.

In the dm6437 program I am working with 25 images per second ( PAL format) to display images after the processing in a screen.

What I want to do is to process only one image every 3 images. So I first write the code that can do the basic display by using the different examples given.

Which is working.

Here are some of the lines of the code:


if(status)
{
FVID_queue(hGioVpfeCcdc, frameBuffTable[0]);
FVID_queue(hGioVpfeCcdc, frameBuffTable[1]);
FVID_queue(hGioVpfeCcdc, frameBuffTable[2]);
}


if(status)
{
FVID_queue(hGioVpbeVid0, frameBuffTable[3]);
FVID_queue(hGioVpbeVid0, frameBuffTable[4]);
FVID_queue(hGioVpbeVid0, frameBuffTable[5]);
}

if(status) FVID_dequeue(hGioVpfeCcdc, &frameBuffPtr);

while(status)

{

FVID_exchange(hGioVpfeCcdc, &frameBuffPtr); 

VLIB_extractLumaFromUYUV (((uint8_t*)(frameBuffPtr->frame.frameBufferPtr)), VID_DIMX_PAL,VID_DIMX_PAL,VID_DIMY_PAL, img); // basic processing

//BCACHE_wb(frameBuffPtr->frame.frameBufferPtr,VID_DIMY_PAL*VID_DIMX_PAL*2,true);

FVID_exchange(hGioVpbeVid0, &frameBuffPtr); 

}

The problem comes after, because as I want to process only one image every 3 second, So first I have to remove the FVID_exchange API and replace them by FVID_queue and FVID_dequeue, and instead of using only one frameBuffPtr I have to use two of them: one I called CapframeBuffPtr  and the other DispframeBuffPtr for the capture and display drivers.

So first I just wanted to do the equivalent with these API than with the FVID_exchange API which isn't working. It has been weeks than I try to find the solution but I didn't succeed. In a second time I want to process only one image every 3 image dequeued from the capture queue ,  and the others 2 images dequeued from the capture queue, just requeue them.

So please if there an expert that can clarify me, it would be welcome. 

Sorry for my bad english. 

And Thank you in advance.

Here is the code:

if(status)
{
FVID_queue(hGioVpfeCcdc, frameBuffTable[0]);
FVID_queue(hGioVpfeCcdc, frameBuffTable[1]);
FVID_queue(hGioVpfeCcdc, frameBuffTable[2]);
}


if(status)
{
FVID_queue(hGioVpbeVid0, frameBuffTable[3]);
FVID_queue(hGioVpbeVid0, frameBuffTable[4]);
FVID_queue(hGioVpbeVid0, frameBuffTable[5]);
}


FVID_dequeue(hGioVpbeVid0, &DispframeBuffPtr);

while(status)
{

//FVID_exchange(hGioVpfeCcdc, &frameBuffPtr); 
FVID_dequeue(hGioVpfeCcdc,&CapframeBuffPtr);

//VLIB_extractLumaFromUYUV (((uint8_t*)(frameBuffPtr->frame.frameBufferPtr)), VID_DIMX_PAL,VID_DIMX_PAL,VID_DIMY_PAL, img);
VLIB_extractLumaFromUYUV (((uint8_t*)(CapframeBuffPtr->frame.frameBufferPtr)), VID_DIMX_PAL,VID_DIMX_PAL,VID_DIMY_PAL, img);


 for(int i=0;i<720*560;i++)
 {
 ((short*)(DispframeBuffPtr->frame.frameBufferPtr))[i]= ((short*)(CapframeBuffPtr->frame.frameBufferPtr))[i];
 }


//BCACHE_wb(frameBuffPtr->frame.frameBufferPtr,VID_DIMY_PAL*VID_DIMX_PAL*2,true);

//FVID_exchange(hGioVpbeVid0, &frameBuffPtr); // display the video frame
FVID_queue(hGioVpfeCcdc,&CapframeBuffPtr);

FVID_queue(hGioVpbeVid0,&DispframeBuffPtr);

FVID_dequeue(hGioVpbeVid0,&DispframeBuffPtr);
}

  • Hi Perdue,

    Sorry for the Delayed Response.
    Unfortunately I am not having DM6437, but I can try on DM6446 EVM.


    What I want to do is to process only one image every 3 images. So I first write the code that can do the basic display by using the different examples given.


    can you share the link form where you got these examples.
    so that i can reproduce the same issue on my end also.


    Also you can refer these links, they may help you out

    e2e.ti.com/.../6625

    e2e.ti.com/.../93863
  • Hi Arvind Singh,

    I used an example which was in the examples files, here the full code:

    /*
    * Copyright 2007 by Texas Instruments Incorporated.
    * All rights reserved. Property of Texas Instruments Incorporated.
    * Restricted rights to use, duplicate or disclose this code are
    * granted through contract.
    *
    * @(#) dvsdk_1_00_00_19 1_00_00_19 031507 (davinci64LC-a19x)
    *
    * Pixel Modification code added by Bernard Thompson - DCAT - TI
    */
    /*
    * ======== video_preview.c ========
    *
    */


    /* runtime include files */
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <stdarg.h>

    /* BIOS include files */
    #include <std.h>
    #include <gio.h>
    #include <tsk.h>
    #include <trc.h>

    /* PSP include files */
    #include <psp_i2c.h>
    #include <psp_vpfe.h>
    #include <psp_vpbe.h>
    #include <fvid.h>
    #include <psp_tvp5146_extVidDecoder.h>
    #include <FVID_evmDM6437.h>

    /* CSL include files */
    #include <soc.h>
    #include <cslr_sysctl.h>


    #define FRAME_BUFF_CNT 6

    static CSL_SysctlRegsOvly sysModuleRegs = (CSL_SysctlRegsOvly )CSL_SYS_0_REGS;

    static PSP_VPFE_TVP5146_ConfigParams tvp5146Params =
    {
    TRUE, /* enable656Sync */
    PSP_VPFE_TVP5146_FORMAT_COMPOSITE, /* format */
    //PSP_VPFE_TVP5146_FORMAT_SVIDEO,
    //PSP_VPFE_TVP5146_MODE_AUTO /* mode */
    PSP_VPFE_TVP5146_MODE_PAL
    };

    static PSP_VPFECcdcConfigParams vpfeCcdcConfigParams = {
    PSP_VPFE_CCDC_YCBCR_8, /* dataFlow */
    PSP_VPSS_FRAME_MODE, /* ffMode */
    576, /* height */
    720, /* width */
    (720 *2), /* pitch */
    0, /* horzStartPix */
    0, /* vertStartPix */
    NULL, /* appCallback */
    {
    PSP_VPFE_TVP5146_Open, /* extVD Fxn */
    PSP_VPFE_TVP5146_Close,
    PSP_VPFE_TVP5146_Control,
    },
    0 /*segId */
    };

    static PSP_VPBEOsdConfigParams vpbeOsdConfigParams = {
    PSP_VPSS_FRAME_MODE, /* ffmode */
    PSP_VPSS_BITS16, /* bitsPerPixel */
    PSP_VPBE_YCbCr422, /* colorFormat */
    (720 *2 ), /* pitch */
    0, /* leftMargin */
    0, /* topMargin */
    720, /* width */
    576, /* height */
    0, /* segId */
    PSP_VPBE_ZOOM_IDENTITY, /* hScaling */
    PSP_VPBE_ZOOM_IDENTITY, /* vScaling */
    PSP_VPBE_EXP_IDENTITY, /* hExpansion */
    PSP_VPBE_EXP_IDENTITY, /* vExpansion */
    NULL /* appCallback */

    };

    static PSP_VPBEVencConfigParams vpbeVencConfigParams = {
    // PSP_VPBE_DISPLAY_NTSC_INTERLACED_COMPOSITE /* Display Standard */
    PSP_VPBE_DISPLAY_PAL_INTERLACED_S_VIDEO
    };

    // ADDED by BHT
    volatile unsigned int * L2IBARregPtr = (unsigned int*) 0x01844018;
    volatile unsigned int * L2IWCregPtr = (unsigned int*) 0x0184401C;
    volatile unsigned int * L2WBARregPtr = (unsigned int*) 0x01844000;
    volatile unsigned int * L2WWCregPtr = (unsigned int*) 0x01844004;
    volatile unsigned int * L2WBregPtr = (unsigned int*) 0x01845000;
    volatile unsigned int * L2INVregPtr = (unsigned int*) 0x01845008;
    volatile unsigned int * L2WBINVregPtr = (unsigned int*) 0x01845004;
    int xx;
    volatile int tempcounter;
    int screenshift = 0;
    int direction = 1;
    int ticker = 0;
    void process_image( void* currentFrame, int yRows, int xPixels,
    int lowThreshold, int hiThreshold
    );
    void process_imagebw( void* currentFrame, int yRows, int xPixels);
    // END ADD

    /*
    * ======== main ========
    */
    void video_preview(void);
    void main() {

    printf("Video Preview Application tot 2\n");
    fflush(stdout);

    /* Workaround to BIOS/LOG issue: SDSCM00013785 */
    TRC_disable(TRC_LOGCLK);


    /* VPSS PinMuxing */
    /* CI10SEL - No CI[1:0] */
    /* CI32SEL - No CI[3:2] */
    /* CI54SEL - No CI[5:4] */
    /* CI76SEL - No CI[7:6] */
    /* CFLDSEL - No C_FIELD */
    /* CWENSEL - No C_WEN */
    /* HDVSEL - CCDC HD and VD enabled */
    /* CCDCSEL - CCDC PCLK, YI[7:0] enabled */
    /* AEAW - EMIFA full address mode */
    /* VPBECKEN - VPBECLK enabled */
    /* RGBSEL - No digital outputs */
    /* CS3SEL - LCD_OE/EM_CS3 disabled */
    /* CS4SEL - CS4/VSYNC enabled */
    /* CS5SEL - CS5/HSYNC enabled */
    /* VENCSEL - VCLK,YOUT[7:0],COUT[7:0] enabled */
    /* AEM - 8bEMIF + 8bCCDC + 8 to 16bVENC */
    sysModuleRegs -> PINMUX0 &= (0x005482A3u);
    sysModuleRegs -> PINMUX0 |= (0x005482A3u);

    /* PCIEN = 0: PINMUX1 - Bit 0 */
    sysModuleRegs -> PINMUX1 &= (0xFFFFFFFEu);

    sysModuleRegs -> VPSSCLKCTL = (0x18u);
    return;
    }



    void video_preview(void) {
    PSP_VPSSSurfaceParams *frameBuffTable[FRAME_BUFF_CNT];
    PSP_VPSSSurfaceParams *frameBuffPtr;
    GIO_Handle hGioVpfeCcdc;
    GIO_Handle hGioVpbeVid0;
    GIO_Handle hGioVpbeVenc;
    int status = 0;
    int done = 0;
    int result;
    int i;
    //LgUns curtime=0,totaltime=0;
    //int countertime=0;

    printf("statue0 = %d",status);
    fflush(stdout);
    /* init the frame buffer table */
    for (i=0; i<FRAME_BUFF_CNT; i++) {
    frameBuffTable[i] = NULL;
    }

    /* create video input channel */
    if (status == 0) {
    PSP_VPFEChannelParams vpfeChannelParams;
    vpfeChannelParams.id = PSP_VPFE_CCDC;
    vpfeChannelParams.params = (PSP_VPFECcdcConfigParams*)&vpfeCcdcConfigParams;
    hGioVpfeCcdc = FVID_create("/VPFE0",IOM_INOUT,NULL,&vpfeChannelParams,NULL);
    status = (hGioVpfeCcdc == NULL ? -1 : 0);
    }
    printf("statue1 = %d",status);
    fflush(stdout);
    /* create video output channel, plane 0 */
    if (status == 0) {
    PSP_VPBEChannelParams vpbeChannelParams;
    vpbeChannelParams.id = PSP_VPBE_VIDEO_0;
    vpbeChannelParams.params = (PSP_VPBEOsdConfigParams*)&vpbeOsdConfigParams;
    hGioVpbeVid0 = FVID_create("/VPBE0",IOM_INOUT,NULL,&vpbeChannelParams,NULL);
    status = (hGioVpbeVid0 == NULL ? -1 : 0);
    }
    printf("statue2 = %d",status);
    fflush(stdout);
    /* create video output channel, venc */
    if (status == 0) {
    PSP_VPBEChannelParams vpbeChannelParams;
    vpbeChannelParams.id = PSP_VPBE_VENC;
    vpbeChannelParams.params = (PSP_VPBEVencConfigParams *)&vpbeVencConfigParams;
    hGioVpbeVenc = FVID_create("/VPBE0",IOM_INOUT,NULL,&vpbeChannelParams,NULL);
    status = (hGioVpbeVenc == NULL ? -1 : 0);
    }
    printf("statue3 = %d",status);
    fflush(stdout);
    /* configure the TVP5146 video decoder */
    if (status == 0) {
    result = FVID_control(hGioVpfeCcdc, VPFE_ExtVD_BASE+PSP_VPSS_EXT_VIDEO_DECODER_CONFIG, &tvp5146Params);
    status = (result == IOM_COMPLETED ? 0 : -1);
    }
    printf("statue4 = %d",status);
    fflush(stdout);
    /* allocate some frame buffers */
    if (status == 0) {
    for (i=0; i<FRAME_BUFF_CNT && status == 0; i++) {
    result = FVID_alloc(hGioVpfeCcdc, &frameBuffTable[i]);
    status = (result == IOM_COMPLETED && frameBuffTable[i] != NULL ? 0 : -1);
    }
    }
    printf("statue5 = %d",status);
    fflush(stdout);
    /* prime up the video capture channel */
    if (status == 0) {
    FVID_queue(hGioVpfeCcdc, frameBuffTable[0]);
    FVID_queue(hGioVpfeCcdc, frameBuffTable[1]);
    FVID_queue(hGioVpfeCcdc, frameBuffTable[2]);
    }

    /* prime up the video display channel */
    if (status == 0) {
    FVID_queue(hGioVpbeVid0, frameBuffTable[3]);
    FVID_queue(hGioVpbeVid0, frameBuffTable[4]);
    FVID_queue(hGioVpbeVid0, frameBuffTable[5]);
    }

    /* grab first buffer from input queue */
    if (status == 0) {
    FVID_dequeue(hGioVpfeCcdc, &frameBuffPtr);
    }

    /* loop forever performing video capture and display */
    while (!done && status == 0) {

    /* grab a fresh video input frame */
    FVID_exchange(hGioVpfeCcdc, &frameBuffPtr);

    ///// Here we can do operations on the video frame buffer...



    /* display the video frame */
    FVID_exchange(hGioVpbeVid0, &frameBuffPtr);

    }

    }


    Regards