14. YNR

14.1. Function Overview

Spatial denoising algorithm for brightness noise in YUV Domain.

14.2. API Referecne

14.2.1. CVI_ISP_SetYNRAttr

【Description】

Set brightness noise reduction attribute parameters

【Syntax】

CVI_S32 CVI_ISP_SetYNRAttr(VI_PIPE ViPipe, const ISP_YNR_ATTR_S *pstYNRAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstYNRAttr

Brightness Noise Reduction Attribute Parameters

Input

【Return Value】

Return Value

Description

0

Success

Non 0

Failure. An error code is returned. For details, see chapter Error Codes.

【Requirement】

  • Header files: cvi_isp.h, cvi_comm_isp.h

  • Library files: libisp.so

【Note】

None.

【Example】

None.

【Related Topic】

14.2.2. CVI_ISP_GetYNRAttr

【Description】

Get brightness noise reduction attribute parameters

【Syntax】

CVI_S32 CVI_ISP_GetYNRAttr(VI_PIPE ViPipe, ISP_YNR_ATTR_S *pstYNRAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstYNRAttr

Brightness Noise Reduction Attribute Parameters

Output

【Return Value】

Return Value

Description

0

Success

Non 0

Failure. An error code is returned. For details, see chapter Error Codes.

【Requirement】

  • Header files: cvi_isp.h, cvi_comm_isp.h

  • Library files: libisp.so

【Note】

None.

【Example】

None.

【Related Topic】

14.2.3. CVI_ISP_SetYNRMotionNRAttr

【Description】

Set the brightness noise reduction moving object attribute parameters

【Syntax】

CVI_S32 CVI_ISP_SetYNRMotionNRAttr(VI_PIPE ViPipe, const ISP_YNR_MOTION_NR_ATTR_S *pstYNRMotionNRAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstYNRMotionNRAttr

Set the brightness noise reduction moving object attribute parameters

Input

【Return Value】

Return Value

Description

0

Success

Non 0

Failure. An error code is returned. For details, see chapter Error Codes.

【Requirement】

  • Header files: cvi_isp.h, cvi_comm_isp.h

  • Library files: libisp.so

【Note】

None.

【Example】

None.

【Related Topic】

14.2.4. CVI_ISP_GetYNRMotionNRAttr

【Description】

Get the brightness noise reduction moving object attribute parameters

【Syntax】

CVI_S32 CVI_ISP_GetYNRMotionNRAttr(VI_PIPE ViPipe, ISP_YNR_MOTION_NR_ATTR_S *pstYNRMotionNRAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstYNRMotionNRAttr

Set the brightness noise reduction moving object attribute parameters

Output

【Return Value】

Return Value

Description

0

Success

Non 0

Failure. An error code is returned. For details, see chapter Error Codes.

【Requirement】

  • Header files: cvi_isp.h, cvi_comm_isp.h

  • Library files: libisp.so

【Note】

None.

【Example】

None.

【Related Topic】

14.2.5. CVI_ISP_SetYNRFilterAttr

【Description】

Set brightness Noise Reduction Filter Attribute Parameters

【Syntax】

CVI_S32 CVI_ISP_SetYNRFilterAttr(VI_PIPE ViPipe, const ISP_YNR_FILTER_ATTR_S *pstYNRFilterAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstYNRFilterAttr

Brightness Noise Reduction Filter Attribute Parameters

Input

【Return Value】

Return Value

Description

0

Success

Non 0

Failure. An error code is returned. For details, see chapter Error Codes.

【Requirement】

  • Header files: cvi_isp.h, cvi_comm_isp.h

  • Library files: libisp.so

【Note】

None.

【Example】

None.

【Related Topic】

14.2.6. CVI_ISP_GetYNRFilterAttr

【Description】

Obtaining brightness noise reduction filter attribute parameters

【Syntax】

CVI_S32 CVI_ISP_GetYNRFilterAttr(VI_PIPE ViPipe, ISP_YNR_FILTER_ATTR_S *pstYNRFilterAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstYNRFilterAttr

Brightness Noise Reduction Filter Attribute Parameters

Output

【Return Value】

Return Value

Description

0

Success

Non 0

Failure. An error code is returned. For details, see chapter Error Codes.

【Requirement】

  • Header files: cvi_isp.h, cvi_comm_isp.h

  • Library files: libisp.so

【Note】

None.

【Example】

None.

【Related Topic】

14.3. Data Types

14.3.1. ISP_YNR_MANUAL_ATTR_S

【Description】

Brightness Noise Reduction Attribute Manual Parameter

【Syntax】

typedef struct _ISP_YNR_MANUAL_ATTR_S {
  CVI_U8 WindowType;
  CVI_U8 DetailSmoothMode;
  CVI_U8 NoiseSuppressStr;
  CVI_U8 FilterType;
  CVI_U8 NoiseCoringMax;
  CVI_U8 NoiseCoringBase;
  CVI_U8 NoiseCoringAdv;
} ISP_YNR_MANUAL_ATTR_S;

【Member】

Member

Description

WindowType

Denoising filtering locality degree. The smaller the value, the more localized the effect. Value range: [0x0, 0xb] Data type: CVI_U8

DetailSmoothMode

The denoising detail smoothing function is enabled. 0: off. 1: Enabled. Value range: [0x0, 0x1] Data type: CVI_U8

NoiseSuppressStr

Noise suppression strength. The larger the value, the stronger the bright noise removal. Value range: [0x0, 0xff] Data type: CVI_U8

FilterType

Denoising filter strength. The larger the value, the stronger the bright noise removal. Value range: [0x0, 0xff] Data type: CVI_U8

NoiseCoringMax

The maximum allowable noise suppression strength. Value range: [0x0, 0xff] Data type: CVI_U8

NoiseCoringBase

The brightness noise tolerance value of the motion area, the judgment of the motion area is linked with the detection of the TNR motion area. The larger the value, the greater the denoising strength of the motion area. Value range: [0x0, 0xff] Data type: CVI_U8

NoiseCoringAdv

Luminance noise tolerance value in the static zone, the judgment of the static zone is linked with the detection of the TNR motion zone. The larger the value, the stronger the noise removal in the static area. Value range: [0x0, 0xff] Data type: CVI_U8

【Note】

None.

【Related Data Type and Interface】

14.3.2. ISP_YNR_AUTO_ATTR_S

【Description】

Brightness Noise Reduction Attribute Automatic Parameters

【Syntax】

typedef struct _ISP_YNR_AUTO_ATTR_S {
  CVI_U8 WindowType[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 DetailSmoothMode[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 NoiseSuppressStr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 FilterType[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 NoiseCoringMax[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 NoiseCoringBase[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 NoiseCoringAdv[ISP_AUTO_ISO_STRENGTH_NUM];
} ISP_YNR_AUTO_ATTR_S;

【Member】

Member

Description

WindowType

Denoising filtering locality degree. The smaller the value, the more localized the effect. Value range: [0x0, 0xb] Data type: CVI_U8

DetailSmoothMode

The denoising detail smoothing function is enabled. 0: off. 1: Enabled. Value range: [0x0, 0x1] Data type: CVI_U8

NoiseSuppressStr

Noise suppression strength. The larger the value, the stronger the bright noise removal. Value range: [0x0, 0xff] Data type: CVI_U8

FilterType

Denoising filter strength. The larger the value, the stronger the bright noise removal. Value range: [0x0, 0xff] Data type: CVI_U8

NoiseCoringMax

The maximum allowable noise suppression strength. Value range: [0x0, 0xff] Data type: CVI_U8

NoiseCoringBase

The brightness noise tolerance value of the motion area, the judgment of the motion area is linked with the detection of the TNR motion area. The larger the value, the greater the denoising strength of the motion area. Value range: [0x0, 0xff] Data type: CVI_U8

NoiseCoringAdv

Luminance noise tolerance value in the static zone, the judgment of the static zone is linked with the detection of the TNR motion zone. The larger the value, the stronger the noise removal in the static area. Value range: [0x0, 0xff] Data type: CVI_U8

【Note】

None.

【Related Data Type and Interface】

14.3.3. ISP_YNR_ATTR_S

【Description】

Brightness Noise Reduction Attribute Parameters

【Syntax】

typedef struct _ISP_YNR_ATTR_S {
  CVI_BOOL Enable;
  ISP_OP_TYPE_E enOpType;
  CVI_U8 UpdateInterval;
  CVI_BOOL CoringParamEnable;
  CVI_BOOL FiltModeEnable;
  CVI_U16 FiltMode;
  CVI_U8 TuningMode;
  ISP_YNR_MANUAL_ATTR_S stManual;
  ISP_YNR_AUTO_ATTR_S stAuto;
} ISP_YNR_ATTR_S;

【Member】

Member

Description

Enable

The YNR module is enabled. 0: off. 1: Enabled. Value range: [0, 1] Data Type: CVI_BOOL

enOpType

Job type OP_TYPE_AUTO: automatic mode OP_TYPE_MANUAL: manual mode

UpdateInterval

Affects the parameter update interval, the larger the value, the slower the screen changes and the better the performance. Value range: [0x0, 0xff] Data type: CVI_U8

CoringParamEnable

Control whether to use manual coring, if it is 0 NoiseCoringBaseLuma[6] / NoiseCoringBaseOffset[6] / NoiseCoringAdvLuma[6] / NoiseCoringAdvOffset[6] Useless. Value range: [0, 1] Data Type: CVI_BOOL

FiltModeEnable

Filter manual mixing mode enabled. 0: off. 1: Enabled. Value range: [0, 1] Data Type: CVI_BOOL

FiltMode

Filters with hand-tuned blending weights. Value range: [0, 0x100] Data Type: CVI_U16

TuningMode

Output debug strategy to assist in adjusting parameters. 8: YNR image result. 11: Flat/edge detected image result. (Remove 12, 13, 14, 15) 12: Vertical edge detection image result. 13: Horizontal edge detection image result. 14: Anti-diagonal edge detection image results. 15: Diagonal edge detection image result. Value range: [0x0, 0xf] Data type: CVI_U8

stManual

Manual Mode Parameter Properties

stAuto

Auto Mode Parameter Properties

【Note】

None.

【Related Data Type and Interface】

14.3.4. ISP_YNR_MOTION_NR_MANUAL_ATTR_S

【Description】

Brightness Noise Reduction Moving Object Properties Manual Parameters

【Syntax】

typedef struct _ISP_YNR_MOTION_NR_MANUAL_ATTR_S {
  CVI_U8 MotionCoringWgtMax;
  CVI_U16 MotionYnrLut[16];
  CVI_U16 MotionCoringWgt[16];
} ISP_YNR_MOTION_NR_MANUAL_ATTR_S;

【Member】

Member

Description

MotionCoringWgtMax

For the object movement area, the maximum value of the noise can be allowed to be preserved. Value range: [0x0, 0xff] Data type: CVI_U8

MotionYnrLut[16]

Adjust the intensity of debrightening and denoising corresponding to the amount of motion of different objects, and divide the amount of motion into 16 levels. The larger the value, the stronger the debrightening strength. Value range: [0x0, 0xff] Data Type: CVI_U16

MotionCoringWgt [16]

Adjust the degree of noise retention corresponding to the amount of motion of different objects, and the amount of motion is divided into 16 levels. The larger the value, the more noise is preserved. Value range: [0x0, 0x100] Data Type: CVI_U16

【Note】

None.

【Related Data Type and Interface】

14.3.5. ISP_YNR_MOTION_NR_AUTO_ATTR_S

【Description】

Brightness noise reduction moving object attribute automatic parameters

【Syntax】

typedef struct _ISP_YNR_MOTION_NR_AUTO_ATTR_S {
  CVI_U8 MotionCoringWgtMax[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 MotionYnrLut[16][ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 MotionCoringWgt[16][ISP_AUTO_ISO_STRENGTH_NUM];
} ISP_YNR_MOTION_NR_AUTO_ATTR_S;

【Member】

Member

Description

MotionCoringWgtMax

For the object movement area, the maximum value of the noise can be allowed to be preserved. Value range: [0x0, 0xff] Data type: CVI_U8

MotionYnrLut[16]

Adjust the intensity of debrightening and denoising corresponding to the amount of motion of different objects, and divide the amount of motion into 16 levels. The larger the value, the stronger the debrightening strength. Value range: [0x0, 0xff] Data Type: CVI_U16

MotionCoringWgt [16]

Adjust the degree of noise retention corresponding to the amount of motion of different objects, and the amount of motion is divided into 16 levels. The larger the value, the more noise is preserved. Value range: [0x0, 0x100] Data Type: CVI_U16

【Note】

None.

【Related Data Type and Interface】

14.3.6. ISP_YNR_MOTION_NR_ATTR_S

【Description】

Brightness Noise Reduction Moving Object Attribute Parameters

【Syntax】

typedef struct _ISP_YNR_MOTION_NR_ATTR_S {
  ISP_YNR_MOTION_NR_MANUAL_ATTR_S stManual;
  ISP_YNR_MOTION_NR_AUTO_ATTR_S stAuto;
} ISP_YNR_MOTION_NR_ATTR_S;

【Member】

Member

Description

stManual

Manual Mode Parameter Properties

stAuto

Automatic Mode Parameter Properties

【Note】

None.

【Related Data Type and Interface】

14.3.7. ISP_YNR_FILTER_MANUAL_ATTR_S

【Description】

Brightness Noise Reduction Filter Attribute Manual Parameters

【Syntax】

typedef struct _ISP_YNR_FILTER_MANUAL_ATTR_S {
  CVI_U8 VarThr;
  CVI_U16 CoringWgtLF;
  CVI_U16 CoringWgtHF;
  CVI_U8 NonDirFiltStr;
  CVI_U8 VhDirFiltStr;
  CVI_U8 AaDirFiltStr;
  CVI_U8 CoringWgtMax;
  CVI_U16 FilterMode;
} ISP_YNR_FILTER_MANUAL_ATTR_S;

【Member】

Member

Description

VarThr

Threshold for detecting edges. The larger the value, the fewer the number of edges judged. Value range: [0x0, 0xff] Data type: CVI_U8

CoringWgtLF

Adjusts the intensity of random noise in the low frequency region. The larger the value, the more noise is preserved in the low frequency region. Value range: [0x0, 0x100] Data Type: CVI_U16

CoringWgtHF

Adjusts the intensity of random noise in the high frequency region. The larger the value, the more noise is preserved in the high-frequency region. Value range: [0x0, 0x100] Data Type: CVI_U16

NonDirFiltStr

Adjusts the strength of noise reduction in the low frequency region. The larger the value, the more noise is removed in the low frequency area. Value range: [0x0, 0x1f] Data type: CVI_U8

VhDirFiltStr

Adjusts the strength of denoising in the horizontal and vertical areas. Larger values remove more noise on horizontal and vertical edges. Value range: [0x0, 0x1f] Data type: CVI_U8

AaDirFiltStr

Adjusts the strength of denoising on diagonal edges. The larger the value, the more noise is removed on the diagonal edges. Value range: [0x0, 0x1f] Data type: CVI_U8

CoringWgtMax

The maximum value of noise that can be allowed to remain. Value range: [0x0, 0xff] Data type: CVI_U8

FilterMode

Filter mode. Smaller values preserve better noise uniformity in flat areas. Value range: [0x0, 0x3ff] Data Type: CVI_U16

【Note】

None.

【relatecd data type and interface】

14.3.8. ISP_YNR_FILTER_AUTO_ATTR_S

【Description】

Brightness Noise Reduction Filter Attribute Automatic Parameters

【Syntax】

typedef struct _ISP_YNR_FILTER_AUTO_ATTR_S {
  CVI_U8 VarThr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 CoringWgtLF[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 CoringWgtHF[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 NonDirFiltStr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 VhDirFiltStr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 AaDirFiltStr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U8 CoringWgtMax[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 FilterMode[ISP_AUTO_ISO_STRENGTH_NUM];
} ISP_YNR_FILTER_AUTO_ATTR_S;

【Member】

Member

Description

VarThr

Threshold for detecting edges. The larger the value, the fewer the number of edges judged. Value range: [0x0, 0xff] Data type: CVI_U8

CoringWgtLF

Adjusts the intensity of random noise in the low frequency region. The larger the value, the more noise is preserved in the low frequency region. Value range: [0x0, 0x100] Data Type: CVI_U16

CoringWgtHF

Adjusts the intensity of random noise in the high frequency region. The larger the value, the more noise is preserved in the high-frequency region. Value range: [0x0, 0x100] Data Type: CVI_U16

NonDirFiltStr

Adjusts the strength of noise reduction in the low frequency region. The larger the value, the more noise is removed in the low frequency area. Value range: [0x0, 0x1f] Data type: CVI_U8

VhDirFiltStr

Adjusts the strength of denoising in the horizontal and vertical areas. Larger values remove more noise on horizontal and vertical edges. Value range: [0x0, 0x1f] Data type: CVI_U8

AaDirFiltStr

Adjusts the strength of denoising on diagonal edges. The larger the value, the more noise is removed on the diagonal edges. Value range: [0x0, 0x1f] Data type: CVI_U8

CoringWgtMax

The maximum value of noise that can be allowed to remain. Value range: [0x0, 0xff] Data type: CVI_U8

FilterMode

Filter mode. Smaller values preserve better noise uniformity in flat areas. Value range: [0x0, 0x3ff] Data Type: CVI_U16

【Note】

None.

【Related Data Type and Interface】

14.3.9. ISP_YNR_FILTER_ATTR_S

【Description】

Brightness Noise Reduction Filter Attribute Parameters

【Syntax】

typedef struct _ISP_YNR_FILTER_ATTR_S {
  ISP_YNR_FILTER_MANUAL_ATTR_S stManual;
  ISP_YNR_FILTER_AUTO_ATTR_S stAuto;
} ISP_YNR_FILTER_ATTR_S;

【Member】

Member

Description

stManual

Manual Mode Parameter Properties

stAuto

Automatic Mode Parameter Properties

【Note】

None.

【Related Data Type and Interface】