7. BCM2835 ISP Driver¶
7.1. Introduction¶
The BCM2835 Image Sensor Pipeline (ISP) is a fixed function hardware pipeline for performing image processing operations. Images are fed to the input of the ISP through memory frame buffers. These images may be in various YUV, RGB, or Bayer formats. A typical use case would have Bayer images obtained from an image sensor by the BCM2835 Unicam peripheral, written to a memory frame buffer, and finally fed into the input of the ISP. Two concurrent output images may be generated in YUV or RGB format at different resolutions. Statistics output is also generated for Bayer input images.
The bcm2835-isp driver exposes the following media pads as V4L2 device nodes:
Pad |
Direction |
Purpose |
Formats |
“bcm2835-isp0-output0” |
sink |
Accepts Bayer, RGB or YUV format frame buffers as input to the ISP HW pipeline. |
RAW8, RAW10P, RAW12P, RAW14P, RAW16, RGB24/BGR24, YUYV, YVYU, UYVY, VYUY, YUV420/YVU420 |
“bcm2835-isp0-capture1” |
source |
High resolution YUV or RGB processed output from the ISP. |
RGB565, RGB24/BGR24, ABGR32, YUYV, YVYU, UYVY, VYUY. YUV420/YVU420, NV12/NV21, |
“bcm2835-isp0-capture2” |
source |
Low resolution YUV processed output from the ISP. The output of this pad cannot have a resolution larger than the “bcm2835-isp0-capture1” pad in any dimension. |
|
“bcm2835-isp0-capture1” |
source |
Image statistics calculated from the input image provided on the “bcm2835-isp0-output0” pad. Statistics are only available for Bayer format input images. |
7.2. Pipeline Configuration¶
The ISP pipeline can be configure through user-space by calling VIDIOC_S_EXT_CTRLS on the “bcm2835-isp0-output0” node with the appropriate parameters as shown in the table below.
id |
Parameter |
|
struct |
|
struct |
|
struct |
|
struct |
|
struct |
|
struct |
|
struct |
|
struct |
7.2.1. Configuration Parameters¶
-
struct
bcm2835_isp_rational¶ Rational value type.
Definition
struct bcm2835_isp_rational {
__s32 num;
__u32 den;
};
Members
numNumerator.
denDenominator.
-
struct
bcm2835_isp_ccm¶ Colour correction matrix.
Definition
struct bcm2835_isp_ccm {
struct bcm2835_isp_rational ccm[3][3];
__s32 offsets[3];
};
Members
ccm3x3 correction matrix coefficients.
offsets1x3 correction offsets.
-
struct
bcm2835_isp_custom_ccm¶ Custom CCM applied with the V4L2_CID_USER_BCM2835_ISP_CC_MATRIX ctrl.
Definition
struct bcm2835_isp_custom_ccm {
__u32 enabled;
struct bcm2835_isp_ccm ccm;
};
Members
enabledEnable custom CCM.
ccmCustom CCM coefficients and offsets.
-
enum
bcm2835_isp_gain_format¶ format of the gains in the lens shading tables used with the V4L2_CID_USER_BCM2835_ISP_LENS_SHADING ctrl.
Constants
GAIN_FORMAT_U0P8_1Gains are u0.8 format, starting at 1.0
GAIN_FORMAT_U1P7_0Gains are u1.7 format, starting at 0.0
GAIN_FORMAT_U1P7_1Gains are u1.7 format, starting at 1.0
GAIN_FORMAT_U2P6_0Gains are u2.6 format, starting at 0.0
GAIN_FORMAT_U2P6_1Gains are u2.6 format, starting at 1.0
GAIN_FORMAT_U3P5_0Gains are u3.5 format, starting at 0.0
GAIN_FORMAT_U3P5_1Gains are u3.5 format, starting at 1.0
GAIN_FORMAT_U4P10Gains are u4.10 format, starting at 0.0
-
struct
bcm2835_isp_lens_shading¶ Lens shading tables supplied with the V4L2_CID_USER_BCM2835_ISP_LENS_SHADING ctrl.
Definition
struct bcm2835_isp_lens_shading {
__u32 enabled;
__u32 grid_cell_size;
__u32 grid_width;
__u32 grid_stride;
__u32 grid_height;
__s32 dmabuf;
__u32 ref_transform;
__u32 corner_sampled;
__u32 gain_format;
};
Members
enabledEnable lens shading.
grid_cell_sizeSize of grid cells in samples (16, 32, 64, 128 or 256).
grid_widthWidth of lens shading tables in grid cells.
grid_strideRow to row distance (in grid cells) between grid cells in the same horizontal location.
grid_heightHeight of lens shading tables in grid cells.
dmabufdmabuf file handle containing the table.
ref_transformReference transform - unsupported, please pass zero.
corner_sampledWhether the gains are sampled at the corner points of the grid cells or in the cell centres.
gain_formatFormat of the gains (see enum
bcm2835_isp_gain_format).
-
struct
bcm2835_isp_black_level¶ Sensor black level set with the V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL ctrl.
Definition
struct bcm2835_isp_black_level {
__u32 enabled;
__u16 black_level_r;
__u16 black_level_g;
__u16 black_level_b;
__u8 padding[2];
};
Members
enabledEnable black level.
black_level_rBlack level for red channel.
black_level_gBlack level for green channels.
black_level_bBlack level for blue channel.
-
struct
bcm2835_isp_geq¶ Green equalisation parameters set with the V4L2_CID_USER_BCM2835_ISP_GEQ ctrl.
Definition
struct bcm2835_isp_geq {
__u32 enabled;
__u32 offset;
struct bcm2835_isp_rational slope;
};
Members
enabledEnable green equalisation.
offsetFixed offset of the green equalisation threshold.
slopeSlope of the green equalisation threshold.
-
struct
bcm2835_isp_gamma¶ Gamma parameters set with the V4L2_CID_USER_BCM2835_ISP_GAMMA ctrl.
Definition
struct bcm2835_isp_gamma {
__u32 enabled;
__u16 x[BCM2835_NUM_GAMMA_PTS];
__u16 y[BCM2835_NUM_GAMMA_PTS];
};
Members
enabledEnable gamma adjustment.
-
struct
bcm2835_isp_denoise¶ Denoise parameters set with the V4L2_CID_USER_BCM2835_ISP_DENOISE ctrl.
Definition
struct bcm2835_isp_denoise {
__u32 enabled;
__u32 constant;
struct bcm2835_isp_rational slope;
struct bcm2835_isp_rational strength;
};
Members
enabledEnable denoise.
constantFixed offset of the noise threshold.
slopeSlope of the noise threshold.
strengthDenoise strength between 0.0 (off) and 1.0 (maximum).
-
struct
bcm2835_isp_sharpen¶ Sharpen parameters set with the V4L2_CID_USER_BCM2835_ISP_SHARPEN ctrl.
Definition
struct bcm2835_isp_sharpen {
__u32 enabled;
struct bcm2835_isp_rational threshold;
struct bcm2835_isp_rational strength;
struct bcm2835_isp_rational limit;
};
Members
enabledEnable sharpening.
thresholdThreshold at which to start sharpening pixels.
strengthStrength with which pixel sharpening increases.
limitLimit to the amount of sharpening applied.
-
enum
bcm2835_isp_dpc_mode¶ defective pixel correction (DPC) strength.
Constants
DPC_MODE_OFFNo DPC.
DPC_MODE_NORMALNormal DPC.
DPC_MODE_STRONGStrong DPC.
-
struct
bcm2835_isp_dpc¶ Defective pixel correction (DPC) parameters set with the V4L2_CID_USER_BCM2835_ISP_DPC ctrl.
Definition
struct bcm2835_isp_dpc {
__u32 enabled;
__u32 strength;
};
Members
enabledEnable DPC.
strengthDPC strength (see enum
bcm2835_isp_dpc_mode).