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.

DM355 MP4V Encoder Stuck

Hi,

I am having problems with the DM355 MP4V encoder getting stuck. After initializing and configuring the codec I call process() with the first video frame and this is where it gets stuck. I have tracked this down to IRQ_ASQINT not occurring but the root cause could be any number of things. I'm including relevant runtime and code below. Any suggestions on how to go about debugging this further? Normal protocol would have me stepping into the codec sources but this is obviously not an option.

My system is not based on Linux but I have successfully integrated the DM355 JPEG encoder into my firmware so I believe I am handling all of the nuts & bolts correctly.

All suggestions will be appreciated! Thanks.

 

Here is the stack:

(gdb) bt
#0  0x80109828 in VICPSYNC_wait (vicpHandle=0x80330740, res=VICPSYNC_MJCP) at ../libcodec/jpeg_vicpsync.c:14
#1  0x8013ca94 in MP4VENC_TI_vicpsync_wait (handle=<value optimized out>) at mp4venc_vicpsync.c:41
#2  0x8011c3a0 in MP4VENC_TI_DM350_FrameEncOnSeq (handle=0x80330740) at mp4venc_P.c:1860
#3  MP4VENC_TI_DM350_FrameEncode (handle=0x80330740) at mp4venc_P.c:2728
#4  0x80117c6c in MP4VENC_TI_encode (handle=0x80190a00, InBufs=0x80330740, OutBufs=0x8017c09c, Inargs=0x8017c1f8,
    Outargs=0x80172140) at mp4venc_ti.c:2924
#5  0x80109264 in mp4v_comp_hw (mcd=0x8016bc0c, mgf=0x801075bc <mp4v_get_frame_test>) at ../src/mp4v_comp_hw.c:278
#6  0x801074c4 in cap_video () at ../src/cap_video.c:292

 

Here are my params and dynamic params:

static IMP4VENC_Params params = {
    /* BASE */
    .videncParams.size                  = sizeof(IMP4VENC_Params),
    .videncParams.encodingPreset        = XDM_USER_DEFINED,    /* ??? */
    .videncParams.rateControlPreset     = IVIDEO_LOW_DELAY,    /* CBR rate control*/
    .videncParams.maxHeight             = 480,
    .videncParams.maxWidth              = 640,
    .videncParams.maxFrameRate          = 30 * 1000,        /* fps * 1000 */
    .videncParams.maxBitRate            = 1024000,        /* bps */
    .videncParams.dataEndianness        = XDM_BYTE,
    .videncParams.maxInterFrameInterval = XDM_DEFAULT,        /* ? */
    .videncParams.inputChromaFormat     = XDM_YUV_422ILE,
    .videncParams.inputContentType      = IVIDEO_PROGRESSIVE,
    .videncParams.reconChromaFormat     = XDM_DEFAULT,

    /* MP4V */
        .subWindowHeight         = 480,
        .subWindowWidth          = 640,
        .rotation                = 0,
    .vbvSize                 = 10000,    /* ???? Video buffer verifier size (in multiples of 16KB) */
    .svhMode                 = 0,        /* ??? 1:Mpeg4 in short video header mode*/
    .IFrameBitRateBiasFactor = 256,        /* 256 = No Effect (Disable) */
    .PFrameBitRateBiasFactor = 256,        /* 256 = No Effect (Disable) */
    .peakBufWindow           = 0,        /* ??? Time duration (in sec) during which actual bitrate of encoding stream can reach the max bitrate limit */
    .minBitRate              = 0,        /* ??? Minimum bit rate, bits per second. (optional) */
};


