|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
14 #define PRINT(string,...) fprintf(stderr, "[libisp->%s()] " string,__FUNCTION__ , ##__VA_ARGS__)
17 #define VERBOSE_PRINT PRINT
19 #define VERBOSE_PRINT(...)
22 #define AVI_BASE 0x400000
23 #define AVI_SIZE 0x100000
24 #define AVI_MASK (AVI_SIZE - 1)
34 #define AVI_ISP_STAT_YUV_MAX_WAIT 3
38 #define AVI_ISP_IOGET_OFFSETS _IOR('F', 0x33, struct avi_isp_offsets)
41 #define readl(_addr) (*((volatile uint32_t *)(_addr)))
42 #define writel(_val, _addr) (*((volatile uint32_t *)(_addr)) = _val)
94 perror(
"ioctl(AVI_ISP_IOGET_OFFSETS) failed");
110 ctx->
devmem = open(
"/dev/mem", O_RDWR);
113 perror(
"Can't open /dev/mem");
118 PROT_READ | PROT_WRITE,
121 if (ctx->
avi_base == (
unsigned long) MAP_FAILED) {
122 perror(
"mmap failed");
127 goto get_offsets_failed;
145 for (i = chain_yuv_inter ; i <
ISP_NODE_NR ; i++) {
224 VERBOSE_PRINT(
"[YUV-STAT] Requesting window: [%d %d],[%d %d], [%d %d]\n",
232 VERBOSE_PRINT(
"[YUV-STAT] Setting window: [%d %d],[%d %d]\n",
242 VERBOSE_PRINT(
"[YUV-STAT] Current settings: [%d %d] [%d %d] [%d %d] [%d %d] [%d] [%d %d] [%d]\n",
266 fprintf(stderr,
"[YUV-STAT] Error isp_ctx.devmem < 0\n");
271 avi_isp_statistics_yuv_get_registers(&
isp_ctx, &stats_yuv);
286 fprintf(stderr,
"[YUV-STAT] Error requesting YUV stats\n");
304 avi_isp_statistics_yuv_ae_histogram_y_get_registers(&
isp_ctx, &histogram);
306 for (i = 0; i < 256; ++i) {
316 const void *reg_base,
324 for (i = 0; i <
s; i++) {
338 for (i = 0; i <
s; i++) {
343 #define EXPAND_AS_FUNCTION(_node) \
344 void avi_isp_ ## _node ## _set_registers(struct libisp_context *c, \
345 struct avi_isp_ ## _node ## _regs const *regs) \
347 memcpy_to_registers(c->offsets[_node], regs, sizeof(*regs)); \
350 void avi_isp_ ## _node ## _get_registers(struct libisp_context *c, \
351 struct avi_isp_ ## _node ## _regs *regs) \
353 memcpy_from_registers(regs, c->offsets[_node], sizeof(*regs)); \
#define VERBOSE_PRINT(...)
union avi_isp_statistics_yuv_increments_log2 increments_log2
struct avi_isp_chain_yuv_inter_regs chain_yuv_inter
YUV chain bypass configuration (enable/disable features)
int isp_get_statistics_yuv(struct isp_yuv_stats_t *yuv_stats)
struct avi_isp_gamma_corrector_ry_lut_regs gc_ry_lut
Gamma corrector RY lut.
struct avi_isp_edge_enhancement_color_reduction_filter_regs eecrf
Edge enhancement + Color reduction.
#define AVI_ISP_IOGET_OFFSETS
#define EXPAND_AS_FUNCTION(_node)
#define AVI_ISP_VLFORMAT_32TO40
#define AVI_ISP_VLFORMAT_40TO32
union avi_isp_statistics_yuv_circle_pos_y_center circle_pos_y_center
#define AVI_ISP_COLOR_CORRECTION
union avi_isp_statistics_yuv_measure_status measure_status
static struct libisp_context isp_ctx
#define AVI_ISP_GREEN_IMBALANCE_GREEN_RED_COEFF_MEM
#define AVI_ISP_EDGE_ENHANCEMENT_COLOR_REDUCTION_FILTER_EE_LUT
#define AVI_ISP_GAMMA_CORRECTOR_GU_LUT
#define AVI_ISP_CHROMATIC_ABERRATION
union avi_isp_statistics_yuv_circle_pos_y_squared circle_pos_y_squared
union avi_isp_statistics_yuv_circle_radius_squared circle_radius_squared
static int isp_set_statistics_yuv_window(void)
union avi_isp_statistics_yuv_awb_sum_u awb_sum_u
#define AVI_ISP_DEAD_PIXEL_CORRECTION
#define AVI_ISP_I3D_LUT_LUT_OUTSIDE
#define AVI_ISP_LENS_SHADING_CORRECTION_GREEN_COEFF_MEM
union avi_isp_statistics_yuv_circle_pos_x_squared circle_pos_x_squared
struct avi_isp_lens_shading_correction_red_coeff_mem_regs lsc_red_coeffs
Lens shade correction red coefficients.
uint32_t awb_nb_grey_pixels
#define AVI_ISP_EDGE_ENHANCEMENT_COLOR_REDUCTION_FILTER_EE_KERNEL_COEFF
#define AVI_ISP_LENS_SHADING_CORRECTION_RED_COEFF_MEM
#define AVI_ISP_LENS_SHADING_CORRECTION
struct avi_isp_statistics_bayer_regs statistics_bayer
Statistics bayer parameters.
union avi_isp_statistics_yuv_ae_nb_valid_y ae_nb_valid_y
#define AVI_ISP_GAMMA_CORRECTOR_BV_LUT
static int avi_isp_get_offsets_fd(int fd, struct avi_isp_offsets *off)
This is taken from libisp.
#define AVI_ISP_STATISTICS_BAYER
union avi_isp_statistics_yuv_measure_req measure_req
union avi_isp_statistics_yuv_circle_pos_x_center circle_pos_x_center
union avi_isp_statistics_yuv_awb_sum_y awb_sum_y
struct avi_isp_color_correction_regs color_correction
Color correction parameters.
#define AVI_ISP_GREEN_IMBALANCE_GREEN_BLUE_COEFF_MEM
#define AVI_ISP_DEAD_PIXEL_CORRECTION_CFA
struct libisp_config isp_config
static const struct usb_device_descriptor dev
static void memcpy_from_registers(void *reg_base, unsigned long addr, size_t s)
#define AVI_ISP_I3D_LUT_CLIP_MODE
#define AVI_ISP_LENS_SHADING_CORRECTION_BLUE_COEFF_MEM
#define writel(_val, _addr)
#define AVI_ISP_GREEN_IMBALANCE
struct avi_isp_gamma_corrector_regs gamma_corrector
Gamma corrector (Curves)
struct avi_isp_gamma_corrector_bv_lut_regs gc_bv_lut
Gamma corrector BV lut.
struct avi_isp_bayer_regs bayer
< Chromatic abberation (Disabled for now)
static int open_isp_fd(struct libisp_context *ctx, int fd)
This is taken from libisp.
struct avi_isp_vlformat_32to40_regs vlformat_32to40
Conversion factor (10bit to 10bit default)
union avi_isp_statistics_yuv_window_pos_y window_pos_y
int configure_isp(struct v4l2_device *dev)
struct avi_isp_denoising_regs denoising
Denoising parameters.
struct avi_isp_chroma_regs chroma
Color space conversion.
union avi_isp_statistics_yuv_awb_nb_grey_pixels awb_nb_grey_pixels
#define AVI_ISP_CHAIN_YUV_INTER
struct avi_isp_chain_bayer_inter_regs bayer_inter
Enable or disable bayer ISP functions by bypassing them.
#define AVI_ISP_STAT_YUV_MAX_WAIT
struct avi_isp_green_imbalance_green_red_coeff_mem_regs grim_gr
Green imbalance GR coefficients.
struct avi_isp_vlformat_40to32_regs vlformat_40to32
Conversion factor (10bit to 10bit default)
#define AVI_ISP_I3D_LUT_LUT_INSIDE
union avi_isp_statistics_yuv_awb_threshold awb_threshold
uint16_t requestWindow[6]
struct avi_isp_lens_shading_correction_regs lens_shading_correction
Lens shade correction.
#define AVI_ISP_DEAD_PIXEL_CORRECTION_LIST_MEM
#define AVI_ISP_GAMMA_CORRECTOR_RY_LUT
int isp_request_statistics_yuv_window(uint16_t x_start, uint16_t x_end, uint16_t y_start, uint16_t y_end, uint16_t x_odd_inc, uint16_t y_odd_inc)
union avi_isp_statistics_yuv_awb_sum_v awb_sum_v
struct avi_isp_gamma_corrector_gu_lut_regs gc_gu_lut
Gamma corrector GU lut.
struct avi_isp_statistics_yuv_regs statistics_yuv
YUV statistics parameters.
struct avi_isp_pedestal_regs pedestal
Pedestral parameters (substract from pixels)
unsigned offsets[ISP_NODE_NR]
static void memcpy_to_registers(unsigned long addr, const void *reg_base, size_t s)
struct avi_isp_edge_enhancement_color_reduction_filter_ee_lut_regs eecrf_lut
Edge enhancement + Color correction lut.
struct avi_isp_green_imbalance_regs green_imbalance
Green imbalance correction.
uint32_t ae_histogram_Y[256]
struct avi_isp_lens_shading_correction_blue_coeff_mem_regs lsc_blue_coeffs
Lens shade correction blue coefficients.
#define AVI_DEFINE_NODE(EXPANDER)
#define AVI_ISP_CHAIN_BAYER_INTER
union avi_isp_statistics_yuv_ae_histogram_y ae_histogram_y[256]
struct avi_isp_dead_pixel_correction_regs dead_pixel_correction
Dead pixel correction (disabled)
#define AVI_ISP_DENOISING
#define AVI_ISP_EDGE_ENHANCEMENT_COLOR_REDUCTION_FILTER
#define AVI_ISP_STATISTICS_YUV_AE_HISTOGRAM_Y
union avi_isp_statistics_yuv_window_pos_x window_pos_x
struct avi_isp_lens_shading_correction_green_coeff_mem_regs lsc_green_coeffs
Lens shade correction green coefficients.
struct avi_isp_green_imbalance_green_blue_coeff_mem_regs grim_gb
Green imbalance GB coefficients.
static const unsigned isp_bases[]