BCM2835 ISP Driver¶
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. |
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 |
Configuration Parameters¶
-
struct bcm2835_isp_rational¶
Rational value type.
Definition:
struct bcm2835_isp_rational {
__s32 num;
__u32 den;
};
Members
num
Numerator.
den
Denominator.
-
struct bcm2835_isp_ccm¶
Colour correction matrix.
Definition:
struct bcm2835_isp_ccm {
struct bcm2835_isp_rational ccm[3][3];
__s32 offsets[3];
};
Members
ccm
3x3 correction matrix coefficients.
offsets
1x3 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
enabled
Enable custom CCM.
ccm
Custom 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_1
Gains are u0.8 format, starting at 1.0
GAIN_FORMAT_U1P7_0
Gains are u1.7 format, starting at 0.0
GAIN_FORMAT_U1P7_1
Gains are u1.7 format, starting at 1.0
GAIN_FORMAT_U2P6_0
Gains are u2.6 format, starting at 0.0
GAIN_FORMAT_U2P6_1
Gains are u2.6 format, starting at 1.0
GAIN_FORMAT_U3P5_0
Gains are u3.5 format, starting at 0.0
GAIN_FORMAT_U3P5_1
Gains are u3.5 format, starting at 1.0
GAIN_FORMAT_U4P10
Gains 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
enabled
Enable lens shading.
grid_cell_size
Size of grid cells in samples (16, 32, 64, 128 or 256).
grid_width
Width of lens shading tables in grid cells.
grid_stride
Row to row distance (in grid cells) between grid cells in the same horizontal location.
grid_height
Height of lens shading tables in grid cells.
dmabuf
dmabuf file handle containing the table.
ref_transform
Reference transform - unsupported, please pass zero.
corner_sampled
Whether the gains are sampled at the corner points of the grid cells or in the cell centres.
gain_format
Format 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
enabled
Enable black level.
black_level_r
Black level for red channel.
black_level_g
Black level for green channels.
black_level_b
Black 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
enabled
Enable green equalisation.
offset
Fixed offset of the green equalisation threshold.
slope
Slope 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
enabled
Enable 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
enabled
Enable denoise.
constant
Fixed offset of the noise threshold.
slope
Slope of the noise threshold.
strength
Denoise 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
enabled
Enable sharpening.
threshold
Threshold at which to start sharpening pixels.
strength
Strength with which pixel sharpening increases.
limit
Limit to the amount of sharpening applied.
-
enum bcm2835_isp_dpc_mode¶
defective pixel correction (DPC) strength.
Constants
DPC_MODE_OFF
No DPC.
DPC_MODE_NORMAL
Normal DPC.
DPC_MODE_STRONG
Strong 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
enabled
Enable DPC.
strength
DPC strength (see enum
bcm2835_isp_dpc_mode
).