Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Creating and Building codec combos in Windows

From Texas Instruments Wiki
Jump to: navigation, search

Introduction

It is a common misconception that Codec Servers/Combos can only be created and built in Linux. In fairness it's easy to see how one arrives at such a conclusion since: -

  • the majority of the collateral is focused on Linux
  • the current codec combos in the DVSDK ship DVTB prebuilt Linux binaries (a bug has been filed to remove these)

This topic describes how to create and build codec combos in a Windows environment.


Audio / Video Use-case

Let's say we want to build a codec combo with MPEG4 decode and AAC HE decode. We obtained the following 2 packages: -

  • omap3530_mpeg4dec_2_00_008_evaluation - MPEG4 decode v2.00.008 evaluation codec implementing IVIDDEC2, validated on OMAP3530 but works on any c64+ platform
  • dm6446_aachedec_1_30_002_evaluation - AAC HE decode v1.30.002 evaluation codec implementing IAUDDEC1, validated on DM6446 but works on any c64+ platform

Both of these have already been wrapped with the Codec RTSC Package Wizard.


Using the GenServer combo wizard

We now want to create an Audio/Video codec combo.

To do this we leverage the Codec Engine GenServer Wizard. As per the FAQ this tool is available only in CE >= 2.22. As recommended we download the 'full' Codec Engine. This is extremely useful because it contains the right versions of all the sub-dependent components. It also makes setting the XDCPATH easier.

In this example, we downloaded CE 2.22. The CE release notes tell us that we also need >= DSP/BIOS 5.33.03 and >= XDCtools 3.10.03 - so we download these too.

We then set up our XDCPATH to contain: -

    • the repository containing our MPEG4 and AAC HE decode codec packages
    • codec_engine_2_22/packages
    • codec_engine_2_22/cetools/packages
    • bios_5_33_03/packages

On Windows this equates to: -

set XDCPATH=C:\win_codec_combos\dm6446_aachedec_1_30_002_evaluation\packages;C:\win_codec_combos\omap3530_mpeg4dec_2_00_008_evaluation\packages;C:\codec_engine_2_22\packages;C:\codec_engine_2_22\cetools\packages;C:\xdctools_3_10_03\packages;C:\bios_5_33_03\packages

Next we instantiate the Combo Wizard via: -

C:\xdctools_3_10_03\xs.exe ti.sdo.ce.wizards.genserver

We fill in the following fields in Step 1: -

Combo wiz av ScreenShot047.jpg

The defaults in Step 2 are fine - this sets e.g. the priority of the audio and video algorithms. We leave these alone.

Combo wiz step2 ScreenShot048.jpg

Upon completion the wizard tells us we need to fill in the memory assignments in server\av_combo\codec.cfg - this is because the wizard cant know which memory types you want to assign the config sections to.

Hence we edit codec.cfg as follows: -

                AACHEDEC.alg.watermark = true;
                AACHEDEC.alg.codeSection = 'DDR2';
                AACHEDEC.alg.udataSection = 'DDR2';
                AACHEDEC.alg.dataSection = 'DDR2';
 
...
 
                MPEG4DEC.alg.watermark = true;
                MPEG4DEC.alg.codeSection = 'DDR2';
                MPEG4DEC.alg.udataSection = 'DDR2';
                MPEG4DEC.alg.dataSection = 'DDR2';

Building the combo from the command line

First we create a simple config.bld to point to our Codegen Tools and Platform. We place it in the av_combo\packages directory since we already have that in our XDCPATH (1 less path to add)

/*
 *  ======== config.bld ========
 * User note: YOU MUST MODIFY THIS FILE TO SPECIFY THE COMPILER TOOL PATHS.
 *
 * Edit this file to specify compiler toolchain paths, and any custom
 * compiler/linker options.
 */
 
/* location of your C6000 codegen tools */
var C64P = xdc.useModule('ti.targets.C64P');
 
/* location of your CG tools */
var codegen = "" + java.lang.System.getenv("CODEGEN_INSTALL_DIR");
C64P.platform = "ti.platforms.evm3530";
 
/* Verify that CODEGEN_INSTALL_DIR was set as an environment variable */
if (codegen=="null" || codegen=="") {
    print("Warning: TI Code Generation Tools not found. Verify that "
        + "CODEGEN_INSTALL_DIR is set correctly in the Makefile.");
} else if ( !java.io.File( codegen ).isDirectory() ) {
    print("Warning: CODEGEN_INSTALL_DIR is not set to a valid directory.");
}
C64P.rootDir = codegen;
 
 
/*
 *  ======== Build.targets ========
 * list of targets (ISAs + compilers) to build for
 */
Build.targets = [
    C64P,
];

We can then use the XDCPATH that we previously set at the command line and then invoke 'xdc' directly upon the generated server to build it.

set CODEGEN_INSTALL_DIR=c:\CCStudio_v3.3\C6000\cgtools
c:\xdctools_3_10_03\xdc.exe -PR .

Building the combo via a Makefile

