DM8168 DVRRDK DSP算法开发(OSD)

1 系统编译

① Linux端(A8)编译命令:

make –s dvr_rdk_linux

在文件夹

DVRRDK_04.01.00.02/dvr_rdk/bin/ti816x/bin/
生成
dvr_rdk_demo_mcfw_api.out
linux可执行程序,需要将该应用程序移动到下列目录并覆盖:
DVRRDK_04.01.00.02/target/rfs_816x/home/root/ti816x/

② Bios6端(DSP)编译命令:

make –s dvr_rdk_bios6

在文件夹

DVRRDK_04.01.00.02/dvr_rdk/bin/ti816x/firmware/
生成
dvr_rdk_fw_c6xdsp_1024M_256M.xe674
dvr_rdk_fw_m3video_1024M_256M.xem3
dvr_rdk_fw_m3vpss_1024M_256M.xem3
将这三个文件移动到下列文件夹并覆盖:
DVRRDK_04.01.00.02/target/rfs_816x/home/root/ti816x/firmware/


2 运行程序

① 加载驱动

./init.sh : 加载程序运行需要的linux内核模块
./init.sh will load the kernel modules (.ko) needed for the SDK demo

② 加载M3固件

./load.sh : 加载Video-M3和VPSS-M3的固件
./load.sh will load the executable on the Video-M3 and VPSS-M3 processor and wait until these processor’s have finished their initialization

③ 运行程序

./run.sh : 运行A8端的linux应用程序
./run.sh will run the A8 side application. After running the application you will be presented with a menu of options.

④ 卸载固件

./unload.sh : 卸载Video-M3和VPSS-M3的固件
./unload.sh will send a stop command to both processors and wait until they finish their shutdown sequence. Then the executable will be “unloaded”.


3 Sys Link

① 软件框架Link

DM8168 DVRRDK DSP算法开发(OSD)_第1张图片

② Cap–Dis Link demo

DM8168 DVRRDK DSP算法开发(OSD)_第2张图片
CaptureLink_CreateParams_Init(&capturePrm);
capturePrm.numVipInst  = 1;
capturePrm.outQueParams[0].nextLink = gVdisModuleContext.displayId[0];
capturePrm.tilerEnable   = FALSE;
capturePrm.enableSdCrop   = FALSE;

pCaptureInstPrm    = &capturePrm.vipInst[0];
pCaptureInstPrm->vipInstId = SYSTEM_CAPTURE_INST_VIP0_PORTA;
pCaptureInstPrm->videoDecoderId    = 0;
pCaptureInstPrm->inDataFormat    = SYSTEM_DF_YUV422P;
pCaptureInstPrm->standard    = SYSTEM_STD_1080P_60;
pCaptureInstPrm->numOutput    = 1;
pCaptureInstPrm->inScanFormat = SYSTEM_SF_PROGRESSIVE;
pCaptureOutPrm   = &pCaptureInstPrm->outParams[0];
pCaptureOutPrm->dataFormat  =SYSTEM_DF_YUV422I_YUYV;
pCaptureOutPrm->scEnable            = FALSE;
pCaptureOutPrm->scOutWidth          = 0;
pCaptureOutPrm->scOutHeight         = 0;
pCaptureOutPrm->outQueId            = 0;

displayPrm.inQueParams[0].prevLinkId   = gVcapModuleContext.captureId;
displayPrm.inQueParams[0].prevLinkQueId = 0;
displayPrm.displayRes   = VSYS_STD_1080P_60;

③ Cap–OSD–Dis Link (DSP核处理图像)

DM8168 DVRRDK DSP算法开发(OSD)_第3张图片
CaptureLink_CreateParams_Init(&capturePrm);
capturePrm.numVipInst               	= 1;
capturePrm.outQueParams[0].nextLink = ipcFramesOutVpssId;
capturePrm.tilerEnable              = FALSE;
capturePrm.enableSdCrop         = FALSE;
pCaptureInstPrm                     = &capturePrm.vipInst[0];
pCaptureInstPrm->vipInstId          = SYSTEM_CAPTURE_INST_VIP0_PORTA;
pCaptureInstPrm->videoDecoderId     = 0;
pCaptureInstPrm->inDataFormat       = SYSTEM_DF_YUV422P;
pCaptureInstPrm->standard           = SYSTEM_STD_1080P_60;
pCaptureInstPrm->numOutput          = 1;
pCaptureInstPrm->inScanFormat= SYSTEM_SF_PROGRESSIVE;
pCaptureOutPrm                      = &pCaptureInstPrm->outParams[0];
pCaptureOutPrm->dataFormat    =SYSTEM_DF_YUV422I_YUYV;
pCaptureOutPrm->scEnable            = FALSE;
pCaptureOutPrm->scOutWidth          = 0;
pCaptureOutPrm->scOutHeight         = 0;
pCaptureOutPrm->outQueId            = 0;

