13. BNR

13.1. Function Description

Spatial denoising algorithm in Bayer Domain.

13.2. API Reference

13.2.1. CVI_ISP_SetNRAttr

【Description】

Set Bayer noise reduction parameter attributes

【Syntax】

CVI_S32 CVI_ISP_SetNRAttr(VI_PIPE ViPipe, const ISP_NR_ATTR_S *pstNRAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstNRAttr

Bayer denoising parameter properties

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】

13.2.2. CVI_ISP_GetNRAttr

【Description】

Get Bayer noise reduction parameter attributes

【Syntax】

CVI_S32 CVI_ISP_GetNRAttr(VI_PIPE ViPipe, ISP_NR_ATTR_S *pstNRAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstNRAttr

Bayer denoising parameter properties

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】

13.2.3. CVI_ISP_SetNRFilterAttr

【Description】

Set the Bayer noise reduction filter attribute

【Syntax】

CVI_S32 CVI_ISP_SetNRFilterAttr(VI_PIPE ViPipe, const ISP_NR_FILTER_ATTR_S *pstNRFilterAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstNRFilterAttr

Bayer denoising filter properties

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】

13.2.4. CVI_ISP_GetNRFilterAttr

【Description】

Get Bayer noise reduction filter attributes

【Syntax】

CVI_S32 CVI_ISP_GetNRFilterAttr(VI_PIPE ViPipe, ISP_NR_FILTER_ATTR_S *pstNRFilterAttr);

【Parameter】

Parameter

Description

Input/Output

ViPipe

VI_PIPE number

Input

pstNRFilterAttr

Bayer denoising filter properties

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】

13.3. Data Types

13.3.1. ISP_NR_MANUAL_ATTR_S

【Description】

Bayer Noise Reduction Parameter Manual Properties

【Syntax】

typedef struct _ISP_NR_MANUAL_ATTR_S {
  CVI_U8 WindowType;
  CVI_U8 DetailSmoothMode;
  CVI_U8 NoiseSuppressStr;
  CVI_U8 FilterType;
  CVI_U8 NoiseSuppressStrMode;
} ISP_NR_MANUAL_ATTR_S;

【Member】

Member

Description

WindowType

De-noise filter localization.The smaller the value, the more local the effect.

Value range: [0x0, 0xb]

Data type: CVI_U8

DetailSmoothMode

Noise removal detail smoothing feature enabled.

0: Off

1: Enable

Value range: [0x0, 0x1]

Data type: CVI_U8

NoiseSuppressStr

Noise suppression intensity.The greater the value, the greater the intensity of noise removal.

Value range: [0x0, 0xff]

Data type: CVI_U8

FilterType

Denoising filter strength.The greater the value, the greater the intensity of noise removal.

Value range: [0x0, 0xff]

Data type: CVI_U8

NoiseSuppressStrMode

Intensity of bright noise and noise removal.The greater the value, the greater the intensity of noise removal.

Value range: [0x0, 0xff]

Data type: CVI_U8

【Note】

None.

【Related Data Type and Interface】

13.3.2. ISP_NR_AUTO_ATTR_S

【Description】

Bayer Noise Reduction Parameter Auto Properties

【Syntax】

typedef struct _ISP_NR_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 NoiseSuppressStrMode[ISP_AUTO_ISO_STRENGTH_NUM];
} ISP_NR_AUTO_ATTR_S;

【Member】

Member

Description

WindowType

De-noise filter localization.The smaller the value, the more local the effect.

Value range: [0x0, 0xb]

Data type: CVI_U8

DetailSmoothMode

Noise removal detail smoothing feature enabled.

0: Off

1: Enable

Value range: [0x0, 0x1]

Data type: CVI_U8

NoiseSuppressStr

Noise suppression intensity.The greater the value, the greater the intensity of noise removal.

Value range: [0x0, 0xff]

Data type: CVI_U8

FilterType

Denoising filter strength.The greater the value, the greater the intensity of noise removal.

Value range: [0x0, 0xff]

Data type: CVI_U8

NoiseSuppressStrMode

Intensity of bright noise and noise removal.The greater the value, the greater the intensity of noise removal.

Value range: [0x0, 0xff]

Data type: CVI_U8

【Note】

None.

【Related Data Type and Interface】

13.3.3. ISP_NR_ATTR_S

【Description】

Bayer noise reduction parameter attribute

【Syntax】

typedef struct _ISP_NR_ATTR_S {
  CVI_BOOL Enable;
  ISP_OP_TYPE_E enOpType;
  CVI_U8 UpdateInterval;
  CVI_BOOL CoringParamEnable;
  ISP_NR_MANUAL_ATTR_S stManual;
  ISP_NR_AUTO_ATTR_S stAuto;
} ISP_NR_ATTR_S;

【Member】

Member

Description

Enable

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

enOpType

Operating mode 0: automatic 1: Manual

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

Coring parameter enable Value range: [0, 1] Data Type: CVI_BOOL

stManual

Bayer denoising parameters manual properties

stAuto

Bayer denoising parameters automatic properties

【Note】

None.

【Related Data Type and Interface】

13.3.4. ISP_NR_FILTER_MANUAL_ATTR_S

【Description】

  • Bayer noise reduction filter manual attribute

【Syntax】

typedef struct _ISP_NR_FILTER_MANUAL_ATTR_S {
  CVI_U8 LumaStr[8];
  CVI_U8 VarThr;
  CVI_U16 CoringWgtLF;
  CVI_U16 CoringWgtHF;
  CVI_U8 NonDirFiltStr;
  CVI_U8 VhDirFiltStr;
  CVI_U8 AaDirFiltStr;
  CVI_U16 NpSlopeR; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpSlopeGr; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpSlopeGb; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpSlopeB; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpLumaThrR; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpLumaThrGr; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpLumaThrGb; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpLumaThrB; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpLowOffsetR; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpLowOffsetGr; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpLowOffsetGb; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpLowOffsetB; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpHighOffsetR; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpHighOffsetGr; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpHighOffsetGb; /*RW; Range:[0x0, 0x3ff]*/
  CVI_U16 NpHighOffsetB; /*RW; Range:[0x0, 0x3ff]*/
} ISP_NR_FILTER_MANUAL_ATTR_S;

【Member】

Member

Description

LumaStr[8]

The reference image brightness adjusts the denoising strength respectively from dark to bright. The larger the value, the stronger the bright noise removal.

Value range: [0x0, 0x1f]

Data type: CVI_U8

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

NpSlopeR

The slope of the Noise profile in the R channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpSlopeGr

The slope of the Noise profile in the Gr channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpSlopeGb

Noise profile slope in Gb channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpSlopeB

The slope of the Noise profile on the B channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLumaThrR

Luminance threshold of the Noise profile in the R channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLumaThrGr

Luminance threshold of the Noise profile in the Gr channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLumaThrGb

Luminance threshold of Noise profile in Gb channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLumaThrB

The brightness threshold of the Noise profile in the B channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLowOffsetR

The minimum noise level allowed by the Noise profile in the R channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLowOffsetGr

The minimum noise level allowed by the Noise profile in the Gr channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLowOffsetGb

The minimum noise level allowed by the Noise profile on the Gb channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLowOffsetB

The minimum noise level allowed by Noise profile in channel B

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpHighOffsetR

The maximum allowable noise level of the Noise profile in the R channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpHighOffsetGb

The maximum noise level allowed by the Noise profile in the Gr channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpHighOffsetGr

The maximum noise level allowed by the Noise profile in the Gb channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpHighOffsetB

Noise profile maximum allowable noise level in channel B

Value range: [0x0, 0x3ff]

Data type: CVI_U8

【Note】

None.

【Related Data Type and Interface】

13.3.5. ISP_NR_FILTER_AUTO_ATTR_S

【Description】

Bayer noise reduction filter automatic attribute

【Syntax】

typedef struct _ISP_NR_FILTER_AUTO_ATTR_S {
  CVI_U8 LumaStr[8][ISP_AUTO_ISO_STRENGTH_NUM];
  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_U16 NpSlopeR[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpSlopeGr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpSlopeGb[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpSlopeB[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpLumaThrR[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpLumaThrGr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpLumaThrGb[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpLumaThrB[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpLowOffsetR[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpLowOffsetGr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpLowOffsetGb[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpLowOffsetB[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpHighOffsetR[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpHighOffsetGr[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpHighOffsetGb[ISP_AUTO_ISO_STRENGTH_NUM];
  CVI_U16 NpHighOffsetB[ISP_AUTO_ISO_STRENGTH_NUM];
} ISP_NR_FILTER_AUTO_ATTR_S;

【Member】

Member

Description

LumaStr[8]

The reference image brightness adjusts the denoising strength respectively from dark to bright. The larger the value, the stronger the bright noise removal.

Value range: [0x0, 0x1f]

Data type: CVI_U8

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

NpSlopeR

The slope of the Noise profile in the R channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpSlopeGr

The slope of the Noise profile in the Gr channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpSlopeGb

Noise profile slope in Gb channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpSlopeB

The slope of the Noise profile on the B channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLumaThrR

Luminance threshold of the Noise profile in the R channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLumaThrGr

Luminance threshold of the Noise profile in the Gr channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLumaThrGb

Luminance threshold of Noise profile in Gb channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLumaThrB

The brightness threshold of the Noise profile in the B channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLowOffsetR

The minimum noise level allowed by the Noise profile in the R channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLowOffsetGr

The minimum noise level allowed by the Noise profile in the Gr channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLowOffsetGb

The minimum noise level allowed by the Noise profile on the Gb channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpLowOffsetB

The minimum noise level allowed by Noise profile in channel B

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpHighOffsetR

The maximum allowable noise level of the Noise profile in the R channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpHighOffsetGb

The maximum noise level allowed by the Noise profile in the Gr channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpHighOffsetGr

The maximum noise level allowed by the Noise profile in the Gb channel

Value range: [0x0, 0x3ff]

Data type: CVI_U8

NpHighOffsetB

Noise profile maximum allowable noise level in channel B

Value range: [0x0, 0x3ff]

Data type: CVI_U8

【Note】

None.

【Related Data Type and Interface】

13.3.6. ISP_NR_FILTER_ATTR_S

【Description】

  • Bayer noise reduction filter attribute

【Syntax】

typedef struct _ISP_NR_FILTER_ATTR_S {
  CVI_U8 TuningMode;
  ISP_NR_FILTER_MANUAL_ATTR_S stManual;
  ISP_NR_FILTER_AUTO_ATTR_S stAuto;
} ISP_NR_FILTER_ATTR_S;

【Member】

Member

Description

TuningMode

Output debug strategy, auxiliary adjustment parameters.

8: BNR image result.

11:Flat/Edge Detection Image Result.

12:Vertical Edge Detection Image Result.

13:Horizontal edge detection image result.

14:Anti-diagonal edge detection image result.

15:Diagonal edge detection image result.

Value range: [0x0, 0xf]

Data type: CVI_U8

stManual

Automatic mode properties.

stAuto

Manual mode properties.

【Note】

None.

【Related Data Type and Interface】

13.3.7. ISP_RLSC_MANUAL_ATTR_S

【Description】

Bayer Noise Reduction RLSC Manual Properties

【Syntax】

typedef struct cviISP_RLSC_MANUAL_ATTR_S {
  CVI_U16 RadialStr;
} ISP_RLSC_MANUAL_ATTR_S;

【Member】

Member

Description

RadialStr

Used to adjust RLSC calibrated strength.The larger the value, the closer to the calibrated strength.

Value range: [0x0, 0xfff]

Data type: CVI_U16

【Note】

None.

【Related Data Type and Interface】

  • CVI_ISP_SetRLSCAttr

  • CVI_ISP_GetRLSCAttr

13.3.8. ISP_RLSC_AUTO_ATTR_S

【Description】

Bayer noise reduction RLSC automatic attribute

【Syntax】

typedef struct cviISP_RLSC_AUTO_ATTR_S {
  CVI_U16 RadialStr[ISP_AUTO_ISO_STRENGTH_NUM];
} ISP_RLSC_AUTO_ATTR_S;

【Member】

Member

Description

RadialStr

Used to adjust RLSC calibrated strength.The larger the value, the closer to the calibrated strength.

Value range: [0x0, 0xfff]

Data type: CVI_U16

【Note】

None.

【Related Data Type and Interface】

  • CVI_ISP_SetRLSCAttr

  • CVI_ISP_GetRLSCAttr

13.3.9. ISP_RLSC_ATTR_S

【Description】

Bayer noise reduction RLSC attribute

【Syntax】

typedef struct _ISP_RLSC_ATTR_S {
  CVI_BOOL RlscEnable;
  CVI_U16 RlscCenterX;
  CVI_U16 RlscCenterY;
  ISP_RLSC_MANUAL_ATTR_S stManual;
  ISP_RLSC_AUTO_ATTR_S stAuto;
} ISP_RLSC_ATTR_S;

【Member】

Member

Description

RlscEnable

Used to adjust RLSC calibrated strength.The larger the value, the closer to the calibrated strength.

Value range: [0, 1]

Data type: CVI_BOOL

RlscCenterX

X Center Location

Value range: [0x0, 0xfff]

Data type: CVI_U16

RlscCenterY

Y Center Location

Value range: [0x0, 0x7ff]

Data type: CVI_U16

stManual

Bayer Noise Reduction RLSC Manual Mode Properties

stAuto

Bayer Noise Reduction RLSC Automatic Mode Properties

【Note】

None.

【Related Data Type and Interface】

  • CVI_ISP_SetRLSCAttr

  • CVI_ISP_GetRLSCAttr