It gets tiring to keep setting a long XDCPATH. Hence you could create a simple Makefile. Here we pattern after the DVSDK style i.e. a simple Makefile that invokes 'xdc' and leverages a base Rules.make with all the tool settings.

Makefile: -

#
#  ======== Makefile ========
#  This makefile is optional - you can use all of it or none of it.
#  Its purpose is to save time/typing when used from the context of the DVSDK.
#  All of the paths are preset in the $(DVSDK_INSTALL_DIR)/Rules.make. The wizards
#  (particularly the server wizard) requires many of these paths hence by setting
#  the XDCPATH here we save the user some typing and package-path setup.
#  Commands (make goals): -
#  - Start the codec packaging wizard
#  [>] make genpackage
#  - Start the server wizard
#  [>] make genserver
#  - Clean the codecs/server packages
#  [>] make clean
#  - Build the codecs/server packages
#  [>] make
#  - Release the codecs/server packages (generate tarballs)
#  [>] make release
#  Note : if your codec/server packages are in a different location outside
#  the DVSDK simply override the CODEC_INSTALL_DIR on the cmd line via e.g.
#  [>] make CODEC_INSTALL_DIR="/home/user/mycodecs"
#  Note : if your codecs come from different vendors you can do: -
#  [>] make CODEC_INSTALL_DIR="/home/user/ven1/codecs/packages;/home/user/ven2/codecs"
#  Note : if using the wizard standalone outside of the DVSDK you can still
#  leverage this makefile by modifying the include Import Tools Path below
#  to point to your DVSDK Rules.make
#
 
# Import Tools Path from Rules.make
-include ../Rules.make
 
# Set location of xdc executable
XDC = $(XDC_INSTALL_DIR)/xdc
 
# Set XDCPATH to contain necessary repositories.
# Note that we put specify both CODEC_INSTALL_DIR and CODEC_INSTALL_DIR/packages
# since our config.bld is typically in CODEC_INSTALL_DIR.
# If instead you're running
 
XDCPATH = ^;$(CURDIR);$(CODEC_INSTALL_DIR)/packages;$(BIOS_INSTALL_DIR)/packages;$(CE_INSTALL_DIR)/packages;
 
# Conditionally, you can create verbose build output
XDCOPTIONS=v
 
# Select the combo build type , either eval(evaluation) or prod( Production)
XDCARGS="eval"
 
export XDCOPTIONS
export XDCPATH
export XDCARGS
 
########################################################
## Shouldn't have to modify anything be low this line ##
########################################################
SERVERNAME = ""
 
all: .all-packages
 
# This recursively locates all packages in the specified directory, builds
# and releases them
.all-packages: .check-BIOS
	$(XDC) -PR .
 
# This recursively cleans all packages in the specified directory
clean: clean-packages
 
clean-packages:
	$(XDC) clean -PR .
 
# This recursively cleans all packages that were delivered via an 'xdc release'
relclean: relclean-packages
 
relclean-packages:
	$(XDC) .make -PR .
	$(XDC) clean -PR .
 
# This recursively releases all packages in the specified directory
release: release-packages
 
release-packages:
	$(XDC) release -PD .
 
# Just a shortcut to launch the RTSC Package wizard
genpackage:
	$(XDC_INSTALL_DIR)/xs ti.sdo.codecutils.genpackage
 
# Just a shortcut to launch the CE RTSC Combo wizard
genserver:
	$(XDC_INSTALL_DIR)/xs ti.sdo.ce.wizards.genserver
 
# This ensures that the BIOS you're using has been patched for SDSCM00004525.
# Specifically, the fix is to rename
# $(BIOS_INSTALL_DIR)/packages/ti/rtdx/package_export.xdc to package.xdc
.check-BIOS : $(BIOS_INSTALL_DIR)/packages/ti/rtdx/package.xdc
 
$(BIOS_INSTALL_DIR)/packages/ti/rtdx/package.xdc :
	$(warning Your BIOS needs to be patched for SDSCM00004525!)
	$(error Please copy $(BIOS_INSTALL_DIR)/packages/ti/rtdx/package_export.xdc to $@)

And the corresponding Rules.make: -

#
#  ======== Rules.make ========
#  This file specified defines used by the top-level makefile.
# Define target platform.
PLATFORM=omap3530
 
# Where the Codec Engine package is installed.
CE_INSTALL_DIR=C:\codec_engine_2_22\packages;C:\codec_engine_2_22\cetools
 
# Where the codec servers are installed.
CODEC_INSTALL_DIR=C:\win_codec_combos\dm6446_aachedec_1_30_002_evaluation\packages;C:\win_codec_combos\omap3530_mpeg4dec_2_00_008_evaluation
 
# Where the RTSC tools package is installed.
XDC_INSTALL_DIR=C:\xdctools_3_10_03
 
# Where DSP/BIOS is installed.
BIOS_INSTALL_DIR=C:\bios_5_33_03

We then simply run: -

gmake clean
gmake CODEGEN_INSTALL_DIR=c:\CCStudio_v3.3\C6000\cgtools

Known Issues

See Codec_Engine_Known_Issues - in particular note the issues highlighted on the genserver wizard.

See Also