1645 views|0 replies

3836

Posts

19

Resources
The OP
 

DSP algorithm transplantation based on davinci6467 [Copy link]

Encapsulate a.64p into .x64p Da Vinci tool chain establishment (project compilation steps) Tool chain refers to the compilation environment for programs under Linux. Here, the videnc_copy project under codec_engine_1_02\examples\codecs is used to encapsulate the program debugged under DSP.com/forum.php?mod=forumdisplay&fid=58" target="_blank" class="relatedlink">CCS and generate videnc_copy.a64P, and then the codec_engine_1_02\examples\servers\video_copy project is used to encapsulate videnc_copy.a64P into all.x64P. The compilation steps are as follows: 1. Copy the files written under ccs to the videnc_copy project under Linux codec_engine_1_02\examples\codecs. 2. Modify the package.bld file in the project. Modify var SRCS = ["videnc_copy","test"]; Only select the C file under the project in the brackets. Modify the for (var i = 0; i <1 ; i++) { in the file. Select the DSP end to compile only with cgtool (C64P is the first in config.bld) 3. Since the input and output parameters are determined by the IVIDENC_InArgs and IVIDENC_OutArgs structures, these two structures should be modified in order to add input and output parameters. To do this, modify the ividenc.h in xdais_6_25_02_11/packages/ti/xdais/dm. //Add to the end of the structure typedef struct IVIDENC_InArgs { XDAS_Int32 size; int num1; int num2; } IVIDENC_InArgs; typedef struct IVIDENC_OutArgs { XDAS_Int32 size; XDAS_Int32 extendedError; XDAS_Int32 bytesGenerated; XDAS_Int32 encodedFrameType; XDAS_Int32 inputFrameSkip; IVIDEO_BufDesc reconBufs; int out; } IVIDENC_OutArgs; Copy code 4. Call the algorithm in videnc_copy: Add in the VIDENCCOPY_TI_process function (replace the original place that processes input and output buf): outArgs->out=test(inBufs->bufs[0],outBufs->bufs[0],inBufs->bufSizes[0],inArgs->num1,inArgs->num2); Copy code Since the #ifdef USE_ACPY3 macro is used, you have to choose whether to use DMA. In order to avoid conflicts between Cache and DMA, choose not to use DMA. Modify all.cfg under odec_engine_2_25_05_16/examples/ti/sdo/ce/examples/servers/all_codecs: VIDENC_COPY.useDMA = false; Copy code 5. Compile videnc_copy to generate videnc_copy.a64P 6. Modify server and compile to generate all.x64P Usage: 1. Modify the Makefile under encode to let encode include server and codec projects: XDC_PATH = $(USER_XDC_PATH);../../packages;$(DMAI_INSTALL_DIR)/packages;$(CE_INSTALL_DIR)/packages;$(FC_INSTALL_DIR)/packages;$(LINK_INSTALL_DIR)/packages;$(LINK_INSTALL_DIR);$(XDAIS_INSTALL_DIR)/packages;$(CMEM_INSTALL_DIR)/packages;$(CODEC_INSTALL_DIR)/packages;$(CE_INSTALL_DIR)/examples Copy code 2. Modify encode.cfg under encode: var demoEngine = Engine.createFromServer( "test", //engine handle./bin/ti_platforms_evmDM6467/all.x64P", //starting with bin "ti.sdo.ce.examples.servers.all_codecs" //path); Copy code 3. Called in file (example): CERuntime_init(); Dmai_init(); VIDENC_Handle hVen = NULL; Engine_Handle hEngine = NULL; hEngine = Engine_open("test", NULL, NULL); if (hEngine == NULL) { ERR("Failed to open codec engine:test\n"); } hVen = VIDENC_create(hEngine,"videnc_copy",NULL); if (hVen == NULL) { ERR("Failed to create video encoder: videnc_copy"); } XDM_BufDesc inBufs; *JpgBuffer1; JpgBuffer=(char *)Memory_contigAlloc(1024*1024,Memory_DEFAULTALIGNMENT); //In loadmoudle.sh script to add the corresponding size (arm and dsp) shared memory size block JpgBuffer1=(char *)Memory_contigAlloc(1024*1024,Memory_DEFAULTALIGNMENT); int JpgSize; FILE *fp=fopen("test.jpg","rb"); fseek(fp,0,SEEK_END); JpgSize=ftell(fp); fseek(fp,0,SEEK_SET); fread(JpgBuffer,1,JpgSize,fp); fclose(fp); inBufs.numBufs = 1; inBufs.bufs = &JpgBuffer; inBufs.bufSizes = &JpgSize; outBufs.numBufs = 1; outBufs.bufs = &JpgBuffer1; outBufs.bufSizes = &JpgSize; int num1=1; int num2=1; inArgs.num1=num1; inArgs.num2=num2; inArgs.size=sizeof(VIDENC_InArgs); outArgs.size=sizeof(VIDENC_OutArgs); VIDENC_process (hVen,&inBufs,&outBufs,&inArgs,&outArgs); if(outArgs.out!=0) { printf("copy failed\n"); return -1; } FILE *fp1=fopen("out.jpg","wb"); fwrite(JpgBuffer1,1,JpgSize,fp1); fclose(fp1); Copy Code Appendix (Algorithm Example (Complete Simple Picture Copy in Dsp): int test(char *inbuf,char *outbuf,int size,int num1,int num2) { int flag1=num1; int flag2=num2; int flag3=-1; int jpgsize=size; if(1==flag1&&1==flag2) { memcpy(outbuf,inbuf,jpgsize); flag3=0; } return flag3; }

This post is from DSP and ARM Processors
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list