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 and H264 playback

I have a DM365 design and I am using the DVSDK_2_10_01_18 and the Montavista tools V5. My host runs Red Hat Linux 4.

 
 
 I have been having problems playing mpeg4 and h264 files. These are the davinci_effect.mpeg4 and h264 demo data files respectively that come with the DVSDK. When I start playing them I get the message "failed to decode video buffer data". Curiously it will play files I created with a DM355 EVM a while back. I have also tried using ffmpeg and adding the VOL header with no success. I didn't think it would work since I can't even play the demo files included in the DVSDK.
 
 I know and have confirmed that in the Rules.mak I have the PLATFORM=dm365 definition set correctly . I can build the DVSDK successfully. One thing I have noticed is that the codec_engine_2_24 is not part of the build from the top level directory. If I cd to where the Makefile is and start a make it complains that it's missing dm355 directories. This is probably correct since I am building for a dm365. I do make use of the mp4dec.a library that is included in this directory to satisfy the calls from the algorithm tables I have included at the end of this email.
 
 
 My code successfully opens the codec engine and the decoder as in Engine_open() and Vdec2_create(), Videc_setBufTab(). The Loader is being created with the proper attributes and buffer sizes by calling Vdec2_getInBufSize() and then opening the loader. All of this is confirmed by the fact that the MPEG4 files created with a DM355 play. I have various MPEG4 files of different view and length sizes. From full 726x576 to 320x240 , etc.
 The problem occurs during priming when I call Vdec2_process() which returns a -1 and prints on the console failure deciding buffer data.
 
 The fact that it plays old DM355 files seems to point to some configuration problem with the codecs, but everything I seem to look for is correctly set up. I would appreciate if you could give me some clue or if you want me to capture more data or give you any other information.
 
 Thank you in advance for any help
 
 
 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static Engine_AlgDesc engineAlgs0[] = {

#if NEVER

{

(String)"h264dec", /* name */

{2701911697U}, /* uuid */

&H264VDEC_TI_IH264VDEC, /* fxns */

NULL, /* idma3Fxns */

typeTab_H264VDEC_TI_IH264VDEC, /* typeTab */

TRUE, /* isLocal */

1, /* groupId */

0, /* protocol */

&H264VDEC_TI_IRES, /* iresFxns */

&ti_sdo_codecs_h264dec_ce_H264DEC_codecClassConfig /* stub/skel config params */

},

#endif

{

(String)"mpeg4dec", /* name */

{3351107257U}, /* uuid */

&MP4VDEC_TI_IMP4VDEC, /* fxns */

NULL, /* idma3Fxns */

typeTab_MP4VDEC_TI_IMP4VDEC, /* typeTab */

TRUE, /* isLocal */

1, /* groupId */

0, /* protocol */

&MP4VDEC_TI_IRES, /* iresFxns */

&ti_sdo_codecs_mpeg4dec_ce_MPEG4DEC_codecClassConfig /* stub/skel config params */

},

{

"jpegdec", /* name */

{1183555817U}, /* uuid */

&JPEGDEC_TI_IJPEGDEC, /* fxns */

NULL, /* idma3Fxns */

typeTab_JPEGDEC_TI_IJPEGDEC, /* typeTab */

TRUE, /* isLocal */

1, /* groupId */

0, /* protocol */

&JPEGDEC_TI_IRES, /* iresFxns */

&ti_sdo_codecs_jpegdec_ce_JPEGDEC_codecClassConfig /* stub/skel config params */

},

{NULL},

};

