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.

can't open codec that is listed by Engine_getAlgInfo

I'm attaching a basic modification to the universal_copy app.  I'm 8524.app.cppincluding app.cpp, since it's the only one that differs from the example code in the DVSDK.  You can see that I've added a section to cycle through and print all codecs the server has, then it tries to instantiate (i.e. UNIVERSAL_create) one of mine (imagecor).  Then as a sanity check it tries to open h264dec (VIDDEC_create).  Both fail, even though the codec server tells me they are there.  Help me spot the problem or give me a clue as to how to debug this. 

  • Here is the command-line execution output from the target:

    # ./codecs-test
    @0x0000c0c0:[T:0xb69ba000] ti.sdo.ce.examples.apps.universal_copy - main> ti.sdo.ce.examples.apps.universal_copy
    @0x0000f416:[T:0xb69ba000] ti.sdo.ce.examples.apps.universal_copy - App-> Application started.
    err from getNumAlgs: 0codecServer has 13 codecs
    algs[0]: name = imagecor typeTab = ti.sdo.ce.universal.IUNIVERSAL local = 0
    algs[1]: name = c6accel typeTab = ti.sdo.ce.universal.IUNIVERSAL local = 0
    algs[2]: name = aachedec typeTab = ti.sdo.ce.audio1.IAUDDEC1 local = 0
    algs[3]: name = i2p typeTab = ti.sdo.ce.universal.IUNIVERSAL local = 0
    algs[4]: name = g711dec typeTab = ti.sdo.ce.speech1.ISPHDEC1 local = 0
    algs[5]: name = g711enc typeTab = ti.sdo.ce.speech1.ISPHENC1 local = 0
    algs[6]: name = h264dec typeTab = ti.sdo.ce.video2.IVIDDEC2 local = 0
    algs[7]: name = h264enc typeTab = ti.sdo.ce.video1.IVIDENC1 local = 0
    algs[8]: name = jpegdec typeTab = ti.sdo.ce.image1.IIMGDEC1 local = 0
    algs[9]: name = jpegenc typeTab = ti.sdo.ce.image1.IIMGENC1 local = 0
    algs[10]: name = mpeg2dec typeTab = ti.sdo.ce.video2.IVIDDEC2 local = 0
    algs[11]: name = mpeg4dec typeTab = ti.sdo.ce.video2.IVIDDEC2 local = 0
    algs[12]: name = mpeg4enc typeTab = ti.sdo.ce.video1.IVIDENC1 local = 0
    App-> ERROR: can't open codec h264dec
    App-> ERROR: can't open codec imagecor
    @0x00044baa:[T:0xb69ba000] ti.sdo.ce.examples.apps.universal_copy - app done.
    #
  • OK, I can see why my 'sanity test' of trying to open h264dec failed. I used VIDDEC instead of VIDDEC2. That works now, but I still don't see how my UNIVERSAL_create() of imagecor fails.

  • Hi Richard,

    Is it possible that 'imagecor' is failing due to some issue with not having enough resources to allocate for your codec (e.g. running out of specified type of memory, etc.,)? It is hard to tell without additional trace from codec engine, or looking at just your app.

    Can you enable some additional trace out of Codec Engine? or excerpt the IALG (e.g. IALG::algAlloc and IALG::algInit) functions implemented by your IUNIVERSAL algo (imagecor). Since you are able link and run everything, you can probably temporarily sprinkle some trace and verify that these functions are getting called and returning expected resource descriptors (from 'algAlloc'), and their (algInit function is getting called, meaning CE has actually allocated the requested resources.)

    Murat
  • Hi Murat,

    I'm investigating how to get tracing from the DSP to ARM to work. Is TraceUtil the method to do this? I found a wiki page for SoC Analyzer, but see that it is not supported and in any case it just uses TraceUtil itself. I'm going to try to find info on how to just use TraceUtil, unless there is something else I should be using.

    As far as my codecs, I have done nothing to them other then create them using the gencodecwizard as described in the "getting started with IUNVERSAL" page
    ( processors.wiki.ti.com/.../Getting_started_with_IUNIVERSAL )
    Perhaps that's part of the problem? I haven't given any thought to whether they would conflict with each other having defaults for everything.
  • I was able to run this command on my target:

    # CE_DEBUG=2 ./codecs-test 2>&1 > outfile

    I'm attaching the output as a file. In this case, I'm trying to open a codec I've called 'huffman'.  It's really only the bare code from the gencodec wizard that performs a copy.

    Grepping for 'huffman' in the output I see:

    [DSP] @0,028,998tk: [+4 T:0x87c43214] OG -     package ti.sdo.ce.universal (/home/rich/gemini/ti-dvsdk-4_03_00_06/codec-engine_2_26_02_11/packages/ti/sdo/ce/universal/) [1, 0, 0]                                                                                                                                 
    [DSP] @0,029,074tk: [+4 T:0x87c43214] OG -     package fluke.codecs.huffman (/home/rich/gemini/buildroot/fluke/packages/ti-dvsdk/codecs-custom/packages/fluke/codecs/huffman/) [1, 0, 0]                                                                                                                           
    [DSP] @0,029,163tk: [+4 T:0x87c43214] OG -     package ti.c6accel.ce (/home/rich/gemini/ti-dvsdk-4_03_00_06/c6accel_1_01_00_07/soc/packages/ti/c6accel/ce/) [1, 0, 0]                                      

    and a little further:

    @0,524,827us: [+0 T:0xb69a6000] CE - Engine_fwriteTrace> returning count [2264]                                                                                                                                                                                                                                    
    @0,524,863us: [+2 T:0xb69a6000] CE - Engine_createNode> Returning 0x1a1a8                                                                                                                                                                                                                                          
    @0,524,970us: [+5 T:0xb69a6000] CV - VISA_create> remote codec created (name='h264dec', localQueueID=0x10001, remoteQueueID=0x0002)                                                                                                                                                                                
    @0,525,009us: [+0 T:0xb69a6000] ti.sdo.ce.video2.VIDDEC2 - VIDDEC2_create> return (0x1a160)                                                                                                                                                                                                                        
    @0,525,094us: [+0 T:0xb69a6000] ti.sdo.ce.universal.UNIVERSAL - UNIVERSAL_create> Enter (engine=0x19c38, name='huffman', params=0x0 (size=0x0))                                                                                                                                                                    
    @0,525,141us: [+0 T:0xb69a6000] CV - VISA_create(0x19c38, 'huffman', 0x0, 0x648, 'ti.sdo.ce.universal.IUNIVERSAL')                                                                                                                                                                                                 
    @0,525,174us: [+0 T:0xb69a6000] CV - VISA_create2(0x19c38, 'huffman', 0x0, 0x0, 0x648, 'ti.sdo.ce.universal.IUNIVERSAL')                                                                                                                                                                                           
    @0,525,244us: [+6 T:0xb69a6000] CE - Engine_getConstName> Unable to locate alg "huffman" (type "ti.sdo.ce.universal.IUNIVERSAL").                                                                                                                                                                                  
    @0,525,277us: [+6 T:0xb69a6000] CV - VISA_create2> Unable to locate alg "huffman".                                                                                                                                                                                                                                 
    @0,525,321us: [+0 T:0xb69a6000] CV - VISA_delete(0x0)                                                                                                                                                                                                                                                              
    @0,525,350us: [+0 T:0xb69a6000] ti.sdo.ce.universal.UNIVERSAL - UNIVERSAL_create> return (0x0)                                                                                                                                                                                                                     
    App-> ERROR: can't open codec huffman                                                                                                                                                                                                                                                                              
    @0,525,412us: [+0 T:0xb69a6000] CE - Engine_close(0x19c38)                                                                                                                                                                                                                                                         
    @0,525,579us: [+0 T:0xb69a6000] CE - Engine_fwriteTrace> returning count [0]                                                                                                                                                                                                                                       
    @0,525,654us: [+0 T:0xb69a6000] CS - Server_disconnectTrace('0x19c38', 0x0)                                                                   

    I'm still a bit confused about how to solve this, though.  The codec is getting found at link time when the codec server image is being built.  How can it not be found at runtime?

    8838.outfile.txt

  • Hi Richard,

    Can you check and make sure that you have listed "huffman" amongst your codecs listed in the codec engine server's algorithms?

    For example, do you have something like the following in your .cfg file? If not, can you try. Also you may refer to .

    ...
    var HUFFCODEC = xdc.useModule('fluke.codecs.HUFFMAN');

    Server.algs = [

      ...

      {name: "huffman", mod: HUFFCODEC, threadAttrs: {
          stackSize: 4096, stackMemId: 0, priority: Server.MINPRI + 1}
      },
      ...
    ];
  • Just to follow-up one more item to check is what you assign as the serverFxns and stubFxns for the HUFFMAN codec. E.g. do you have something like:,
    HUFFMAN.serverFxns = "UNIVERSAL_SKEL";
    HUFFMAN.stubFxns = "UNIVERSAL_STUBS";

    or an assignment to your codec's custom implementation of the serverFxns and stubFxns?
  • correction to my previous post, I meant HUFFCODEC instead of HUFFMAN (whatever var name you use for the HUFFMAN codec.) I think it should be clear anyway, but wanted to add clarity with the context of the earlier post.
  • I'm attaching my codec.cfg.  I added in the serverFxns and stubFxns lines for the HUFFMAN module.  It was already in the algs list.  After adding the lines:

            HUFFMAN.serverFxns = "UNIVERSAL_SKEL";
            HUFFMAN.stubFxns = "UNIVERSAL_STUBS";

    the error at run-time changed slightly to:

    @1,391,546us: [+0 T:0xb696d000] ti.sdo.ce.universal.UNIVERSAL - UNIVERSAL_create> Enter (engine=0x19c38, name='huffman', params=0x0 (size=0x0))
    @1,391,598us: [+0 T:0xb696d000] CV - VISA_create(0x19c38, 'huffman', 0x0, 0x648, 'ti.sdo.ce.universal.IUNIVERSAL')
    @1,391,636us: [+0 T:0xb696d000] CV - VISA_create2(0x19c38, 'huffman', 0x0, 0x0, 0x648, 'ti.sdo.ce.universal.IUNIVERSAL')
    @1,391,693us: [+6 T:0xb696d000] CV - VISA_create2> FAILED to get IALG functions.
    Check Engine configuration and module name of codec class (type arg).
    @1,391,751us: [+0 T:0xb696d000] CV - VISA_delete(0x0)
    @1,391,783us: [+0 T:0xb696d000] ti.sdo.ce.universal.UNIVERSAL - UNIVERSAL_create> return (0x0)
    App-> ERROR: can't open codec huffman
    @1,391,850us: [+0 T:0xb696d000] CE - Engine_close(0x19c38)

    2146.codec.cfg

  • If it helps, here is a file containing all of the symbols for the codec server image.  I ran nm6x on my image cs.x64P to get it.

    5807.cs.symbols.txt

  • Hi Richard,

    Looks like progress and now  your codec configuration is missing the IALG function assignment. From the map file you provided

    HUFFMAN_FLUKE_IALG

    is defined, so in your HUFFMAN.xdc file can you check and see if have something that looks like:

    metaonly module HUFFMAN

    inherits ti.sdo.ce.universal.IUNIVERSAL

    {

     . . .

      override readonly config String ialgFxns = "HUFFMAN_FLUKE_IALG";

    }

    additionally if the codec uses IDMA3, you must also specify the idma3Fxns vtable

    symbol’s name in this file. for IRES, similarly, iresFxns symbol name must be provided.

  • Thanks, Murat.

    I've just checked now and see that the wizard did create that line automatically in my packages/fluke/codecs/huffman/HUFFMAN.xdc:

    /*!
     *  ======== HUFFMAN ========
     *  HUFFMAN codec specification
     *
     *  This file specifies information necessary to integrate with the Codec
     *  Engine.
     *
     */
    metaonly module HUFFMAN inherits ti.sdo.ce.universal.IUNIVERSAL
    {
        /*!
         *  ======== ialgFxns ========
         *  name of this algorithm's xDAIS alg fxn table
         */
        override readonly config String ialgFxns = "HUFFMAN_FLUKE_IHUFFMAN";
    }

    This doesn't seem to be the problem.  Can you offer me any more suggestions?

    Thanks!

  • Rich: glad the problem is resolved, and no worries about needing help, looks like you are building a complex system and it is party of the process.