static IMP4VENC_DynamicParams dynamicParams = {
    /* BASE */
    .videncDynamicParams.size               = sizeof(IMP4VENC_DynamicParams),
    .videncDynamicParams.inputHeight        = 480,
    .videncDynamicParams.inputWidth         = 640,
    .videncDynamicParams.refFrameRate       = 0,    /* fps * 1000 */
    .videncDynamicParams.targetFrameRate    = 30 * 1000,    /* fps * 1000 */
    .videncDynamicParams.targetBitRate      = 1024000,        /* bps */
    .videncDynamicParams.intraFrameInterval = 30,        /* ??? */
    .videncDynamicParams.generateHeader     = 0,
    .videncDynamicParams.captureWidth       = 0,        /* Use inputWidth */
    .videncDynamicParams.forceFrame         = 0,
    .videncDynamicParams.interFrameInterval = 0,        /* Use maxInterFrameInterval */
    .videncDynamicParams.mbDataFlag         = 0,

    /* MP4V */
    .intraAlgo      = 1,    /* 1 = Algorithm 1 with IIDC at 8x8 */
    .numMBRows      = 5,    /* ??? */
    .initQ          = 0,    /* 0 = Automatically determined */
    .rcQMax         = 31,
    .rcQMin         = 1,
    .intraFrameQP   = 0,
    .interFrameQP   = 0,
    .rateFix        = 0,    /* RESERVED */
    .rateFixRange   = 4,    /* RESERVED */
    .meAlgo         = 2,    /* 2 = 84221H ME */
    .skipMBAlgo     = 1,    /* 1 = Bonus skipMB Algo */
    .unrestrictedMV = 1,    /* 1 = Enable unrestricted motion vector */
    .mvDataEnable   = 0,    /* 0 = Disable motion vector access */
};

 

  • If the IRQ_ASQINT is not getting asserted, this means that the codec never returned from the VICP co-proc. The reasons could be numerous. In Linux(DVSDK), the VICP Int, EDMA, physical-virtual memory is taken care by FC and Linuxutils. How is done in your system. Have you ported the other MFP component for that ? Which OS is this ?

    The parameters looks fine at a glance, will get it reverified.

    regards

    Yashwant

  • Hi Yashwant,

     

    At the moment I am not running an OS and am working in a flat address space (VA=PA). We've managed to write our own "minimalist" IRES modules and they work fine with the JPEG Encoder. Our "minimalist" modules are as follows:

     

    -MEMUTILS functions (handles caching)

     

    -Algorithm creation with calls to algNumAlloc(), algAlloc(), algInit(). The requirements of the codec have been predetermined and we use static buffers for memrecs, for example:

         ...

         static uint8_t mp4v_memrec_buf0[13792]   __attribute__((aligned (256))) __attribute__((section (".nzss")));

         ...

         static const IALG_MemRec mp4v_memrec_tab[MP4V_MEMREC_TAB_SIZE] = {
                 { .size = 13792,   .alignment = 256, .space = IALG_EXTERNAL, .attrs = IALG_PERSIST, .base = mp4v_memrec_buf0 },

         ...

     

    -Resource allocaiton with calls to numResourceDescriptors(), getResourceDescriptors(), and initResources(). We have written three simple allocation modules. ADDRSPACE and VICP2 are easy to deal with since VA=PA and there is only one VICP2 entry in the resource table. There are 29 EDMA3CHAN entries and these are a little more complex to deal. But, the JPEG Encoder has the same type of table format as the MP4V Encoder and we have the JPEG Encoder working so we were not anticipating any problems here. I'm including the tables for JPEG and MP4V below:

    JPEG EDMA3CHAN Entries

     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 63,  qdmaChan = 518, edmaChan = 63,  contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 23, paRamIndex = 512, numTccs = 0, tccIndex = 514, qdmaChan = 518, edmaChan = 518, contiguousAllocation = 1, shadowPaRamsAllocation = 0}

    MP4V EDMA3CHAN Entries

     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 63,  qdmaChan = 518, edmaChan = 63,  contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 1,  paRamIndex = 512, numTccs = 1, tccIndex = 514, qdmaChan = 518, edmaChan = 516, contiguousAllocation = 1, shadowPaRamsAllocation = 0}
     * {numPaRams = 38, paRamIndex = 512, numTccs = 0, tccIndex = 514, qdmaChan = 518, edmaChan = 518, contiguousAllocation = 1, shadowPaRamsAllocation = 0}

  • I think there is some problem with EDMA chan entries. Valid value of edmaChan should be <64. Similar with tccIndex. Valid value of paRamIndex <256. Can you refer to myLinuxutils.c file present in standard FC package "\framework_components_x_xx_xx_xx\examples\ti\sdo\fc\rman\examples". This gives an example on how to allocate EDMA resource for standalone case(NO OS).  

    regards

    Yashwant

  • Hi Yashwant,

     

    Thanks for mentioning that file, I did not know it existed. After comparing allocation algorithms, I have found my problem. Or, at least the codec appears to be making forward progress now. In myLinuxutils.c, the EDMA channel, TCC number, and PARAM number are all the same value. It is unclear whether this is a requirement specific for the MP4V codec or whether it is true for all codecs. The JPEG codec appears to work correctly when the PARAM number differs from the EDMA channel and TCC number. Regardless, the MP4V codec appears to be unstuck. Thanks again.