static Engine_AlgDesc engineAlgs1[] = {

{NULL},

};

 

  • Hi,

    Can you send us the error code which you are getting from the process call ? You say that you see this behaviois for both Mpeg4 and H.264, pls send the error codes for both the codecs. Trace log with CE_DEBUG = 3 will also be helpful.

    regards

    Yashwwnt

  • Video event file /mnt/VMmedia/mpegs/00000049.m4v
    Video event coord x=0 y=0
    @0x00a44fa1:[T:0x41e31490] ti.sdo.dmai - [Vdec2] Video decoder instance created
    @0x00a451b3:[T:0x41e31490] ti.sdo.dmai - [Vdec2] Made XDM_SETPARAMS control call

    @0x00a45373:[T:0x41e31490] ti.sdo.dmai - [Vdec2] Made XDM_GETBUFINFO control cal
    l
    @0x00a454c9:[T:0x41e31490] ti.sdo.dmai - [BufTab] Allocating BufTab for 18 buffe
    rs
    @0x00a57343:[T:0x41e31490] ti.sdo.dmai - [Vdec2] Video decoder instance created
    @0x00a57535:[T:0x41e31490] ti.sdo.dmai - [Vdec2] Made XDM_SETPARAMS control call

    @0x00a576e7:[T:0x41e31490] ti.sdo.dmai - [Vdec2] Made XDM_GETBUFINFO control cal
    l
    @0x00a577fe:[T:0x41e31490] ti.sdo.dmai - [Loader] Creating Loader for /mnt/VMmed
    ia/mpegs/00000049.m4v with buffer size 2258880, window size 829440, alignment -1

    @0x00a6c5f1:[T:0x41e31490] ti.sdo.dmai - [Vdec2] VIDDEC2_process() ret -1 inId 0
     inUse 0 consumed 14
    @0x00a6c709:[T:0x41e31490] ti.sdo.dmai - [Vdec2] VIDDEC2_process() failed with e
    rror (-1 ext: 0x8801)
    Failed to decode video buffer

  • Manuel,

    Please remember that the dm365 mpeg4 is not a universal decoder, and will not be able to decode all mpeg4 streams.

    The dm365 mpeg4_hdvicp decoder is universal and will be able to decode all mpeg4 streams.

    I have seen the behavior you describe when I tried to decode some mpeg4 streams with the mpeg4 decoder. The problem was solved when I used the mpeg4_hdvicp decoder

    Thanks

    cesar

  • How do I use that codec?

    The Engine_AlgDesc engineAlgs0 that I show earlier in the post describes the actual algorithm used

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    (String)"mpeg4dec", /* name */

    {3351107257U}, /* uuid */

    &MP4VDEC_TI_IMP4VDEC, /* fxns */

    NULL, /* idma3Fxns */

    typeTab_MP4VDEC_TI_IMP4VDEC, /* typeTab */

    TRUE, /* isLocal */

    1, /* groupId */

    0, /* protocol */

    &MP4VDEC_TI_IRES, /* iresFxns */

    &ti_sdo_codecs_mpeg4dec_ce_MPEG4DEC_codecClassConfig /* stub/skel config params */

    },

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    Do I have to do anything special when building the DVSDK?

    Thanks for your help

  • Thanks for the help

    I installed all the files and recompiled the DVSDK with no errors. When I try to run the decode application I get the errors shown below


    I use the loadmodules_hd.sh that comes with the DVSDK as follows
    #!/bin/sh
    rmmod
    cmemk 2>/dev/null
    rmmod
     irqk 2>/dev/null
    rmmod
    edmak 2>/dev/null
    rmmod
    dm365mmap 2>/dev/null


    # Pools configuration
    ins
    mod cmemk.ko phys_start=0x85000000 phys_end=0x88000000
    pools=6x4096,2x8192,1x11908,2x13184,1x2697152,6x4096,1x30720,3x81920,1x3185664,64x56,1x320,1x640,1x81920,1x6650880,2x608,1x296,1x28,2x24,23x1548288,1x154288 allowOverlap=1 phys_start_1=0x00001000 phys_end_1=0x00008000 pools_1=1x28672


    insmod irqk.ko

    insmod edmak.ko

    insmod dm365mmap.ko


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    The output when I run the loadmodules_hd.sh

    # ./loadmodules_hd.sh
    irqk unregistered
    CMEMK module: built on Mar 31 2010 at 13:21:19
      Reference Linux version 2.6.18
      File /home/MannyG/dvsdk_2_10_01_18/linuxutils_2_24_02/packages/ti/sdo/linuxuti
    ls/cmem/src/module/cmemk.c
    ioremap_nocache(0x84000000, 67108864)=0xc5000000
    allocated heap buffer 0xc5000000 of size 0x1134000
    cmem initialized 20 pools between 0x84000000 and 0x88000000
    CMEM Range Overlaps Kernel Physical - allowing overlap
    CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x83c00000)
    ioremap_nocache(0x1000, 28672)=0xc4040000
    no remaining memory for heap, no heap created for memory block 1
    cmem initialized 1 pools between 0x1000 and 0x8000
    IRQK module: built on Mar 31 2010 at 13:34:20
      Reference Linux version 2.6.18
      File /home/MannyG/dvsdk_2_10_01_18/linuxutils_2_24_02/packages/ti/sdo/linuxuti
    ls/irq/src/module/irqk.c
    irqk initialized
    EDMAK module: built on Mar 31 2010 at 13:33:11
      Reference Linux version 2.6.18
      File /home/MannyG/dvsdk_2_10_01_18/linuxutils_2_24_02/packages/ti/sdo/linuxuti
    ls/edma/src/module/edmak.c
    mknod: /dev/ttyS0: File exists
    #

     

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    This is the consol output when I set CE_DEBUG=3

    @2,879,912us: [+0 T:0x41e32490 S:0x41e31cec] CE - Engine_open> Enter('decode', 0x0, 0x41e31d5c)
    @2,880,171us: [+0 T:0x41e32490 S:0x41e31cd4] OM - Memory_alloc> Enter(0x2c)
    @2,880,370us: [+0 T:0x41e32490 S:0x41e31cd4] OM - Memory_alloc> return (0x161278)
    @2,880,554us: [+0 T:0x41e32490 S:0x41e31cec] CE - Engine_open> return(1446520)
    @2,888,452us: [+0 T:0x41e32490 S:0x41e31c34] ti.sdo.ce.video2.VIDDEC2 - VIDDEC2_create> Enter (engine=0x161278, name='mpeg4hddec', params=0x15f474)
    @2,889,290us: [+0 T:0x41e32490 S:0x41e31c04] CV - VISA_create(0x161278, 'mpeg4hddec', 0x15f474, 0x2484, 'ti.sdo.ce.video2.IVIDDEC2')
    @2,889,705us: [+0 T:0x41e32490 S:0x41e31b04] CV - VISA_create2(0x161278, 'mpeg4hddec', 0x15f474, 0x1c, 0x2484, 'ti.sdo.ce.video2.IVIDDEC2')
    @2,890,058us: [+0 T:0x41e32490 S:0x41e31aec] OM - Memory_alloc> Enter(0x30)
    @2,890,279us: [+0 T:0x41e32490 S:0x41e31aec] OM - Memory_alloc> return (0x161508)
    @2,890,447us: [+0 T:0x41e32490 S:0x41e31ac4] ti.sdo.ce.alg.Algorithm - Algorithm_create> Enter(fxns=0x15552c, idma3Fxns=0x0, iresFxns=0x155588, params=0x15f474, attrs=0x41e31bf4)
    @2,890,635us: [+0 T:0x41e32490 S:0x41e31aac] OM - Memory_alloc> Enter(0x10)
    @2,890,795us: [+0 T:0x41e32490 S:0x41e31aac] OM - Memory_alloc> return (0x161540)
    @2,890,950us: [+0 T:0x41e32490 S:0x41e31a7c] ti.sdo.ce.alg - ALG_create> Enter (scratchId=1, fxns=0x15552c, parentAlg=0x0, params=0x15f474)
    @2,898,839us: [+2 T:0x41e32490 S:0x41e31a7c] ti.sdo.ce.alg - ALG_create> algNumAlloc 18 memory recs

     

    >>>> THE ERROR


    @2,899,760us: [+7 T:0x41e32490 S:0x41e31ac4] ti.sdo.ce.alg.Algorithm - Algorithm_create> Algorithm creation FAILED; make sure that 1) alg params are correct/appropriate, 2) there is enough internal and external algorithm memory available -- check DSKT2 settings for heap assignments and scratch allocation

     

    >>>>
    @2,900,042us: [+0 T:0x41e32490 S:0x41e31aac] ti.sdo.ce.alg.Algorithm - Algorithm_delete> Enter(alg=0x161540)
    @2,900,228us: [+0 T:0x41e32490 S:0x41e31a8c] OM - Memory_free> Enter(0x161540, 0x10)
    @2,900,521us: [+0 T:0x41e32490 S:0x41e31a8c] OM - Memory_free> return (0x1)
    @2,900,756us: [+0 T:0x41e32490 S:0x41e31ac4] ti.sdo.ce.alg.Algorithm - Algorithm_delete> Exit
    @2,900,926us: [+0 T:0x41e32490 S:0x41e31ac4] ti.sdo.ce.alg.Algorithm - Algorithm_create> return (0x0)
    @2,901,092us: [+2 T:0x41e32490 S:0x41e31b04] CV - VISA_create2> FAILED to create local codec.
    @2,901,256us: [+0 T:0x41e32490 S:0x41e31adc] CV - VISA_delete(0x161508)
    @2,901,403us: [+5 T:0x41e32490 S:0x41e31adc] CV - VISA_delete> deleting codec (localQueue=0xffff, remoteQueue=0xffff)
    @2,901,568us: [+0 T:0x41e32490 S:0x41e31abc] OM - Memory_free> Enter(0x161508, 0x30)
    @2,901,728us: [+0 T:0x41e32490 S:0x41e31abc] OM - Memory_free> return (0x1)
    @3,233,654us: [+0 T:0x41e32490 S:0x41e31c34] ti.sdo.ce.video2.VIDDEC2 - VIDDEC2create> return (0x0)
    @3,233,891us: [+7 T:0x41e32490 S:0x41e31c5c] ti.sdo.dmai - [Vdec2] Failed to open video decode algorithm
    ERROR:Failed to create video decoder: mpeg4hddec
    @3,234,166us: [+0 T:0x41e32490 S:0x41e31d2c] CE - Engine_close(0x161278)
    @3,234,347us: [+0 T:0x41e32490 S:0x41e31d2c] OM - Memory_free> Enter(0x161278, 0
    x2c)
    @3,234,518us: [+0 T:0x41e32490 S:0x41e31d2c] OM - Memory_free> return (0x1)

    Thanks again for the help