DSP

DM8168集成图像算法helloworld

2019-07-13 20:03发布

一、DM8168及本文简介

    2010年,TI推出的最新媒体处理器TMS320DM8168作为一款多通道高清SOC系统芯片,集成了1GHz主频Cortex-A8 ARM核与lGHz主频C674x的DSP核,并且集成了3个新版本的HDVICP子系统,还有新一代的VPSS。可同时提供3路1080P分辨率,每秒60帧的高清视频的H.264编码。新版本的HDVICP可支持高清分辨率的H.264、MPEG-4、VC1编码以及AVS和SVC编码,为高清视频的发展提供了更强大的软硬件支持【引用】。

    前面一篇文章介绍了DM8168的异构多核架构,本文旨在介绍如何在其DSP中添加自定义的算法。本文建立在已经熟悉CodecEngine的达芬奇架构以及DSP复合XDM标准算法开发流程的基础上。(至于达芬奇架构和DSP算法标准将在下篇文章中补充)。也就是说本文只介绍DSP算法的集成,即如何将DSP算法添加到DM8168的MCFW软件框架中

二、系统环境

开发板为ETV-HDV8168-HDMI(避免广告,不上图),PC为虚拟机centos6.3

三、介绍

本文以“helloWorld”算法为例,对应的为“helloWorld”link(在McFW框架中link是经常提到的“线程”的代名词)。假设已经拿到了DSP算法工程师的算法,这里为helloWorld,文件如下:代码下载:http://download.csdn.net/detail/guo8113/6977345

HELLOWORLD Algorithm文件介绍如下:

helloWorldAlg_TI_ialg.c – 提供创建算法实例的顶层调用接口,以及处理输入输出帧时的process 调用接口,运行时的参数设置调用接口。
helloWorldAlg_TI_priv.h –算法的私有 Data structures, macros and function call declaration.
helloWorldAlg.h - 对‘Hello World’ Link可见的算法实例创建和process call(处理调用)的Data structures, macros and function call declaration
SRC_FILES.MK – Makefile to build the ‘Hello World’ algorithm.

‘helloWorld’ Link文件介绍

helloWorldLink_tsk.c –此文件含有‘helloWorld’ link: task创建、‘Hello World’ link的从其他links接收命令、从其他links接收和释放buffers的回调函数的定义。(This file has function definition for creation of ‘helloWorld’ link task, receiving commands from other links and callbacks that other links call for receiving and freeing buffers of ‘Hello World’ link.)

helloWorldLink_priv.c –This file has all private functions for creation of the link and algorithm instance and processing upon frames.

helloWorldLink_priv.h – This file has macros, data structure and function call declaration private to the ‘helloWorld’ Link.

helloWorldLink.h –This file has macros, data structure and function call declaration of ‘helloWorld’ Link seen by other links. This file has to be placed under mcfwinterfaceslink_api folder.其他Links的调用接口

步骤:

