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.

Need help understanding differences between working codecs and codec examples

Other Parts Discussed in Thread: OMAP3530

I am struggling through the documentation for various aspects of Codec Engine.  So far, I can't explain something that I've noticed. 

I'm using TI DVSDK 4_03_00_6.  There is a codec server that gets build from:

ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00/packages/ti/sdo/server/cs

Looking at codec.cfg, there are parameters set for each codec:

   var C6ACCEL = xdc.useModule('ti.c6accel.ce.C6ACCEL');

        C6ACCEL.serverFxns = "UNIVERSAL_SKEL";
        C6ACCEL.stubFxns = "UNIVERSAL_STUBS";
        C6ACCEL.useCache = false;
        C6ACCEL.alg.watermark = false;
        C6ACCEL.alg.codeSection = codeSection;
        C6ACCEL.alg.udataSection = udataSection;
        C6ACCEL.alg.dataSection = dataSection;

    var AACHEDEC = xdc.useModule('ti.sdo.codecs.aachedec.ce.AACHEDEC');

        AACHEDEC.serverFxns = "AUDDEC1_SKEL";
        AACHEDEC.stubFxns = "AUDDEC1_STUBS";
        AACHEDEC.useCache = false;
        AACHEDEC.alg.watermark = false;
        AACHEDEC.alg.codeSection = codeSection;
        AACHEDEC.alg.udataSection = udataSection;
        AACHEDEC.alg.dataSection = dataSection;

and so on...


Looking at the codec engine examples, however, the codec server config file

ti-dvsdk-4_03_00_06/codec-engine_2_26_02_11/examples/ti/sdo/ce/examples/servers/all_codecs/all.cfg doesn't have any of the configuration lines (as shown):
var VIDDEC_COPY =
    xdc.useModule('ti.sdo.ce.examples.codecs.viddec_copy.VIDDEC_COPY');
var VIDENC_COPY =
    xdc.useModule('ti.sdo.ce.examples.codecs.videnc_copy.VIDENC_COPY');
var SPHENC_COPY =
    xdc.useModule('ti.sdo.ce.examples.codecs.sphenc_copy.SPHENC_COPY');
var SPHDEC_COPY =
    xdc.useModule('ti.sdo.ce.examples.codecs.sphdec_copy.SPHDEC_COPY');
var IMGDEC_COPY =
    xdc.useModule('ti.sdo.ce.examples.codecs.imgdec_copy.IMGDEC_COPY');
var IMGENC_COPY =
    xdc.useModule('ti.sdo.ce.examples.codecs.imgenc_copy.IMGENC_COPY');
var AUDDEC_COPY =
    xdc.useModule('ti.sdo.ce.examples.codecs.auddec_copy.AUDDEC_COPY');
var AUDENC_COPY =
    xdc.useModule('ti.sdo.ce.examples.codecs.audenc_copy.AUDENC_COPY');

var SCALE       = xdc.useModule('ti.sdo.ce.examples.codecs.scale.SCALE_TI');

var VIDDEC2_COPY =
    xdc.useModule('ti.sdo.ce.examples.codecs.viddec2_copy.VIDDEC2_COPY');



Why does the one codec server configuration differ in this way from the other?  What document describes where the codec server in the examples folder gets its codec configuration information from if it's not specified in all.cfg?

Thanks!

