专家您好,我按照8863.dvr_rdk_nsflink.patch.txt中的补丁对DVR修改并重新编译后,运行测试程序后发现加不加NF模块对于图像中已有的噪点没有什么影响,请问专家是我的噪点生成的问题还是其它什么原因,另外TI有没有NF模块起作用后前后画面对比的例子。以下为我的程序代码及运行结果。谢谢!
在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 frames
for(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_DEVICES 1
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_CreateParams prm_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_TVP5158
prm_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; // VIP0
prm_cap_inst->inDataFormat = SYSTEM_DF_YUV422P;
prm_cap_inst->numOutput = 1;
#if defined CAP_DEV_TVP5158
prm_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_16BIT
prm_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_8BIT
prm_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_8BIT
prm_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_CreateParams prm_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_TVP5158
prm_dei.enableDeiForceBypass = TRUE; // Disable the de-interlace.
#endif
/* Display link init */
DisplayLink_CreateParams prm_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
Chris Meng:
你好,
你可以参考一下下面论坛里面的NSF相关寄存器的值。
e2e.ti.com/…/236825