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.

Codec Engine Port - no HDVICP interrupt for H264VDEC

Other Parts Discussed in Thread: TMS320DM365

Hi,

we're porting Codec Engine / Framework Components to the QNX Neutrino OS on a TMS320DM365,
aiming to do H264 video decoding. Work is based upon CodecEngine version 2.25.05.16. The port is
largely derived from the Linux version and mainly finished, but now we are hitting some trouble trying
to actually get the codec to run.

Instantion of the h264 video decoder (via VIDDEC2_create()) appears to work nicely.

Parameter settings are:
    viddecDynamicParams.size = sizeof(IH264VDEC_DynamicParams);
    viddecDynamicParams.decodeHeader = XDM_DECODE_AU;
    viddecDynamicParams.displayWidth = 0;
    viddecDynamicParams.frameSkipMode = IVIDEO_NO_SKIP;
    viddecDynamicParams.frameOrder = IVIDDEC2_DISPLAY_ORDER;
    viddecDynamicParams.newFrameFlag = XDAS_FALSE;
    viddecDynamicParams.mbDataFlag = XDAS_FALSE; // don't want macroblock data.
    getDataFxn = NULL;
    dataSyncHandle = NULL;
    resetHDVICPeveryFrame = 1;


When creating the codec, 14 memory areas and 29 different resources are allocated; the latter ones
being 26 edma3chans, a vicp2, a hdvicp, and an addrspace. This appears to be in line with the expected
H264VDEC resource usage.

Also setting the codec parameters and getting buffer info seems to function - VIDDEC2_control() is
called twice, once with id=1, the other time with id=5, and the reported (and later on successfully
allocated) buffer sizes are:
    input buffer: 0x200048
    output buffer 0: 0x23d800
    output buffer 1: 0x11ec00


My application uses the raw H264 stream 'colorful_toys_cif_5frms_420P.264' provided with the H264DEC
package.

When VIDDEC2_process() is called, the algorithm gets activated, a couple of physical addresses
are determined, HDVICPSYNC_start() is called and returns ok, then HDVICPSYNC_wait() is called
and calls VICP_wait(). Here things stop.

In a server process that is handling all system-related requests (analogous to the Linux kernel modules
in linuxutils), IRQ 10 (HDVICP0) has been attached to upon an earlier VICP_register() call from the CE
and is now waited for (VICP_wait())... but it never comes.

By now I've checked pretty much anything I could think of, still can't find the cause, and am
running out of ideas of what else to check or make sure. Below is a rough overview of what I
can see when the app is waiting for an interrupt:


In the DM365's System Control Module:
    Bit 2 in ARM_INTMUX was set such that IRQ 17 should be used for EDMA CC error interrupts
    Bit 0 in ARM_INTMUX was set to get IRQ 10 from HDVICP
    EDMA_EVTMUX is set to 0x007fc004, switching the 9 releveant edma events to HDVICP
    MISC indicates normal HDVICP bus operation
    PERI_CLKCTL says HDVICP is using PLLC2SYSCLK2

Both PLLs are set up and running.

In the EDMA3CC configuration area, I can see that channels 0..25 are mapped into shadow
region 0 (DRA[0]=0x03ffffff) and that PaRam sets 1 and 2 have been set up to transfer
data into HDVICP DMA port 1 (see below), looking at src and dst memory areas, the transfers
appear completed. No EDMA errors or missed events are reported.

Strangely, though, EER[H], IER, and IPR (as well as CER and SER) are entirely 0.
Also, all of the shadow region are completely zero.

ER has a few bits set, but only ones that should not be affected by HDVICP.
These are the two param sets mentioned above: 
            opt      src      dst     acnt bcnt ccnt  sbi  dbi   sci  dci   lnk  bcld
PaRam[1]: 00101008 8581e000 12061980  0540 0001 0001  0000 0000  0000 0000  ffff 0001
PaRam[2]: 00102008 85838000 12060010  1938 0001 0001  0000 0000  0000 0000  ffff 0001

Also, although according to the opt fields' TCINTEN and TCC values, completion interrupts
should have been generated, I didn't get any of those. In a test program that 'manually'
initiated an EDMA transfer, the interrupts came without hesitance.

Does anybody have any hints on how to proceed? Where to look or what to check?
Which bits to look at or to tweak?

I even 'faked' the HDVICP interrupt by just delaying about 0.1s and then returning OK
to VICP_wait()... No soup. It just gets called over and over, without VIDDEC2_process()
ever returning.

