13 #define AVI_BASE 0x400000
14 #define AVI_SIZE 0x100000
15 #define AVI_MASK (AVI_SIZE - 1)
26 #define AVI_ISP_IOGET_OFFSETS _IOR('F', 0x33, struct avi_isp_offsets)
29 #define readl(_addr) (*((volatile uint32_t *)(_addr)))
30 #define writel(_val, _addr) (*((volatile uint32_t *)(_addr)) = _val)
80 perror(
"ioctl(AVI_ISP_IOGET_OFFSETS) failed");
96 ctx->
devmem = open(
"/dev/mem", O_RDWR);
99 perror(
"Can't open /dev/mem");
104 PROT_READ | PROT_WRITE,
107 if (ctx->
avi_base == (
unsigned long) MAP_FAILED) {
108 perror(
"mmap failed");
113 goto get_offsets_failed;
131 for (i = chain_yuv_inter ; i <
ISP_NODE_NR ; i++) {
173 avi_isp_green_imbalance_green_red_coeff_mem_set_registers(&isp_ctx, &
isp_config.
grim_gr);
174 avi_isp_green_imbalance_green_blue_coeff_mem_set_registers(&isp_ctx, &
isp_config.
grim_gb);
191 avi_isp_edge_enhancement_color_reduction_filter_set_registers(&isp_ctx, &
isp_config.
eecrf);
192 avi_isp_edge_enhancement_color_reduction_filter_ee_lut_set_registers(&isp_ctx, &
isp_config.
eecrf_lut);
210 avi_isp_statistics_yuv_get_registers(&isp_ctx, &stats_yuv);
220 avi_isp_statistics_yuv_ae_histogram_y_get_registers(&isp_ctx, &histogram);
222 for (i = 0; i < 256; ++i) {
231 const void *reg_base,
239 for (i = 0; i < s; i++) {
253 for (i = 0; i < s; i++) {
258 #define EXPAND_AS_FUNCTION(_node) \
259 void avi_isp_ ## _node ## _set_registers(struct libisp_context *c, \
260 struct avi_isp_ ## _node ## _regs const *regs) \
262 memcpy_to_registers(c->offsets[_node], regs, sizeof(*regs)); \
265 void avi_isp_ ## _node ## _get_registers(struct libisp_context *c, \
266 struct avi_isp_ ## _node ## _regs *regs) \
268 memcpy_from_registers(regs, c->offsets[_node], sizeof(*regs)); \
#define AVI_ISP_GREEN_IMBALANCE_GREEN_RED_COEFF_MEM
struct avi_isp_gamma_corrector_bv_lut_regs gc_bv_lut
Gamma corrector BV lut.
struct avi_isp_green_imbalance_green_blue_coeff_mem_regs grim_gb
Green imbalance GB coefficients.
struct avi_isp_pedestal_regs pedestal
Pedestral parameters (substract from pixels)
static const unsigned isp_bases[]
struct avi_isp_dead_pixel_correction_regs dead_pixel_correction
Dead pixel correction (disabled)
#define AVI_ISP_EDGE_ENHANCEMENT_COLOR_REDUCTION_FILTER_EE_KERNEL_COEFF
#define AVI_ISP_STATISTICS_BAYER
#define AVI_ISP_LENS_SHADING_CORRECTION_BLUE_COEFF_MEM
#define AVI_ISP_LENS_SHADING_CORRECTION_RED_COEFF_MEM
struct avi_isp_gamma_corrector_ry_lut_regs gc_ry_lut
Gamma corrector RY lut.
struct avi_isp_chain_yuv_inter_regs chain_yuv_inter
YUV chain bypass configuration (enable/disable features)
static void memcpy_to_registers(unsigned long addr, const void *reg_base, size_t s)
struct avi_isp_green_imbalance_green_red_coeff_mem_regs grim_gr
Green imbalance GR coefficients.
#define AVI_ISP_CHAIN_BAYER_INTER
struct avi_isp_lens_shading_correction_red_coeff_mem_regs lsc_red_coeffs
Lens shade correction red coefficients.
#define AVI_ISP_VLFORMAT_32TO40
#define AVI_ISP_CHAIN_YUV_INTER
static int avi_isp_get_offsets_fd(int fd, struct avi_isp_offsets *off)
This is taken from libisp.
int isp_get_statistics_yuv(struct isp_yuv_stats_t *yuv_stats)
union avi_isp_statistics_yuv_awb_sum_u awb_sum_u
struct avi_isp_lens_shading_correction_regs lens_shading_correction
Lens shade correction.
uint32_t awb_nb_grey_pixels
union avi_isp_statistics_yuv_ae_nb_valid_y ae_nb_valid_y
#define AVI_ISP_DENOISING
struct libisp_config isp_config
struct avi_isp_edge_enhancement_color_reduction_filter_ee_lut_regs eecrf_lut
Edge enhancement + Color correction lut.
int configure_isp(struct v4l2_device *dev)
struct avi_isp_vlformat_40to32_regs vlformat_40to32
Conversion factor (10bit to 10bit default)
#define AVI_ISP_EDGE_ENHANCEMENT_COLOR_REDUCTION_FILTER
union avi_isp_statistics_yuv_awb_sum_y awb_sum_y
struct avi_isp_vlformat_32to40_regs vlformat_32to40
Conversion factor (10bit to 10bit default)
#define AVI_ISP_DEAD_PIXEL_CORRECTION_LIST_MEM
#define AVI_ISP_EDGE_ENHANCEMENT_COLOR_REDUCTION_FILTER_EE_LUT
#define AVI_ISP_IOGET_OFFSETS
struct avi_isp_edge_enhancement_color_reduction_filter_regs eecrf
Edge enhancement + Color reduction.
static struct libisp_context isp_ctx
#define AVI_ISP_GREEN_IMBALANCE_GREEN_BLUE_COEFF_MEM
#define AVI_ISP_DEAD_PIXEL_CORRECTION
#define AVI_ISP_DEAD_PIXEL_CORRECTION_CFA
struct avi_isp_color_correction_regs color_correction
Color correction parameters.
static void memcpy_from_registers(void *reg_base, unsigned long addr, size_t s)
struct avi_isp_chain_bayer_inter_regs bayer_inter
Enable or disable bayer ISP functions by bypassing them.
#define writel(_val, _addr)
#define AVI_ISP_CHROMATIC_ABERRATION
struct avi_isp_bayer_regs bayer
< Chromatic abberation (Disabled for now)
unsigned offsets[ISP_NODE_NR]
#define AVI_ISP_GAMMA_CORRECTOR_GU_LUT
static const struct usb_device_descriptor dev
struct avi_isp_lens_shading_correction_blue_coeff_mem_regs lsc_blue_coeffs
Lens shade correction blue coefficients.
struct avi_isp_gamma_corrector_regs gamma_corrector
Gamma corrector (Curves)
union avi_isp_statistics_yuv_awb_nb_grey_pixels awb_nb_grey_pixels
struct avi_isp_statistics_yuv_regs statistics_yuv
YUV statistics parameters.
#define AVI_ISP_GAMMA_CORRECTOR_BV_LUT
struct avi_isp_gamma_corrector_gu_lut_regs gc_gu_lut
Gamma corrector GU lut.
union avi_isp_statistics_yuv_awb_sum_v awb_sum_v
struct avi_isp_chroma_regs chroma
Color space conversion.
struct avi_isp_statistics_bayer_regs statistics_bayer
Statistics bayer parameters.
#define AVI_ISP_COLOR_CORRECTION
static int open_isp_fd(struct libisp_context *ctx, int fd)
This is taken from libisp.
struct avi_isp_denoising_regs denoising
Denoising parameters.
#define AVI_DEFINE_NODE(EXPANDER)
#define AVI_ISP_I3D_LUT_CLIP_MODE
struct avi_isp_green_imbalance_regs green_imbalance
Green imbalance correction.
union avi_isp_statistics_yuv_ae_histogram_y ae_histogram_y[256]
#define AVI_ISP_LENS_SHADING_CORRECTION_GREEN_COEFF_MEM
#define AVI_ISP_LENS_SHADING_CORRECTION
#define AVI_ISP_VLFORMAT_40TO32
uint32_t ae_histogram_Y[256]
#define AVI_ISP_I3D_LUT_LUT_OUTSIDE
struct avi_isp_lens_shading_correction_green_coeff_mem_regs lsc_green_coeffs
Lens shade correction green coefficients.
#define AVI_ISP_GREEN_IMBALANCE
#define EXPAND_AS_FUNCTION(_node)
#define AVI_ISP_STATISTICS_YUV_AE_HISTOGRAM_Y
#define AVI_ISP_I3D_LUT_LUT_INSIDE
#define AVI_ISP_GAMMA_CORRECTOR_RY_LUT
int fd
The file pointer to the device.