IpcFramesOutLinkRTOS_CreateParams_Init(&ipcFramesOutVpssPrm);
ipcFramesOutVpssPrm.baseCreateParams.inQueParams.prevLinkId = gVcapModuleContext.captureId;
ipcFramesOutVpssPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
ipcFramesOutVpssPrm.baseCreateParams.inputFrameRate = 25;
ipcFramesOutVpssPrm.baseCreateParams.outputFrameRate = 25;
ipcFramesOutVpssPrm.baseCreateParams.notifyPrevLink = TRUE;
ipcFramesOutVpssPrm.baseCreateParams.equallyDivideChAcrossOutQues = TRUE;
ipcFramesOutVpssPrm.baseCreateParams.numOutQue =1;
ipcFramesOutVpssPrm.baseCreateParams.outQueParams[0].nextLink= gVdisModuleContext.displayId[0];
ipcFramesOutVpssPrm.baseCreateParams.processLink = ipcFramesInDspId;
ipcFramesOutVpssPrm.baseCreateParams.notifyProcessLink = TRUE;
ipcFramesOutVpssPrm.baseCreateParams.notifyNextLink = TRUE;
ipcFramesOutVpssPrm.baseCreateParams.noNotifyMode = FALSE;//TRUE;

IpcFramesInLinkRTOS_CreateParams_Init(&ipcFramesInDspPrm);
ipcFramesInDspPrm.baseCreateParams.inQueParams.prevLinkId =ipcFramesOutVpssId;
ipcFramesInDspPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
ipcFramesInDspPrm.baseCreateParams.numOutQue = 1;
ipcFramesInDspPrm.baseCreateParams.outQueParams[0].nextLink = osdId;
ipcFramesInDspPrm.baseCreateParams.inputFrameRate = 25;
ipcFramesInDspPrm.baseCreateParams.outputFrameRate = 25;
ipcFramesInDspPrm.baseCreateParams.notifyNextLink =TRUE;
ipcFramesInDspPrm.baseCreateParams.notifyPrevLink = TRUE;
ipcFramesInDspPrm.baseCreateParams.noNotifyMode = FALSE;
AlgLink_CreateParams_Init(&osdPrm);
osdPrm.inQueParams.prevLinkId = ipcFramesInDspId;
osdPrm.inQueParams.prevLinkQueId = 0;
osdPrm.enableOSDAlg = TRUE;
osdPrm.enableSCDAlg = FALSE;
AlgLink_OsdChWinParams *chWinPrm=&osdPrm.osdChCreateParams[0].chDefaultParams;
osdPrm.osdChCreateParams[0].maxHeight =64;
osdPrm.osdChCreateParams[0].maxWidth =320;
chWinPrm->chId =0 ;
chWinPrm->numWindows =1;
chWinPrm->colorKey[0]                   = 0xfa; /* Y */         
chWinPrm->colorKey[1]                   = 0x7e; /* U */         
chWinPrm->colorKey[2]                   = 0x7d; /* V */         
chWinPrm->winPrm[0].startX   = CHAINS_OSD_WIN0_STARTX;         chWinPrm->winPrm[0].startY   = CHAINS_OSD_WIN0_STARTY;
chWinPrm->winPrm[0].format  = SYSTEM_DF_YUV422I_YUYV;             
chWinPrm->winPrm[0].width    = CHAINS_OSD_WIN_WIDTH;             
chWinPrm->winPrm[0].height   = CHAINS_OSD_WIN_HEIGHT;             
chWinPrm->winPrm[0].lineOffset = CHAINS_OSD_WIN_PITCH;             
chWinPrm->winPrm[0].globalAlpha= CHAINS_OSD_GLOBAL_ALPHA;             
chWinPrm->winPrm[0].transperencyEnable = CHAINS_OSD_TRANSPARENCY;             
chWinPrm->winPrm[0].enableWin=CHAINS_OSD_ENABLE_WIN;

displayPrm.inQueParams[0].prevLinkId    = ipcFramesOutVpssId;
displayPrm.inQueParams[0].prevLinkQueId = 0;
displayPrm.displayRes   = VSYS_STD_1080P_60;

4 DSP 图像算法

① 算法添写位置:

打开mcfw/src_bios6/links_c6xdsp/alg_link/swosd/osdLink_alg.c:
第266行:
pSwOsdObj->videoWindowAddr = pFrame->addr[0][0];
pFrame->addr[0][0]指针即为图像的存储位置
使用方法:
Uint8 *buff=pFrame->addr[0][0];
for(i=0;i<1080;i++)
{
for(j=0;j<1920;j++)
{
*(buff+2*j)=128;
}
buff=buff+1920*2;
}
该例子简单的修改了每个像素点的Y值。

② 效果测试:

DM8168 DVRRDK DSP算法开发(OSD)_第4张图片

你可能感兴趣的:(DM8168 DVRRDK DSP算法开发(OSD))