Thanks in advance for any feedback,
- Thomas

  • Thanks Thomos for detailing the problem.

    It looks like the decoder is hanging in HDVICP. In order to confirm that, can you check if the raw interrupt register of ARM is set or reset for IRQ10. This will tell if any interrupt was send by HDVICP or not.

    Also, codec use the global register space and not any region. Can you check IPR and IPRH of global region and tell its value ?

    regards

    Yashwant

  • Hi Yashwant,

    thanks for your immediate response. Looking at the INTC registers, IRQ 10 (HDVICP) seems to be enabled (*0x01c48010 & 0x400 == 1, see below), but it either hasn't occured at all or was acknowledged without me (and the OS) knowing:

       01c48000: ffffffff ffffffff ffffffff ffffff7d
       01c48010: 00000000 00000000 00031400 00000108

    I probably was a bit unclear in my previous post, the sentence "EER[H], IER, and IPR [...] are entirely 0" did in fact refer to the global region, and I resorted to calling the 64-bit registers by their low word (e.g., 'IER' means 'IER and IERH').

    Of course it's not surprising to see IPR being 0 if IER is, too... Will the codec set the required IER bits itself, or do I have to do so when a client registers for an edma3 channel?

    Thanks,
    - Thomas

  • Hi Thomas,

    Codec does not use interupt for DMA completion. Hence IER will always be 0. Inside HDVICP, we use polling for DMA completion. Hence asked to check the state of IPR. If it is 0, this means that either the DMA were waiting properly or the none of the DMAs where trigerred.

    Frankly speaking, its hard to comment more without having visibilty of what happenig inside. How did you port the codec on QNX ? Did you get source code or the gcc based lib which we provide on wesite was good enough ?

    regards

    Yashwant

  • Hi Yashwant,

    I absolutely agree, it's likely hard without knowing what is going on inside the codec. Unfortunately, we do not have direct access to the source code (legal stuff would've taken too long at that time). We did get the codec library recompiled by MPC Data, as was suggested by TI, using our gcc toolchain and settings (we couldn't use the EABIv5 versions provided on your website, we are using gnu abi).

    Are the codec sources equipped with tracing code? We could ask MPC Data to rebuild with tracing enabled.

    Would the contents of the HDVICP memory areas help you any to determine the state it is in?

    Thanks & regards,
    - Thomas

  • Hi again,

     

    looking for something entirely different, I was just browsing the 'ih264vdec.h' header file and stumbled across this comment:

    /** ============================================================
     *  @name   IH264VDEC_TI_DataSyncGetFxn
     *
     *  @desc  Blocking API used by decoder to signal "data request"
     *        to producer .
     *        Producer need to define this API. Returns the success
     *        or failure status. Valid return value is XDM_EOK or
     *        XDM_EFAIL
     *
     *  @field  IH264VDEC_TI_DataSyncHandle
     *          Handle of dataSync provided by application

     *  @field  IH264VDEC_TI_DataSyncDesc
     *          dataSyncDescriptor containing encoded bistream buffer
     *          details
     *  ============================================================
     */

    I didn't provide a data-sync function in my decoder args, though... might that cause an issue like this? Frankly, I haven't used Codec Engine before I started porting 12 weeks ago, and still am not clear about a number of details - for example, how the data-sync mechanism is expected to work. Also haven't yet found a useful documentation of it. Maybe you can provide some good reading reference for this?

    Thanks,
    - Thomas

  • Thomas,

    If you are using inputDataMode = 1, whcih i feel would be the case, it really does not matter if you provide dataSync call back function or not.

    Unfortunately, The code sent to MPC data does not have trace. Can you get some help from MPC for the same ? They have done such porting on other platform and they might know how to debug such things. Let us know if it works out.

    regards

    Yashwant

  • Hi Yashwant,

    yes, I am using  inputDataMode=1.  

    Two questions remain: Couldn't the contents of the HDVICP's memory areas tell us anything? Whether it is working or not, or what state it is in? And what do you do when debugging your codec libraries?

    Thanks again,
    - Thomas

  • The content of HDVICP memory may not tell much. In case you can connect Jtag to HDVICP, then at least we can find which fuction it is hanging. While debugging codec in HDVICP, we either use Jtag on HDVICP. If not, we try to put some magic numbers at various locations in HDVICP code to trace the hand/flow and then monitor it from ARM926.

    regards

    Yashwant

  • Hi yashwant,

    still no interrupt. Two questions, though:

    - when I run the test application provided with the H264 decoder, it needs an IRES MEMTCM resource.Is the TCM actually required in communication with the HDVICP?
    - In the VICP2 resources setup, I can see a number of IMCOP buffer pointers being set up to point into the MJCP's memory. I thought the HDVICP was independent from
      the MJCP? Or is the latter involved in any way in the decoding of H264?

     

    Thanks,
    - Thomas

  • Thomas,

    1. DM36x H.264 decoder implementation need ARM926 TCM memory as scratch buffer for frame processing. This is to improve speed of the decoder.

    2. DM36x H.264 decoder also needs VICP/IMCOP buffers as scratch buffer for frame processing. This is also for speed optimization. Hence, you cannot run MJCP and HDVICP at the same time. They can indeed be used in frame interleaved manner.

    This also means that you need to have VICP/MJCP clocked ON (TCM automatically gets power when main ARM is booted) before running H.264 codec. I believe EDMA is also clocked ON.

    regards

    Yashwant

  • This problem was solved. The HDVICP code was not recompiled. Closing this thread.

    regards

    YD