封装a.64p成.x64p达芬奇工具链的建立(工程编译步骤)
2019-07-15 01:02发布
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
封装a.64p成.x64p达芬奇工具链的建立(工程编译步骤)
步骤如下:
1、把ccs下编写好的文件复制到Linux codec_engine_1_02examplescodecs 下的videnc_copy工程中。
2、修改该工程中的package.bld文件,
修改var SRCS = ["videnc_copy","blob","cornerdetection","him","imc","morph","objectrecognition"]; 中括号里只选择工程下的C文件。
修改该文件中的for (var i = 0; i <1 /*Build.targets.length*/; i++) { 选择DSP端只用cgtool来编译。
3、修改codec_engine_1_02examples下的user.bld,把linux86注掉,选择用C64P,跟第二步中对应。
- Build.targets = [
- // Linux86,
- C64P,
- MVArm9
复制代码
4、修改DSP算法占用的空间
修改server/all.tcf
- var mem_ext = [
- {
- comment: "DDRALGHEAP: off-chip memory for dynamic algmem allocation",
- name: "DDRALGHEAP",
- base: 0x88000000, // 128MB 0x08000000(16)=128MB(10)
- len: 0x07A00000, // 122MB 0x07A00000(16)=122MB(10)
- space: "code/data"
- },
- {
- comment: "DDR: off-chip memory for application code and data",
- name: "DDR",
- base: 0x8FA00000, // 250MB 0x0FA00000(16)=250MB(10)
- len: 0x00400000, // 4MB 0x00400000(16)=4MB(10)
- space: "code/data"
- },
- {
- comment: "DSPLINK: off-chip memory reserved for DSPLINK code and data",
- name: "DSPLINKMEM",
- base: 0x8FE00000, // 254MB 0x0FE00000(16)=254MB(10)
- len: 0x00100000, // 1MB
- space: "code/data"
- },
- {
- comment: "RESET_VECTOR: off-chip memory for the reset vector table",
- name: "RESET_VECTOR",
- base: 0x8FF00000, //255MB
- len: 0x00000080, //128B
- space: "code/data"
- },
- ];
复制代码
修改为:
- var mem_ext = [
- {
- comment: "DDRALGHEAP: off-chip memory for dynamic algmem allocation",
- name: "DDRALGHEAP",
- base: 0x88000000, // 128MB
- len: 0x07400000, // 122MB
- space: "code/data"
- },
- {
- comment: "DDR: off-chip memory for application code and data",
- name: "DDR",
- base: 0x8F400000, // 250MB
- len: 0x00A00000, // 4MB
- space: "code/data"
- },
- {
- comment: "DSPLINK: off-chip memory reserved for DSPLINK code and data",
- name: "DSPLINKMEM",
- base: 0x8FE00000, // 254MB
- len: 0x00100000, // 1MB
- space: "code/data"
- },
- {
- comment: "RESET_VECTOR: off-chip memory for the reset vector table",
- name: "RESET_VECTOR",
- base: 0x8FF00000,
- len: 0x00000080,
- space: "code/data"
- },
- ];
复制代码
5、修改loadmodules.sh:
- insmod dsplinkk.ko ddr_start=0x8f400000 ddr_size=0xA00000 //跟第二个的DDR大小一样大
复制代码
6、在编译codec_engine_1_02examplescodecsvidenc_copy之前,要修改算法的主程序main函数- void ObjectRecognition(unsigned char* inbuf, int* flag,unsigned char* outbuf, int* kind, float *inIM)。
复制代码
其中输入输出参数是由XDAS_Int32 VIDENCCOPY_TI_process(IVIDENC_Handle h, XDM_BufDesc *inBufs, XDM_BufDesc *outBufs, IVIDENC_InArgs *inArgs, IVIDENC_OutArgs *outArgs)决定。由于输入输出参数由IVIDENC_InArgs,IVIDENC_OutArgs结构体来决定,所以为了增加输出输入参数,应该修改这两个结构体。为此修改xdais_5_00packages ixdaisdm中的ividdec.h文件。添加kind和IM[25]。
- typedef struct IVIDENC_OutArgs {
- XDAS_Int32 size;
- XDAS_Int32 extendedError;
- XDAS_Int32 bytesGenerated;
- XDAS_Int32 encodedFrameType;
- XDAS_Int32 inputFrameSkip;
- XDAS_Int32 kind; /*what's kind of the target*/
- float IM[25]; /*return value*/
- IVIDEO_BufDesc reconBufs; /**< Reconstruction Frames. */
- } IVIDENC_OutArgs;
复制代码
为了区分输入帧存的性质(从jpeg读取的数据还是ccd采集的数据)增加一个flag作为标志。
- typedef struct IVIDENC_InArgs {
- XDAS_Int32 size;
- XDAS_Int32 flag;//is picture saved on U or captured from CCD
- } IVIDENC_InArgs;
复制代码
7、在videnc_copy中调用算法:在VIDENCCOPY_TI_process函数中添加:ObjectRecognition(inBufs->bufs[curBuf],
- &(inArgs->flag), outBufs->bufs[curBuf], &(outArgs->kind), (outArgs->IM));
复制代码
由于使用了#ifdef USE_ACPY3 宏,故而要选择是否使用DMA,为了避免Cache和DMA的冲突,选择不使用DMA。修改- codec_engine_1_02examplesserversvideo_copy下的video_copy.cfg文件关闭DMA:
- /* we can use DMA in certain codecs! */
- VIDENC_COPY.useDMA = false;
复制代码
8、编译videnc_copy生成videnc_copy.a64P
9、修改server,编译生成all.x64P
10、下面就是编译encodedecode调用all.x64P
- * 首先修改Encodedecode下的Makefile文件,让encodedecode包含server及codec工程。
- <span style="background-color: rgb(247, 247, 247);"> XDC_PATH = $(CODEC_INSTALL_DIR)/packages; $(CE_INSTALL_DIR)/examples;</span>
- <span style="background-color: rgb(247, 247, 247);"> $(CE_INSTALL_DIR)/packages; $(LINK_INSTALL_DIR)/packages;</span>
- <span style="background-color: rgb(247, 247, 247);"> $(XDAIS_INSTALL_DIR)/packages; $(CMEM_INSTALL_DIR)/packages;</span>
- * 其次为了使用新的算法videnc_copy,要修改encodedecode.cfg文件把H264算法替换为videnc_copy算法:
- //var H264ENC =xdc.useModule('ti.sdo.codecs.h264enc.H264ENC');
- //var H264DEC = xdc.useModule('ti.sdo.codecs.h264dec.H264DEC');
- var VIDDEC_COPY = xdc.useModule('codecs.viddec_copy.VIDDEC_COPY');
- var VIDENC_COPY = xdc.useModule('codecs.videnc_copy.VIDENC_COPY');
- /* * ======== Engine Configuration ======== */
- var Engine = xdc.useModule('ti.sdo.ce.Engine');
- /*var vcr = Engine.create("loopback", [
- {name: "h264enc", mod: H264ENC, local: false},
- {name: "h264dec", mod: H264DEC, local: false},
- ]);*/
- var demoEngine = Engine.create("encodedecode", [
- {name: "videnc_copy", mod: VIDENC_COPY, local: false},
- {name: "viddec_copy", mod: VIDDEC_COPY, local: false}
- ]);
- //vcr.server = "./loopbackCombo.x64P";
- demoEngine.server = "./all.x64P";
复制代码
- * 修改encodedecode工程中创建算法函数
- static String decoderName = "viddec_copy";
- static String encoderName = "videnc_copy";
- static String engineName = "video_copy";
- hDecode = VIDDEC_create(hEngine, decoderName, ¶ms);
- hEncode = VIDENC_create(hEngine, encoderName, ¶ms);
复制代码
在工程里用到的是hEncode。
* 修改status = VIDENC_process(hEncode, &inBufDesc,&outBufDesc,&inArgs, &outArgs);的输入输出参数,使之符合封装算法是的函数参数。
一周热门 更多>