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.

MPEG4 Encoder and (VICP) Signal Processing Library on DM648

Hello,

We are using the

MP4VENC_TI Ver:1.21.005 Released by:DEV_100_V_MPEG4_E_1_21_005 Built:Feb 24 2009 05:36:04
with:
edma3_lld_01_11_02_05
codec_engine_2_26_02_11

And the

Video Imaging Co-Processor (VICP) Signal Processing Library V3.3.0

on a DM648

Both work fine by themselves but when I run any VICP computation function, the call to VIDENC_process
never returns.

I am following all the points mentioned in  
http://processors.wiki.ti.com/index.php/VICPLIB_DM644x_DM64x_FAQ
going as far as running one VICP computation calling CPIS_delete and CPIS_deInit before the Encoder init  but the encoder still doesn't work.
In fact  after running a VICP related function when I try to reload the encoder program I am still facing the same program. the problem continues until I do a hard rest on the DSP and after that the encoder works fine.
Based on the document this encoder does not use the VICP but that is obviously wrong.
What could be the problem? It seems that the Encoder makes some assumptions about the VICP which is only true at the start-up. Runnig CPIS_init does not have any negative effect. The problem starts when I run any VICP computation and stays until I do a hard reset. What are the assumptions that the encoder makes about the VICP status?

Thanks,

Babak

  • Hi Babak,

    Are you calling activate and de-activate across the process and control call of MPEG4 Encoder?

    For encoder to work properly, it is required to have these calls in place across the control & process calls. Please share the code snippet for the calling sequence for MPEG4 encoder and VICP. We will review and get back to you.

     

    Thanks & Regards

    Sangita

     

     

  • Hi Sangita,

    I am using XDM not XDAIS so there is no algActivate() and algDeactivate() call. (As far as I remember  VIDENC_process does this internally) My process call is just this:

         status = VIDENC_process((VIDENC_Handle)mp4->enc, &inBufDesc, &encodedBufDesc, &encInArgs,
                        &encOutArgs);

    This is the sequence of my calls:

    vicpLibInit();
    ..
    mp4EncInit(); //calls VIDENC_create , VIDENC_control
    ...
    //Main loop
    pEncoded = mp4Enc(&state.mp4, img, &encodedBytes);  //which calls the VIDENC_process
    ....
     r = CPIS_filter(
       &handle,
       &base,
       &params,
       CPIS_ASYNC
       );
     if (r == -1)
     {
      errorMsg ( "*** ERROR: CPIS_filter() error %u\n", CPIS_errno);
     };

     CPIS_start( handle );
     CPIS_wait( handle );
     CPIS_delete( handle );


    Thanks,

    Babak

     

  • Hi Sangita,

    It has been several week now. Has someone looked in to this issue? Please let me know as soon as you can.

    Thanks,

    Babak

  • Hi Babak,

    Sorry for the delayed response.

     

    Please add activate and de-activate calls across the control and Process call. Codec do not implement this functionality internally in process call. Please refer TestAppEncoder.c available in the releases package and also the user guide for details.

     

    Thanks & Regards

    Sangita

     

     

     

  • Hi Sangita,

    Adding activate and de-activate for all the controls and process calls did not help. When the VICP is running the VIDENC_process call does not return and when the Encoder is running the call to CPIS_filter does not return. (Both work fine by themselves)

        IALG_Handle Ihandle = (IALG_Handle) VISA_getAlgHandle((VISA_Handle) mp4->enc );
    .
        Ihandle->fxns->algActivate(Ihandle);

        status = VIDENC_process((VIDENC_Handle)mp4->enc, &inBufDesc, &encodedBufDesc, &encInArgs,
                        &encOutArgs);
        Ihandle->fxns->algDeactivate(Ihandle);

    What VICP resource is used by the encoder. Is it releasing the VICP after each process?

    Please let me know,

    Thanks,

    Babak

  • Hi Babak,

    The encoder uses the VICP for doing ME.

    One possible reason could be that the VICP processing done after frame end (outside the codec) does not bring back the VICP clean state (reset state). Please check with explicit VICP reset across the encoder process call.

     

    Please note, within a process call, encoder owns the VICP fully and no other app can use it.

    Regards

    Sangita

     

  • Hi Sangita,

    Sorry about the delay, I am back on this problem again. How can I do a "Explicit VICP reset". I used this code but it didn't make any different.

    bspDisablePSC(CSL_PSC_VICP);
    bspEnablePSC(CSL_PSC_VICP);

    void bspEnablePSC(int dev)
    {
        CSL_PscRegsOvly pscRegs = (CSL_PscRegsOvly)CSL_PSC_0_REGS;

        if (dev < 0 || dev > 34)
            return;

        if (CSL_FEXT(pscRegs->MDSTAT[dev], PSC_MDSTAT_STATE)
                    == CSL_PSC_MDSTAT_STATE_ENABLE)
            return;

        // deassert GPIO local PSC reset and set NEXT state to ENABLE
        pscRegs->MDCTL[dev] = CSL_FMKT(PSC_MDCTL_NEXT, ENABLE)
                                       | CSL_FMKT(PSC_MDCTL_LRST, DEASSERT);
        // move GPIO PSC to Next state
        if (dev == CSL_PSC_3PSW)
            pscRegs->PTCMD = CSL_FMKT(PSC_PTCMD_GO0, SET) << 1;
        else
            pscRegs->PTCMD = CSL_FMKT(PSC_PTCMD_GO0, SET);

        // wait for transition
        while (CSL_FEXT(pscRegs->MDSTAT[dev], PSC_MDSTAT_STATE)
                != CSL_PSC_MDSTAT_STATE_ENABLE)
            ;
    }


    /*! \brief Set the state of PSC modeule */
    void bspDisablePSC(int dev)
    {
        CSL_PscRegsOvly pscRegs = (CSL_PscRegsOvly)CSL_PSC_0_REGS;

        if (dev < 0 || dev > 34)
            return;

        if (CSL_FEXT(pscRegs->MDSTAT[dev], PSC_MDSTAT_STATE)
                    == CSL_PSC_MDSTAT_STATE_DISABLE)
            return;

        // deassert GPIO local PSC reset and set NEXT state to DISBLE
        pscRegs->MDCTL[dev] = CSL_FMKT(PSC_MDCTL_NEXT, DISABLE)
                                       | CSL_FMKT(PSC_MDCTL_LRST, DEASSERT);
        // move GPIO PSC to Next state
        if (dev == CSL_PSC_3PSW)
            pscRegs->PTCMD = CSL_FMKT(PSC_PTCMD_GO0, SET) << 1;
        else
            pscRegs->PTCMD = CSL_FMKT(PSC_PTCMD_GO0, SET);

        // wait for transition
        while (CSL_FEXT(pscRegs->MDSTAT[dev], PSC_MDSTAT_STATE)
                != CSL_PSC_MDSTAT_STATE_DISABLE)
            ;
    }

     

    Thanks,

    Babak

     

  • Has this issue been resolved somehow?  In my situation, after completion of a DM648 VICP operation I attempt to start h.264 encoding, but enc->process() never returns from the second call (all seems fine after the 1st call).  According to the call stack, it's stuck in H264VENC_TI_PutSliceP_Data().

    Since the first call to process() generates an I-Frame, it sounds like the issue could be poor sharing of the VICP's memory when the encoder does motion estimation.

  • It's been a long time since I asked this question.  Can somebody help with this?