专家您好,我在使用8168的NSF link中发现,无论nsfPrm.bypassNsf属性配成TURE或FALSE,采集图像的噪点都没有去掉,似乎noise filter模块就没有工作。另外我在别的帖子上看要配置NF_reg0到NF_reg9那10个寄存器的值 请问如果要配的话在什么地方配呢?谢谢!
user4029446:
回复 Chris Meng:
我使用的DVR版本为4.01.00.02,看了下您回帖中的代码,确实目前我所用的DVR版本中没有这些代码,我会联系我的经销商索取更高版本的DVR,谢谢您 的回复。
Chris Meng:
回复 user4029446:
你好,
帖子里提到的DVR RDK 4.1就是你现在手上的这个4.01版本。请打上相关补丁再尝试。
user4029446:
回复 Chris Meng:
您好,我打上相关补丁后,发现降噪模块没有起到降噪作用,请您帮助分析下原因。
以下是我在CaptureLink_drv.c中CaptureLink_drvProcessData函数中模拟生成噪点的代码
for (frameId = 0; frameId < frameList.numFrames; frameId++){pFrame = frameList.frames[frameId];///if(pFrame->channelNum)/// Vps_printf("capture ch%d\n", pFrame->channelNum);CaptureLink_setFrameWallTime(pObj,pFrame);
queId = CaptureLink_getQueId(pFrame->channelNum);queChId = CaptureLink_getQueChId(pFrame->channelNum);///Vps_printf("queId=%d, queChId=%d\n", queId, queChId);UTILS_assert(queId < CAPTURE_LINK_MAX_OUT_QUE);UTILS_assert(queChId < CAPTURE_LINK_MAX_CH_PER_OUT_QUE);
CaptureLink_drvCheckAndSetFrameSkipMask(pObj, pFrame);
pObj->captureDequeuedFrameCount++;pObj->captureFrameCount[queId][queChId]++;if(pObj->captureFrameCount[queId][queChId]%20==0){// add noise every 20 framesfor(i=0;i<20;i++){*((unsigned *)pFrame->addr[0][0]+5000+i*1000+pObj->captureDequeuedFrameCount%3) = 0;}//Vps_printf("capture ch%d\n", pFrame->channelNum);}CaptureLink_drvRtResolutionUpdate(pObj, pFrame);
CaptureLink_drvBlindAreaProcessData(pObj,queId,queChId,pFrame);pFrame->perFrameCfg = NULL;pFrame->channelNum = queChId;sendMsgToTsk |= (1 << queId);status = Utils_bufPutFullFrame(&pObj->bufQue[queId], pFrame);UTILS_assert(status == FVID2_SOK);}
以下为我的应用程序代码:( Print_reginfo函数的作用是调用SPI驱动打印物理地址的值 )
#include <stdbool.h>
#include <signal.h>#include "osa.h"
#include "ti_vsys.h"
#include "ti_vcap.h"
#include "ti_vdis.h"
#include <linux/spi/spidev.h>
#include <fcntl.h>
#include <sys/ioctl.h>#include "mcfw/src_linux/mcfw_api/usecases/multich_common.h"
#define CAP_DEV_TVP5158
//#define CAP_DEV_ADV7611_GV7601_TVP7002_16BIT
//#define CAP_DEV_ADV7611_8BIT
//#define CAP_DEV_GV7601_8BIT#define NUM_CAPTURE_DEVICES1
static void mcfw_chain_init();
static void mcfw_chain_deinit();/* signal handle for ctrl + c */
volatile bool g_quit = false;
static void sig_handle(int signo) {printf("recived quit signal\n");g_quit = true;
}struct read_reg_data {unsigned int addr;unsigned int len;
};void Print_reginfo(unsigned int addr, unsigned int len)
{int ret, fd;struct read_reg_data RdRegstruc;
RdRegstruc.addr = addr;RdRegstruc.len = len;fd = open("/dev/spidev3.0", O_RDWR);if (fd < 0)printf("can't open spi device");ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &RdRegstruc);if (ret == -1){printf("can't get bits per word");return;}close(fd);
}int main(int argc, char **argv) {int cnt;signal(SIGINT, sig_handle);
/* init System, Capture and Display Module */VSYS_PARAMS_S prms_sys;VCAP_PARAMS_S prms_vcap;VDIS_PARAMS_S prms_vdis;Vsys_params_init(&prms_sys);Vcap_params_init(&prms_vcap);Vdis_params_init(&prms_vdis);
prms_vdis.enableConfigExtVideoEncoder = FALSE;cnt = 0;Vsys_init(&prms_sys);Vcap_init(&prms_vcap);Vdis_init(&prms_vdis);
Vsys_configureDisplay(); // configure display
/* construct capture and display chain */mcfw_chain_init();
/* make chain start working */Vdis_start();Vcap_start();Vcap_setNsfStrength(3);/* wait ctrl + c */while (! g_quit) { printf("Display frames… CTRL+C\n"); cnt++;sleep(1);if(cnt==1) Vcap_setNsfStrength(0);if(cnt==40)Vcap_setNsfStrength(1);if(cnt==80)Vcap_setNsfStrength(2);if(cnt==120)Vcap_setNsfStrength(3);Print_reginfo(0x4810c200, 0x28);// output the value of nf register }
/* stop working and deinit */Vcap_stop();Vdis_stop();
mcfw_chain_deinit();
Vsys_deConfigureDisplay();
Vcap_exit();Vdis_exit();Vsys_exit();
return 0;
}static void mcfw_chain_init() {System_linkControl( SYSTEM_LINK_ID_M3VPSS, SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES, NULL, 0, TRUE);
/* chain: CAPTURE -> DEI -> DISPLAY */gVcapModuleContext.captureId= SYSTEM_LINK_ID_CAPTURE;gVcapModuleContext.nsfId[0]= SYSTEM_LINK_ID_NSF_0;gVcapModuleContext.deiId[0]= SYSTEM_LINK_ID_DEI_0;gVdisModuleContext.displayId[0] = SYSTEM_LINK_ID_DISPLAY_0;
/* capture link init */CaptureLink_CreateParamsprm_capture;CaptureLink_CreateParams_Init(&prm_capture);prm_capture.outQueParams[0].nextLink = gVcapModuleContext.nsfId[0];prm_capture.numVipInst= 1;prm_capture.tilerEnable= FALSE;prm_capture.numBufsPerCh= 8;prm_capture.maxBlindAreasPerCh= 4;prm_capture.isPalMode = Vcap_isPalMode();#if ! defined CAP_DEV_TVP5158prm_capture.doCropInCapture= FALSE;prm_capture.enableSdCrop= FALSE;
#endif
/* capture instance init */CaptureLink_VipInstParams*prm_cap_inst = &prm_capture.vipInst[0];prm_cap_inst->vipInstId= (SYSTEM_CAPTURE_INST_VIP1_PORTA + 0 ) % SYSTEM_CAPTURE_INST_MAX;// VIP0prm_cap_inst->inDataFormat= SYSTEM_DF_YUV422P;prm_cap_inst->numOutput= 1;#if defined CAP_DEV_TVP5158prm_cap_inst->videoDecoderId= SYSTEM_DEVICE_VID_DEC_TVP5158_DRV;prm_cap_inst->standard= SYSTEM_STD_MUX_4CH_D1;// set input mode as 4 input with D1 resolution
#endif#if defined CAP_DEV_ADV7611_GV7601_TVP7002_16BITprm_cap_inst->standard= SYSTEM_STD_1080P_60;prm_cap_inst->videoIfMode= DEVICE_CAPT_VIDEO_IF_MODE_16BIT;prm_cap_inst->videoCaptureMode= DEVICE_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
#endif#if defined CAP_DEV_ADV7611_8BITprm_cap_inst->useAdvancedParams = TRUE; prm_cap_inst->advancedParams.pixClkEdgePol = SYSTEM_VIP_PIX_CLK_EDGE_POL_FALLING;
prm_cap_inst->standard= SYSTEM_STD_1080P_30;prm_cap_inst->videoIfMode= DEVICE_CAPT_VIDEO_IF_MODE_8BIT;prm_cap_inst->videoCaptureMode= DEVICE_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC;
#endif#if defined CAP_DEV_GV7601_8BITprm_cap_inst->standard= SYSTEM_STD_1080P_30;prm_cap_inst->videoIfMode= DEVICE_CAPT_VIDEO_IF_MODE_8BIT;prm_cap_inst->videoCaptureMode= SYSTEM_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_DISCRETE_SYNC_HSYNC_VSYNC;
#endif
/* capture out init */CaptureLink_OutParams *prm_cap_out = &prm_cap_inst->outParams[0];prm_cap_out->dataFormat= SYSTEM_DF_YUV422I_YUYV;prm_cap_out->scEnable= FALSE;prm_cap_out->scOutWidth= 0;prm_cap_out->scOutHeight= 0;prm_cap_out->outQueId= 0;
NsfLink_CreateParams prm_nsf;MULTICH_INIT_STRUCT(NsfLink_CreateParams, prm_nsf);prm_nsf.bypassNsf= FALSE;prm_nsf.tilerEnable= FALSE;prm_nsf.inQueParams.prevLinkId= gVcapModuleContext.captureId;prm_nsf.inQueParams.prevLinkQueId= 0;prm_nsf.numOutQue= 1;prm_nsf.outQueParams[0].nextLink = gVcapModuleContext.deiId[0];
/* De-Interleave link init */DeiLink_CreateParamsprm_dei;MULTICH_INIT_STRUCT(DeiLink_CreateParams, prm_dei);
prm_dei.inQueParams.prevLinkId = gVcapModuleContext.nsfId[0];prm_dei.inQueParams.prevLinkQueId = 0;
prm_dei.enableOut[DEI_LINK_OUT_QUE_DEI_SC]= TRUE; prm_dei.outQueParams[DEI_LINK_OUT_QUE_DEI_SC].nextLink= gVdisModuleContext.displayId[0];prm_dei.comprEnable= FALSE;prm_dei.setVipScYuv422Format= FALSE;
#if ! defined CAP_DEV_TVP5158prm_dei.enableDeiForceBypass = TRUE;// Disable the de-interlace.
#endif
/* Display link init */DisplayLink_CreateParamsprm_dis;MULTICH_INIT_STRUCT(DisplayLink_CreateParams, prm_dis);prm_dis.inQueParams[0].prevLinkId= gVcapModuleContext.deiId[0];prm_dis.inQueParams[0].prevLinkQueId = DEI_LINK_OUT_QUE_DEI_SC;prm_dis.displayRes= VSYS_STD_1080P_60;
/* create link */System_linkCreate(gVcapModuleContext.captureId, &prm_capture, sizeof(prm_capture));System_linkCreate(gVcapModuleContext.nsfId[0], &prm_nsf, sizeof(prm_nsf));System_linkCreate(gVcapModuleContext.deiId[0], &prm_dei, sizeof(prm_dei));System_linkCreate(gVdisModuleContext.displayId[0], &prm_dis, sizeof(prm_dis));
/* setting frames from which channel should be display */DisplayLink_SwitchChannelParams prm_switch_ch;prm_switch_ch.activeChId = 0;System_linkControl(gVdisModuleContext.displayId[0], DISPLAY_LINK_CMD_SWITCH_CH, &prm_switch_ch, sizeof(prm_switch_ch), TRUE);
}static void mcfw_chain_deinit() {System_linkDelete(gVcapModuleContext.captureId);System_linkDelete(gVcapModuleContext.deiId[0]);System_linkDelete(gVcapModuleContext.nsfId[0]);System_linkDelete(gVdisModuleContext.displayId[0]);
}
以下为Vcap_setNsfStrength(3)运行后降噪模块10个寄存器的值 :
phy addr:0x4810c200, len:0x28, addr = 0xfa10c200
0x4810c200: 0x1031
0x4810c204: 0xf002c0
0x4810c208: 0x1616
0x4810c20c: 0x20202020
0x4810c210: 0x616
0x4810c214: 0xfd
0x4810c218: 0x1616
0x4810c21c: 0x3
0x4810c220: 0x0
0x4810c224: 0x0