Rich

  • I should have spelled out my goal. As an exercise, I want to take the SCALE algorithm from the codec engine examples folder and place that with the rest of the production codecs (h264 and JPEG) that are included with the codec server built in the codecs-omap3530 folder.

    Does this entail re-writing most of the packaging/build-script information because the path has changed. I've noticed that I can't just drop the scale folder into the codecs folder and add a reference to it in the codec.cfg file.
  • Richard von Lehe58975 said:
    Does this entail re-writing most of the packaging/build-script information because the path has changed. I've noticed that I can't just drop the scale folder into the codecs folder and add a reference to it in the codec.cfg file.

    You need to change the package name in the package.xdc file to match its filesystem pathname.  For instance, the video2 package in Codec Engine is in the directory <ce>/packages/ti/sdo/ce/video2, and its package name in package.xdc is:
        package ti.sdo.ce.video2 [1, 0, 3] {
    Here, the package name ti.sdo.ce.video2 matches its path below the <ce>/packages directory.

    So if you move the SCALE directory to another location you will need to change the package name in package.xdc to reflect that new location.

    Stay tuned for a response to your initial post in this thread...

    Regards,

    - Rob

  • Richard von Lehe58975 said:

    Why does the one codec server configuration differ in this way from the other?

    The Codec Engine example codecs have some configuration settings within the codec module file itself.  For instance, the VIDDEC2 codec sets its 'serverFxns' & 'stubFxns' within the file <ipc>/packages/ti/sdo/ce/video2/IVIDDEC2.xdc:
    metaonly interface IVIDDEC2 inherits ti.sdo.ce.ICodec
    {
        override config String serverFxns = "VIDDEC2_SKEL";
        override config String stubFxns = "VIDDEC2_STUBS";

    I don't know if the AACHEDEC & C6ACCEL modules set default values for serverFxns/stubFxns, and even if they do it's OK to set them again but not at all necessary.

    Futher, a module can also have a <modulename>.xs file in its package directory, and scripting in that file can set module member values.

    So, to summarize, module config parameters:
        - can have default values
        - might get assigned in the <modulename>.xs file
        - certain ones must be set by an application
    and you need to consult the Package Reference to find out details about packages and a package's modules.

    Richard von Lehe58975 said:
       var AACHEDEC = xdc.useModule('ti.sdo.codecs.aachedec.ce.AACHEDEC');

            AACHEDEC.serverFxns = "AUDDEC1_SKEL";
            AACHEDEC.stubFxns = "AUDDEC1_STUBS";
            AACHEDEC.useCache = false;
            AACHEDEC.alg.watermark = false;
            AACHEDEC.alg.codeSection = codeSection;
            AACHEDEC.alg.udataSection = udataSection;
            AACHEDEC.alg.dataSection = dataSection;

    In this snippet, 'serverFxns'/'stubFxns'/'useCache' are all part of the base ICodec module, from which every codec inherits.  The 'alg' submember of AACHEDEC is most likely declared as a ti.sdo.codecs.aachedec.AACHEDEC.Module type, where the AACHEDEC module contains the members 'watermark'/'codeSection'/'udataSection'/'dataSection'.

    Richard von Lehe58975 said:
    What document describes where the codec server in the examples folder gets its codec configuration information from if it's not specified in all.cfg?

    The Codec Engine release notes contains a Documentation section that contains a link to the "Package Reference Guide".  Clicking that link takes you to an xdoc index containing, in part:

    requires ti.sdo.ce.video3
    Clicking on ti.sdo.ce.video2 shows the following:
    package ti.sdo.ce.video2 [1, 0, 3] {
     
        interface IVIDDEC2;
        // IVIDDEC2-compliant video decoder interface
        interface IVIDENC2;
        // IVIDENC2-compliant video encoder interface
        module VIDDEC2Config;
        module VIDENC2Config;
    }
    and clicking on IVIDDEC2 shows, among other things, this:
        override config String serverFxns = "VIDDEC2_SKEL";
        override config String stubFxns = "VIDDEC2_STUBS";
        config Bool useCache;
        config Int uuid;
     
    Keep clicking highlighted links to show you further details of things in this Package Reference Guide.
     
    Regards,
     
    - Rob
  • Rob,


    Thanks!  This is exactly what I was looking for.

  • It looks like there's some hierarchy that scale depends on that would need to move as well.

    I created a new extensions folder int he omap3530 tree and copied the extensions/scale subfolder into it and updated paths in extensions/scale/package.xdc. But this is unraveling quickly since there are a lot of includes in extensions/scale/scale.c that aren't being found.

    My mental model of how this works is still incomplete. I am seeing codecs/scale as an implementation(concrete class) of extensions/scale. I get this because extensions/scale/package.xdc declare interface ISCALE that SCALE_TI implements. This must be incorrect, because extensions scale is something that can (and must?) be built. In other words, it's not a pure base class or interface? I'm not sure just how much ce/examples/scale is dependent on and until I know that, I'll just be copying folders one by one trial and error.

    I'm going to go back to the algorithm creator's guide and the server integrator's guide and see if there is anything that describes the extensions concept. If you have any more advice, I appreciate it.
  • Rob - when you described the moving of the package over, were you referring to the release package? I'm thinking that's what I missed.

    Would the process for me go something like:

    * Modify/build SCALE in the codec examples source tree
    * Debug it using the example codec server
    * Build SCALE release version
    * Copy the release package to the omap3530 folder with the rest of the production codecs
    * Re-build the production codec server

    ?
  • Maybe I can provide a little background and steer you toward a better solution.

    Codec Engine was built to be extendable to user-defined algorithm interfaces.  An example of that is the scale example you've been fighting with.  That shows how to create your own extension for your own proprietary interface, and then provide your own stubs and skeletons to make that interface 'remotable'.

    After some time, we realized that the support cost of that model was high - this thread demonstrates the pain quite well... thanks for that.  ;)  So we created the IUNIVERSAL interface.  IUNIVERSAL is intended to be extended, but provides enough of the framework 'in the box' so users don't have to implement anything more than the actual codec.  Here are some details:

        http://processors.wiki.ti.com/index.php/Getting_started_with_IUNIVERSAL

    While the 'scale' model does work, and is in fact how we continue to add new interfaces like IVIDDEC3 and IVIDENC2, we strongly steer users toward IUNIVERSAL when possible as it's much easier to stomach, and the stubs/skeletons are provided out of the box.

    Chris

  • No intention to cause pain. You must excuse me as I'm new to codec engine..
  • Thanks, Chris for the IUNIVERSAL link. That does help and I have played with those wizards. But I still need some help with my original question.

    Keep in mind that I am working from a production system that already has a codec server using h264 and jpeg codecs in working products. I would rather not have to regenerate a new codec server if I don't have to. With that in mind, I still need to be able to move whatever new algorithm I create into the appropriate folder and of course modify the package.xdc file to match the new path that the algorithm will be moved to.

    I'm getting confused about two things:

    1) The production codecs that we already use have multiple xdc files. For example:
    rich@rich-VM:~/gemini/ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00/packages/ti/sdo/codecs/jpegdec$ find -iname '*.xdc'
    ./package.xdc
    ./JPEGDEC.xdc
    ./ce/package.xdc
    ./ce/JPEGDEC.xdc

    I can tell by looking at the codec.cfg file that the codec server uses the one from the 'ce' folder. So what are the other xdc files for? Understanding this might help me with #2.

    2) I used the wizard to generate a new codec/algorithm called test_alg. I can't seem to find the correct modification to the test_alg/package.xdc and the server's codec.cfg to allow the codec server to link it in with the other codecs. I had the wizard put the new algorithm here:
    ~/temp/test_alg/fluke/test_alg

    I then did:
    cp -r ~/temp/test_alg/fluke/test_alg ~/gemini/ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00/packages/ti/sdo/codecs/

    Then I modify ~/gemini/ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00/packages/ti/sdo/codecs/package.xdc

    to that the line that was:

    package fluke.test_alg [1, 0, 0] {
    module TEST_ALG;
    }

    becomes:

    package ti.sdo.codecs.test_alg [1, 0, 0] {
    module TEST_ALG;
    }

    I also edit codecs-omap3530_4_02_00_00/packages/ti/sdo/server/cs/codec.cfg

    to add these lines in the appropriate sections:

    var TEST_ALG = xdc.useModule('ti.sdo.codecs.TEST_ALG');

    Server.algs = [
    {name: "test_alg", mod: TEST_ALG, threadAttrs: {
    stackMemId: 0, priority: Server.MINPRI + 1}
    },

    and then do a 'make codecs' from ~/gemini/ti-dvsdk-4_03_00_06

    I get :

    js: "./codec.cfg", line 10: XDCException: xdc.PACKAGE_NOT_FOUND: can't locate the package 'ti.sdo.codecs' along the path: '/home/rich/gemini/ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00;/home/rich/gemini/ti-dvsdk-4_03_00_06/c6accel_1_01_00_07/soc/packages;/home/rich/gemini/ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00/packages;/home/rich/gemini/ti-dvsdk-4_03_00_06/xdais_6_26_01_03/packages;/home/rich/gemini/ti-dvsdk-4_03_00_06/framework-components_2_26_00_01/packages;/home/rich/gemini/ti-dvsdk-4_03_00_06/framework-components_2_26_00_01/fctools/packages;/home/rich/gemini/ti-dvsdk-4_03_00_06/dspbios_5_41_03_17/packages;/home/rich/gemini/ti-dvsdk-4_03_00_06/biosutils_1_02_02/packages;/home/rich/gemini/ti-dvsdk-4_03_00_06/linuxutils_2_26_02_05/packages;/home/rich/gemini/ti-dvsdk-4_03_00_06/dsplink_1_65_01_05_eng/packages;/home/rich/gemini/ti-dvsdk-4_03_00_06/dsplink_1_65_01_05_eng;/home/rich/gemini/buildroot/fluke/packages/ti-dvsdk/codec-engine_2_26_02_11/packages;/home/rich/gemini/buildroot/fluke/packages/ti-dvsdk/codec-engine_2_26_02_11/cetools/packages;/home/rich/gemini/ti-dvsdk-4_03_00_06/xdctools_3_16_03_36/packages;../../../..;'. Ensure that the package path is set correctly.
    "./server.cfg", line 54
    "./package/cfg/bin/cs_x64P.cfg", line 774
    "./package/cfg/bin/cs_x64P.cfg", line 733
    gmake[1]: *** [package/cfg/bin/cs_x64P.xdl] Error 1
    gmake[1]: *** [package/cfg/bin/cs_x64P.xdl] Deleting file `package/cfg/bin/cs_x64Pcfg.cmd'
    gmake[1]: *** [package/cfg/bin/cs_x64P.xdl] Deleting file `package/cfg/bin/cs_x64Pcfg_c.c'
    gmake[1]: *** [package/cfg/bin/cs_x64P.xdl] Deleting file `package/cfg/bin/cs_x64Pcfg.s62'
    gmake: *** [packages/ti/sdo/server/cs,.executables] Error 2
    make[1]: *** [.all-packages] Error 2
    make[1]: Leaving directory `/home/rich/gemini/ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00'
    make: *** [codecs] Error 2
    rich@rich-VM:~/gemini/ti-dvsdk-4_03_00_06$

    which basically tells me I have messed something up in telling the server where the test_alg codec is. It's aggravating because it's seemingly such a simple thing to do.

    Can you spot what I've done wrong?

    Thanks,
    Rich
  • Just to head off the basic questions:

    * Line 10 in the error above is the line:
    var TEST_ALG = xdc.useModule('ti.sdo.codecs.TEST_ALG');

    * The codec server builds correctly when the test_alg (or scale or any other codec I've tried to add) is removed.
  • I think I'm moving forward again. I had the gencodec wizard place the codec directly in
    ~/gemini/ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00/packages/fluke/imagecor

    I ran 'make' on the codec, modified codecs.cfg, then did a 'make codecs' and the codec server build found it and finished compiling/linking. Now hopefully I can get on to the good stuff. I don't know why my first attempts failed. For now I can live with that mystery.

    Thanks
  • Richard von Lehe58975 said:
    rich@rich-VM:~/gemini/ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00/packages/ti/sdo/codecs/jpegdec$ find -iname '*.xdc'
    ./package.xdc
    ./JPEGDEC.xdc
    ./ce/package.xdc
    ./ce/JPEGDEC.xdc

    I can tell by looking at the codec.cfg file that the codec server uses the one from the 'ce' folder. So what are the other xdc files for? Understanding this might help me with #2.

    You can think of *.xdc files as things that declare an object.  In the case where the file name is explicitly "package.xdc", the file is declaring a _package_.  In the case where the base of the file name is something else (e.g. JPEGDEC.xdc) it's describing a _module_ (i.e. a JPEGDEC module) within a package.  Too many gory details here, but might help for background:

    In your case above those 4 .xdc files are actually describing 2 packages.

    1. The "ti.sdo.codecs.jpegdec" package (described by ti/sdo/codecs/jpegdec/package.xdc) which contains one module named "JPEGDEC" (described by ti/sdo/codecs/jpegdec/JPEGDEC.xdc)
    2. The "ti.sdo.codecs.jpegdec.ce" package (described by ti/sdo/codecs/jpegdec/ce/package.xdc) which contains one module which also happens to be named "JPEGDEC" (described by ti/sdo/codecs/jpegdec/ce/JPEGDEC.xdc)

    Richard von Lehe58975 said:
    I then did:
    cp -r ~/temp/test_alg/fluke/test_alg ~/gemini/ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00/packages/ti/sdo/codecs/

    Then I modify ~/gemini/ti-dvsdk-4_03_00_06/codecs-omap3530_4_02_00_00/packages/ti/sdo/codecs/package.xdc

    to that the line that was...

    Ok, what you did there probably wasn't quite right.  You copied a codec package (fluke.test_alg), into another existing package (ti.sdo.codecs).  What you probably meant to do (instead of merging those two packages) was rename the fluke.test_alg package to ti.sdo.codecs.test_alg.  (I'll tell you in a minute why this is probably generally a bad thing to do).  If that's what you wanted, you should have created a new directory (ti/sdo/codecs/test_alg), copied all the contents from fluke/test_alg into this new directory, change the declaration of the package to match the namespace (in ti/sdo/codecs/test_alg/package.xdc, change "package fluke.test_alg" to "package ti.sdo.codecs.test_alg") and rebuild your package (probably by running "make codecs").

    Here's why that's generally wrong:  exactly like Java, a package's namespace (and therefore its directory structure) should reflect the producer.  In TI's codecs, the namespace is typically "ti.sdo.codecs".  In the Codec Engine examples, it's "ti.sdo.ce.examples.codecs".  In your case (assuming your company is 'fluke', you may want to use 'fluke.codecs'.  That gives you a namespace to play in all to yourself, without risk of conflicting with anyone else.

    If I've convinced you to keep your own "fluke.codecs" namespace, you might recreate your "test_alg" codec as  "fluke.codecs.test_alg".

    Ok, on to integrating your new fluke.codecs.test_alg package...  Packages are found on the XDCPATH (very similar to how Java classes are found along Java's CLASSPATH).

    Your "fluke.codecs.test_alg" package will be found in the same way.  Two ideas come to mind - I tend to prefer #2 but either will work:

    1. Copy your new package into an existing "repository".  Although you may not have known it, that's what you were doing when moving your package files into the ti/sdo/codecs/ directory (though you didn't quite get it right).  The TI codecs' packages/ directory is already on your XDCPATH, so placing your package in a repository already on the XDCPATH means it'll be found for "free".
    2. Add the "repository/directory" which your "fluke.codecs.test_alg" package is in (which is the directory right above the "fluke" directory) to the XDCPATH.  Keeping your codecs in a separate repository from the TI codecs typically makes updating one or the other easier since you can just update the XDCPATH to point at new versions of them.

    I hope this helps get you further.

    Chris

  • Chris,

    I did exactly what you asked in #2 but am seeing some weirdness. I'm replying here because other questions I've posted to E2E aren't getting any responses.

    What I've noticed is that after creating a new repository with my codecs and adding that path to the XDCPATH, the cs.x64P DSP image appears to get the codecs I want. I can check this using nm6x and grepping for the codecs I've added. I can also see them in the auto-generated documentation (cs.x64P.DataSheet.html). Both of these show my codecs.

    After this, I carefully copy the cs.x64P to the exported-nfs folder where that file is supposed to be. When I run my (GPP-side) test app, which enumerates all codecs in the codec server, they fail to show up. Or only one of them shows up. It's quite confusing. What else needs to be touched/updated that I'm overlooking? It's not obvious to me, because my codec changes are encapsulated within that cs.x64P DSP image. When my app runs and makes the appropriate TI library calls (e.g. CERuntime_init, Engine_open, Engine_getNumAlgs, engine_GetAlgInfo), it should show the codecs that exist as shown using nm and the html doc, right? The call to Engine_getNumAlgs should load the DSP image afresh and query the list of codecs, correct?

    I hate to be a pain, but I feel I'm mostly over the hump in terms of getting to the point where I can just write code and not worry so much about the configuration management part of this. An little extra assistance here would really help.
  • Hi Richard,

    After your post I searched and found your posts yesterday in Code Composer Studio and OMAP forums, which might get you delayed responses due to volume of posts there. (I wasn't actively scanning those forums for example) I just replied to one with some additional questions.

    As for your post here, can you show your .cfg file where you should have a the xdc.useModule(...) for the specific codecs you are adding that are not showing up. Also making sure you are using the fully qualified codec package names that match the name in your codec.XDC file, and your XDC package path includes the new codec's package.

    It looks like you are getting pretty close, and hopefully things will de-mystify for you soon.
    Murat
  • Hi Murat - thanks for responding.  I apologize - I don't know which is the best forum to post these.  Maybe the embedded Linux forum is best?

    Here is my codec.cfg, which makes the useModule calls.  I also appended a new folder (codecs-custom/packages) to the XDCPATH to point to the location of my codec packages.

    # Set XDCPATH to contain necessary repositories.
    # Please do not modify anything below
    XDCPATH = $(CURDIR);$(C6ACCEL_INSTALL_DIR)/soc/packages;$(CODEC_INSTALL_DIR)/packages;$(XDAIS_INSTALL_DIR)/packages;$(FC_INSTALL_DIR)/packages;$(FC_INSTALL_DIR)/fctools/packages;$(BIOS_INSTALL_DIR)/packages;$(BIOSUTILS_INSTALL_DIR)/packages;$(CMEM_INSTALL_DIR)/packages;$(LINK_INSTALL_DIR)/packages;$(LINK_INSTALL_DIR);$(CE_INSTALL_DIR)/packages;$(CE_INSTALL_DIR)/cetools/packages;$(CODEC_INSTALL_DIR)/../codecs-custom/packages;

    Let me know if you spot anything. 

    2161.codec.cfg