(http://blog.csdn.net/guo8113/article/details/20149191转载请注明)

1.将interface/link_api/helloWorldLink.h以及src_bios6/alg下的文件和links_c6xdsp/下的文件放到mcfw对应的文件夹下;

2.在mcfwsrc_bios6Makefile

将helloWorld添加到 INCLUDE_EXERNAL_INTERFACES的列表 INCLUDE_EXERNAL_INTERFACES= bios xdc ipc syslink iss hdvpss ipnc_rdk fc xdais h264enc h264dec swosdhelloWorldedma3lld mpeg4enc
添加‘Makefile’ 文件和include directory:
INCDIR += $(MODULE_SRC_BASE_PATH)/alg/helloWorld
include $(MODULE_SRC_BASE_PATH)/alg/helloWorldAlg/SRC_FILES.MK
3.在mcfwsrc_bios6links_c6xdspsystemsystem_c6xdsp.c 添加helloWorldLink头文件包含 #include System_initLinks() 函数中添加HelloWorldLink_init(),System_deInitLinks() 添加HelloWorldLink_deInit() 4. ipnc_rdkipnc_mcfwmcfwinterfaceslink_apisystem_linkId.h 为helloWorld link在DSPcore一端定义link ids #defineSYSTEM_LINK_ID_HELLOWORLD_0 DSP_LINK(SYSTEM_LINK_COMMON_LINKS_MAX_ID+4) (由于提示procId < SYSTEM_PROC_MAX : failed !!!) #defineSYSTEM_LINK_ID_HELLOWORLD_START (SYSTEM_LINK_ID_HELLOWORLD_0) #defineSYSTEM_LINK_ID_HELLOWORLD_END (SYSTEM_LINK_ID_HELLOWORLD_0) #defineSYSTEM_LINK_ID_HELLOWORLD_COUNT (SYSTEM_LINK_ID_ALG_END - SYSTEM_LINK_ID_ALG_START)+ 1 5ipnc_rdkipnc_mcfwmcfwsrc_bios6links_commonsystemsystem_priv_common.h 定义任务优先级和栈的大小 #defineHELLOWORLD_LINK_TSK_PRI (2) #defineHELLOWORLD_LINK_TSK_STACK_SIZE (SYSTEM_DEFAULT_TSK_STACK_SIZE) 6ipnc_rdkipnc_mcfwmcfwsrc_linuxmcfw_api i_vsys_priv.h 包含头文件 All header filesunder interface folder needs to be included in this file. Include thehelloWorldLink header file here #include 7ipnc_rdkipnc_mcfwmcfwsrc_bios6links_c6xdspSRC_FILES.MK Add the helloWorlddirectory to the list of SRCDIR
SRCDIR +=links_c6xdsp/system links_c6xdsp/utils/src links_c6xdsp/alg_linklinks_c6xdsp/alg_link/swosd links_c6xdsp/alg_link/scd links_c6xdsp/valinks_c6xdsp/helloWorld SRCS_HELLOWORLD =helloWorldLink_tsk.c helloWorldLink_priv.c SRCS_c6xdsp +=$(SRCS_SYSTEMDSP) $(SRCS_UTILS) $(SRCS_ALGLINK) $(SRCS_OSDLINK) $(SRCS_SCDLINK)$(SRCS_VALINK)$(SRCS_HELLOWORLD) 8.修改内存: mcfwsrc_bios6cfg i81xxconfig_2G.bld.(文件名对应内存大小) 找到下面代码段,将LINUX_SIZE的大小调小一点分出来给DSP_CODE_SIZE、DSP_DATA_SIZE  /* first 512MB */
LINUX_SIZE                 = 128*MB;
SR1_SIZE                   = 336.5*MB;
SR3_INTRADUCATI_IPC_SIZE   = 124*KB;
VIDEO_M3_CODE_SIZE         = 2.5*MB;
VIDEO_M3_DATA_SIZE         = 12*MB;
DSS_M3_CODE_SIZE           = 1.5*MB;
DSS_M3_DATA_SIZE           = 17*MB;
DSP_CODE_SIZE              = 900*KB;
DSP_DATA_SIZE              = 13.5*MB;


执行结果: 会在终端不停的打印:HELLO WORLD ALG: Process frame 由HELLORWORLDALG_TI_process中 "Vps_printf("HELLO WORLD ALG: Process frame ");"输出
编译中可能遇到的错误: 1. "/home/dm8168/dvr_rdk/../dvr_rdk/build/dvr_rdk/obj/ti816x-evm/c6xdsp/debug/dvr_rdk_configuro/linker_mod.cmd",line 242: error:  placement fails for object ".switch", size 0x32a (page0). Available ranges:   DDR3_DSP    size: 0xd80000    unused: 0xc         max hole: 0x4       "/home/dm8168/dvr_rdk/../dvr_rdk/build/dvr_rdk/obj/ti816x-evm/c6xdsp/debug/dvr_rdk_configuro/linker_mod.cmd",line 230: error:   placement fails for object "GROUP_1", size 0x13c (page0). Available   ranges:   DDR3_DSP    size: 0xd80000    unused: 0xc         max hole: 0x4       warning: entry-point symbol other than"_c_int00" specified:   "ti_sysbios_family_c64p_Hwi0" error: errors encountered during linking;   "/home/dm8168/dvr_rdk/../dvr_rdk/build/dvr_rdk/bin/ti816x-evm/dvr_rdk_c6xdsp   _debug.xe674" not built make[2]: ***[/home/dm8168/dvr_rdk/../dvr_rdk/build/dvr_rdk/bin/ti816x-evm/dvr_rdk_c6xdsp_debug.xe674]Error 1 make[1]: *** [apps] Error 2 make: *** [dvr_rdk_bios6] Error 2 #### #### [DM816X_ETV] platform build [] ERROR!!! 内存不足,修改内存。 Top level memory requirement for DSP code and data size is done in mcfwsrc_bios6cfg i81xxconfig_M.bld. Please refer to appnote on memoryMap for further details on changing the size of these sections as per your DSP algorithms requirement. 2.
需要首先编译内核 3.  [m3vpss ]  13780: CAPTURE: Start Done !!!  [m3vpss ]  13907: SYSTEM: Opening MsgQ [HOST_MSGQ] ...  [c6xdsp ]  10802: Assertion @ Line: 61 inlinks_common/system/system_linkApi.c:  procId < SYSTEM_PROC_MAX :failed !!!  [m3vpss ]  113897: CAPTURE: Stop in progress !!!  [m3vpss ]  113897: CAPTURE: Stop Done !!! 解决由于link之间没有连接设置正确的prelink和nextlink!! 在chain中忘记设置!!!!pcFramesInDspPrm.baseCreateParams.outQueParams[0].nextLink=helloId;
(http://blog.csdn.net/guo8113/article/details/20149191转载请注明)

参考资料:

DSP Algorithm Integration Guide in IPNC/DVR RDK

声明:本文参考以上资料,文档实在是坑爹,有些细节会有问题,但是还好大体方向是正确的,之前有个同事编过没有整理,我又从头开始,历经一周终于把问题解决了,下面一篇将介绍chains及如何在chains中使用alg算法。

http://blog.csdn.net/guo8113/article/details/20149191转载请注明