Readme_SPRAAE7.txt 
==================
This is the accompanying code example for application note SPRAAE7. The build 
and run procedure assumes the DVEVM and DVSDK 1.10 software has been 
successfully installed. 

VERSION 1.1.4
-------------
Validated on Codec Engine version 1.02 and 1.10.

To build
--------
To build under Linux on the development host machine, setup the Codec Engine 
examples as described in the file 
<codec_engine_install_path>/examples/build_instructions.html. From this point 
on, we will assume you have an existing directory /home/user/workdir/myexamples 
which contains the CE examples (substitute with real path for your setup if you 
copied the CE examples under a different directory). 

Then unpack the contents of the zip file into the myexamples directory:

>	cd /home/user/workdir/myexamples
>	unzip spraae7.zip

To make sure the demo can build correctly, modify xdcpaths.mak in 
/home/user/workdir/myexamples by adding the following lines to the file:

# The directory that points to your kernel source directory.
LINUXKERNEL_INSTALL_DIR=/opt/mv_pro_4.0/montavista/pro/devkit/lsp/ti-davinci
                                                                                
# The prefix to be added before the GNU compiler tools (optionally including
# path), i.e. "arm_v5t_le-" or "/opt/bin/arm_v5t_le-".
MVTOOL_PREFIX=/opt/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-

# Indicates the directory in your filesystem where the executables are to be
# exported.
EXEC_DIR=/home/user/workdir/filesys/home/user/rotate_demo

If necessary, replace the paths with the correct paths to your kernel source 
directory, GNU compiler tools and location where the code is run.

Then follow these steps:

For the IIMGDEC-based adapter version:
1.  Go into /myexamples/ti/sdo/apps/servers/rotate/. Change use_custom_ss to 
    false in rotate.cfg:
        var use_custom_ss = false; 
    This configures the server to use the ROTATE module that implements the 
    IIMGDEC interface. 
2.  Go into /myexamples/ti/sdo/apps/demos/rotate_demo/. Set use_custom_ss to 
    "no" in makefile if not already done: 
        USE_CUSTOM_SS := no 
    This will cause the application to build against the files in the
    /myexamples/ti/sdo/apps/demos/rotate_demo/imgdec/ directory and define 
    _USE_CUSTOM_SS for the file video.c to include the correct header files.

3.  After selecting the version of your choice, build everything by going into 
    /myexamples/ti/sdo/apps/ and by entering 'gmake clean;gmake'. It will build 
    all relevant packages automatically.

4.  Finally, copy the GPP-side executable "rotate_demo", the DSP-side server 
    executable "rotate.x64P" and the "data" directory to the location indicated
    by EXEC_DIR by entering 'gmake install'.
    

For the custom stubs and skeleton version:
1.  Go into /myexamples/ti/sdo/apps/servers/rotate/. Change use_custom_ss to 
    true in rotate.cfg:
        var use_custom_ss = true;     
    This configures the server to use the ROTATE module that implements the 
    IROTATE interface.
2.  Go into /myexamples/ti/sdo/apps/demos/rotate_demo/. Set use_custom_ss to 
    "yes" in makefile if not already done:
        USE_CUSTOM_SS := yes
    This will cause the application to build against the files in the
    /myexamples/ti/sdo/apps/demos/rotate_demo/ss/ directory and define 
    _USE_CUSTOM_SS for the file video.c to include the correct header files.

3.  After selecting the version of your choice, build everything by going into 
    /myexamples/ti/sdo/apps/ and by entering 'gmake clean;gmake'. It will build 
    all relevant packages automatically.

4.  Finally, copy the GPP-side executable "rotate_demo", the DSP-side server 
    executable "rotate.x64P" and the "data" directory to the location indicated
    by EXEC_DIR by entering 'gmake install'.

Note that by default, the application and the server are built in debug 
configuration, for convenience in studying the code. However, we built 
the adapter and the algorithm in release configuration to ensure they are 
optimized for the application to meet real-time requirements. If necessary, to 
change the adapter into debug configuration, simply modify the first 
(non-comment) line in the package.bld file in the corresponding adapter 
directory to specify 

Pkg.attrs.profile = "debug";


To run
------
Simply copy the contents of the /myexamples/apps/system_files/davinci into the 
location pointed to by EXEC_DIR. Also copy the files cmemk.ko from
your CMEM installation directory and dsplinkk.ko from your DSPLINK installation
directory. Then at the command line on the DVEVM, while you are in the EXEC_DIR
directory, type

>	./loadmodules.sh
>	./rotate_demo 

Video display should start within seconds.

For details on the demo's command-line switches, take a look at 
/myexamples/ti/sdo/apps/demos/rotate_demo/rotate_demo.txt


To build and run the DMA implementation of IIMGDEC-based adapter
----------------------------------------------------------------
1.  Go into /myexamples/ti/sdo/apps/codecs/rotate/iimgdec/adapter. Change the 
    package.bld to use the source file for the dma-based adapter:
       var SRCS = ["rotate_ti_iimgdec_idma3"];
2.  Go into /myexamples/ti/sdo/apps/codecs/rotate/iimgdec/ce. 
    Uncomment the following line in ROTATE.xdc to add the line 
       override readonly config String idma3Fxns = "ROTATE_TI_IIMGDEC_IDMA3";
    REMINDER: if you wish to go back to the original non-DMA version later, you 
    MUST remember to comment out this line.
3.  Go into /myexamples/ti/sdo/apps/servers/rotate. Change use_custom_ss to 
    false in rotate.cfg:
       var use_custom_ss = false; 
4.  Go into /myexamples/ti/sdo/apps/demos/rotate_demo/. Set use_custom_ss to 
    "no" in makefile if not already done:
	    USE_CUSTOM_SS := no
5.  Go into /myexamples/ti/sdo/apps directory, run the command 'gmake clean' 
    followed by 'gmake'.
6.  Finally, copy the GPP-side executable "rotate_demo", the DSP-side server 
    executable "rotate.x64P" and the "data" directory to the location indicated
    by EXEC_DIR by entering 'gmake install'.



Known issues
------------

v1.1.4 - Doxygen/xdoc cannot be used to autogenerate documentation


Fixed Issues
------------

v1.1.4 - Updated implementation id to make the adapter's fxn table address

v1.1.4 - Set the fxns field in the original algInit in adapter's algInit 

v1.1.3 - Removed extra _ in ALGMOVED_IMPL

v1.1.3 - Fixed algFree in adapter to use origHandle when calling original 
         algorithm's algFree function.

v1.1.2 - IDMA3 Implementation is now optimized for best performance. 
       
v1.1.2 - Removed hardcoded path in demos makefile

v1.1.2 - Removed obsolete compiler options -mabi, -march

