V4L2_META_FMT_BCM2835_ISP_STATS (‘BSTA’)

BCM2835 ISP Statistics

Description

The BCM2835 ISP hardware calculate image statistics for an input Bayer frame. These statistics are obtained from the “bcm2835-isp0-capture3” device node using the v4l2_meta_format interface. They are formatted as described by the bcm2835_isp_stats structure below.

#define DEFAULT_AWB_REGIONS_X 16
#define DEFAULT_AWB_REGIONS_Y 12

#define NUM_HISTOGRAMS 2
#define NUM_HISTOGRAM_BINS 128
#define AWB_REGIONS (DEFAULT_AWB_REGIONS_X * DEFAULT_AWB_REGIONS_Y)
#define FLOATING_REGIONS 16
#define AGC_REGIONS 16
#define FOCUS_REGIONS 12
struct bcm2835_isp_stats_hist

Histogram statistics

Definition:

struct bcm2835_isp_stats_hist {
    __u32 r_hist[NUM_HISTOGRAM_BINS];
    __u32 g_hist[NUM_HISTOGRAM_BINS];
    __u32 b_hist[NUM_HISTOGRAM_BINS];
};

Members

r_hist

Red channel histogram.

g_hist

Combined green channel histogram.

b_hist

Blue channel histogram.

struct bcm2835_isp_stats_region

Region sums.

Definition:

struct bcm2835_isp_stats_region {
    __u32 counted;
    __u32 notcounted;
    __u64 r_sum;
    __u64 g_sum;
    __u64 b_sum;
};

Members

counted

The number of 2x2 bayer tiles accumulated.

notcounted

The number of 2x2 bayer tiles not accumulated.

r_sum

Total sum of counted pixels in the red channel for a region.

g_sum

Total sum of counted pixels in the green channel for a region.

b_sum

Total sum of counted pixels in the blue channel for a region.

struct bcm2835_isp_stats_focus

Focus statistics.

Definition:

struct bcm2835_isp_stats_focus {
    __u64 contrast_val[2][2];
    __u32 contrast_val_num[2][2];
};

Members

contrast_val

Focus measure - accumulated output of the focus filter. In the first dimension, index [0] counts pixels below a preset threshold, and index [1] counts pixels above the threshold. In the second dimension, index [0] uses the first predefined filter, and index [1] uses the second predefined filter.

contrast_val_num

The number of counted pixels in the above accumulation.

struct bcm2835_isp_stats

ISP statistics.

Definition:

struct bcm2835_isp_stats {
    __u32 version;
    __u32 size;
    struct bcm2835_isp_stats_hist hist[NUM_HISTOGRAMS];
    struct bcm2835_isp_stats_region awb_stats[AWB_REGIONS];
    struct bcm2835_isp_stats_region floating_stats[FLOATING_REGIONS];
    struct bcm2835_isp_stats_region agc_stats[AGC_REGIONS];
    struct bcm2835_isp_stats_focus focus_stats[FOCUS_REGIONS];
};

Members

version

Version of the bcm2835_isp_stats structure.

size

Size of the bcm2835_isp_stats structure.

hist

Histogram statistics for the entire image.

awb_stats

Statistics for the regions defined for AWB calculations.

floating_stats

Statistics for arbitrarily placed (floating) regions.

agc_stats

Statistics for the regions defined for AGC calculations.

focus_stats

Focus filter statistics for the focus regions.