mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(isp): add gamma correction driver to ISP
This commit is contained in:
parent
2884ce0eac
commit
f2d131aae4
@ -13,7 +13,8 @@ if(CONFIG_SOC_ISP_SUPPORTED)
|
||||
"src/isp_af.c"
|
||||
"src/isp_ccm.c"
|
||||
"src/isp_awb.c"
|
||||
"src/isp_ae.c")
|
||||
"src/isp_ae.c"
|
||||
"src/isp_gamma.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_ISP_BF_SUPPORTED)
|
||||
|
@ -35,7 +35,7 @@ typedef struct {
|
||||
* but it only takes effect until `esp_isp_ccm_enable` is called
|
||||
*
|
||||
* @param[in] proc Processor handle
|
||||
* @param[in] ccm_cfg CCM configurations, set NULL to de-configure the ISP CCM
|
||||
* @param[in] ccm_cfg CCM configurations
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK On success
|
||||
|
76
components/esp_driver_isp/include/driver/isp_gamma.h
Normal file
76
components/esp_driver_isp/include/driver/isp_gamma.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "esp_err.h"
|
||||
#include "driver/isp_types.h"
|
||||
#include "hal/color_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief ISP gamma Correction configuration
|
||||
*
|
||||
* @note This function is allowed to be called before or after esp_isp_gamma_enable(),
|
||||
* but it only takes effect until esp_isp_gamma_enable() is called
|
||||
*
|
||||
* @param[in] proc Processor handle
|
||||
* @param[in] component One of the R/G/B components, color_component_t
|
||||
* @param[in] pts Group of points that describe the desired gamma correction curve;<br>
|
||||
* Passing in NULL to reset to default parameters (no correction)
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK On success
|
||||
* - ESP_ERR_INVALID_ARG If the combination of arguments is invalid
|
||||
*/
|
||||
esp_err_t esp_isp_gamma_configure(isp_proc_handle_t proc, color_component_t component, const isp_gamma_curve_points_t *pts);
|
||||
|
||||
/**
|
||||
* @brief Enable ISP gamma function
|
||||
*
|
||||
* @param[in] proc Processor handle
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK On success
|
||||
* - ESP_ERR_INVALID_ARG If the combination of arguments is invalid.
|
||||
*/
|
||||
esp_err_t esp_isp_gamma_enable(isp_proc_handle_t proc);
|
||||
|
||||
/**
|
||||
* @brief Disable ISP gamma function
|
||||
*
|
||||
* @param[in] proc Processor handle
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK On success
|
||||
* - ESP_ERR_INVALID_ARG If the combination of arguments is invalid.
|
||||
*/
|
||||
esp_err_t esp_isp_gamma_disable(isp_proc_handle_t proc);
|
||||
|
||||
/**
|
||||
* @brief Helper function to fill the isp_gamma_curve_points_t structure, giving the mathematical function of the desired gamma correction curve
|
||||
*
|
||||
* @note The raw values are sampled with equal spacing
|
||||
*
|
||||
* @param[in] gamma_correction_operator The desired gamma correction curve y = f(x).<br>
|
||||
* x is the raw value, in [0, 256]; y is the gamma-corrected value, in [0, 256];<br>
|
||||
* y can be equal to 256 only if x = 256. For any other x value, y should be always less than 256.
|
||||
* @param[out] pts Pointer to the to-be-filled isp_gamma_curve_points_t structure
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK On success
|
||||
* - ESP_ERR_INVALID_ARG If the combination of arguments is invalid.
|
||||
*/
|
||||
esp_err_t esp_isp_gamma_fill_curve_points(uint32_t (* gamma_correction_operator)(uint32_t), isp_gamma_curve_points_t *pts);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -3,6 +3,8 @@ archive: libesp_driver_isp.a
|
||||
entries:
|
||||
if ISP_CTRL_FUNC_IN_IRAM = y:
|
||||
isp_sharpen: esp_isp_sharpen_configure (noflash)
|
||||
isp_gamma: esp_isp_gamma_configure (noflash)
|
||||
isp_gamma: esp_isp_gamma_fill_curve_points (noflash)
|
||||
|
||||
[mapping:isp_hal]
|
||||
archive: libhal.a
|
||||
|
99
components/esp_driver_isp/src/isp_gamma.c
Normal file
99
components/esp_driver_isp/src/isp_gamma.c
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <esp_types.h>
|
||||
#include <sys/param.h>
|
||||
#include "esp_log.h"
|
||||
#include "esp_check.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "driver/isp_core.h"
|
||||
#include "driver/isp_gamma.h"
|
||||
#include "esp_private/isp_private.h"
|
||||
#include "hal/isp_types.h"
|
||||
|
||||
static const char *TAG = "ISP_GAMMA";
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
Gamma Correction
|
||||
---------------------------------------------------------------*/
|
||||
// A curve of y = x indicates no gamma curve correction involved
|
||||
static inline uint32_t s_gamma_linear_curve(uint32_t x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
esp_err_t esp_isp_gamma_configure(isp_proc_handle_t proc, color_component_t component, const isp_gamma_curve_points_t *pts)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE_ISR(proc, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
|
||||
ESP_RETURN_ON_FALSE_ISR(component < COLOR_COMPONENT_INVALID, ESP_ERR_INVALID_ARG, TAG, "invalid argument: component");
|
||||
|
||||
if (!pts) {
|
||||
isp_gamma_curve_points_t linear_pts = {};
|
||||
esp_isp_gamma_fill_curve_points(s_gamma_linear_curve, &linear_pts);
|
||||
isp_ll_gamma_set_correction_curve(proc->hal.hw, component, &linear_pts);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
// Check the validation of x values
|
||||
uint32_t x_prev = 0;
|
||||
for (int i = 0; i < ISP_GAMMA_CURVE_POINTS_NUM; i++) {
|
||||
uint32_t x_i = pts->pt[i].x;
|
||||
if (i == ISP_GAMMA_CURVE_POINTS_NUM - 1) {
|
||||
ESP_RETURN_ON_FALSE_ISR(x_i == 255, ESP_ERR_INVALID_ARG, TAG, "invalid argument: pts->pt[ISP_GAMMA_CURVE_POINTS_NUM - 1].x != 255");
|
||||
x_i = 256;
|
||||
}
|
||||
uint32_t x_delta = x_i - x_prev;
|
||||
ESP_RETURN_ON_FALSE_ISR((x_i > x_prev) && ((x_delta & (x_delta - 1)) == 0), ESP_ERR_INVALID_ARG, TAG, "invalid argument: pts->pt[%d].x", i);
|
||||
x_prev = x_i;
|
||||
}
|
||||
|
||||
isp_ll_gamma_set_correction_curve(proc->hal.hw, component, pts);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_isp_gamma_enable(isp_proc_handle_t proc)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(proc, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
|
||||
|
||||
portENTER_CRITICAL(&proc->spinlock);
|
||||
isp_ll_gamma_enable(proc->hal.hw, true);
|
||||
portEXIT_CRITICAL(&proc->spinlock);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_isp_gamma_disable(isp_proc_handle_t proc)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(proc, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
|
||||
|
||||
portENTER_CRITICAL(&proc->spinlock);
|
||||
isp_ll_gamma_enable(proc->hal.hw, false);
|
||||
portEXIT_CRITICAL(&proc->spinlock);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_isp_gamma_fill_curve_points(uint32_t (* gamma_correction_operator)(uint32_t), isp_gamma_curve_points_t *pts)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE_ISR(gamma_correction_operator && pts, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
|
||||
|
||||
uint32_t x_i = 0;
|
||||
uint32_t y_i = 0;
|
||||
const uint32_t x_delta = 256 / ISP_GAMMA_CURVE_POINTS_NUM;
|
||||
for (int i = 0; i < ISP_GAMMA_CURVE_POINTS_NUM; i++) {
|
||||
x_i += x_delta;
|
||||
x_i = MIN(x_i, 255);
|
||||
y_i = gamma_correction_operator(x_i);
|
||||
#if !CONFIG_ISP_CTRL_FUNC_IN_IRAM
|
||||
ESP_LOGD(TAG, "x[%d] = %"PRIu32", y[%d] = %"PRIu32"", i, x_i, i, y_i);
|
||||
#endif
|
||||
ESP_RETURN_ON_FALSE_ISR(y_i < 256, ESP_ERR_INVALID_ARG, TAG, "invalid argument: gamma_correction_operator");
|
||||
pts->pt[i].x = x_i;
|
||||
pts->pt[i].y = y_i;
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
@ -1543,6 +1543,77 @@ static inline void isp_ll_yuv_set_std(isp_dev_t *hw, isp_yuv_conv_std_t std)
|
||||
hw->yuv_format.yuv_mode = std;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
Gamma Correction
|
||||
---------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Enable / Disable gamma
|
||||
*
|
||||
* @param[in] hw Hardware instance address
|
||||
* @param[in] enable Enable / Disable
|
||||
*/
|
||||
static inline void isp_ll_gamma_enable(isp_dev_t *hw, bool enable)
|
||||
{
|
||||
hw->cntl.gamma_en = enable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set gamma correction curve for one of the R/G/B components
|
||||
*
|
||||
* @param[in] hw Hardware instance address
|
||||
* @param[in] channel One of the R/G/B components, color_component_t
|
||||
* @param[in] pts Pointer to the structure that contains the information of the gamma curve
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void isp_ll_gamma_set_correction_curve(isp_dev_t *hw, color_component_t channel, const isp_gamma_curve_points_t *pts)
|
||||
{
|
||||
int ch_index = -1;
|
||||
switch (channel) {
|
||||
case COLOR_COMPONENT_R:
|
||||
ch_index = 0;
|
||||
break;
|
||||
case COLOR_COMPONENT_G:
|
||||
ch_index = 1;
|
||||
break;
|
||||
case COLOR_COMPONENT_B:
|
||||
ch_index = 2;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
uint32_t x_prev = 0;
|
||||
uint32_t gamma_x1 = 0, gamma_x2 = 0, gamma_y1 = 0, gamma_y2 = 0, gamma_y3 = 0, gamma_y4 = 0;
|
||||
for (int i = 0; i < ISP_GAMMA_CURVE_POINTS_NUM; i++) {
|
||||
uint32_t x_delta = (i == (ISP_GAMMA_CURVE_POINTS_NUM - 1) ? 256 : pts->pt[i].x) - x_prev;
|
||||
uint32_t power = __builtin_ctz(x_delta);
|
||||
HAL_ASSERT((x_delta & (x_delta - 1)) == 0 && power < 8);
|
||||
if (i < 4) {
|
||||
gamma_x1 |= (power << (21 - i * 3));
|
||||
gamma_y1 |= (pts->pt[i].y << (24 - i * 8));
|
||||
} else if (i < 8) {
|
||||
gamma_x1 |= (power << (21 - i * 3));
|
||||
gamma_y2 |= (pts->pt[i].y << (24 - (i - 4) * 8));
|
||||
} else if (i < 12) {
|
||||
gamma_x2 |= (power << (21 - (i - 8) * 3));
|
||||
gamma_y3 |= (pts->pt[i].y << (24 - (i - 8) * 8));
|
||||
} else {
|
||||
gamma_x2 |= (power << (21 - (i - 8) * 3));
|
||||
gamma_y4 |= (pts->pt[i].y << (24 - (i - 12) * 8));
|
||||
}
|
||||
x_prev = pts->pt[i].x;
|
||||
}
|
||||
hw->gamma_rgb_x[ch_index].gamma_x1.val = gamma_x1;
|
||||
hw->gamma_rgb_x[ch_index].gamma_x2.val = gamma_x2;
|
||||
hw->gamma_rgb_y[ch_index].gamma_y1.val = gamma_y1;
|
||||
hw->gamma_rgb_y[ch_index].gamma_y2.val = gamma_y2;
|
||||
hw->gamma_rgb_y[ch_index].gamma_y3.val = gamma_y3;
|
||||
hw->gamma_rgb_y[ch_index].gamma_y4.val = gamma_y4;
|
||||
|
||||
hw->gamma_ctrl.gamma_update = 1;
|
||||
while (hw->gamma_ctrl.gamma_update);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -188,6 +188,20 @@ typedef union {
|
||||
uint16_t val; /*!< 16-bit RGB565 value */
|
||||
} color_pixel_rgb565_data_t;
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
Color Components
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Color component
|
||||
*/
|
||||
typedef enum {
|
||||
COLOR_COMPONENT_R, /*!< R component */
|
||||
COLOR_COMPONENT_G, /*!< G component */
|
||||
COLOR_COMPONENT_B, /*!< B component */
|
||||
COLOR_COMPONENT_INVALID, /*!< Invalid color component */
|
||||
} color_component_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -115,7 +115,6 @@ typedef enum {
|
||||
|
||||
/**
|
||||
* @brief ISP AWB sample point in the ISP pipeline
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
ISP_AWB_SAMPLE_POINT_BEFORE_CCM, ///< Sample AWB data before CCM (Color Correction Matrix)
|
||||
@ -192,7 +191,7 @@ typedef union {
|
||||
uint32_t integer:ISP_SHARPEN_H_FREQ_COEF_INT_BITS; ///< Decimal part
|
||||
uint32_t reserved:ISP_SHARPEN_H_FREQ_COEF_RES_BITS; ///< Reserved
|
||||
};
|
||||
uint32_t val;
|
||||
uint32_t val; ///< 32-bit high freq pixel sharpeness coeff register value
|
||||
} isp_sharpen_h_freq_coeff;
|
||||
|
||||
/**
|
||||
@ -204,7 +203,7 @@ typedef union {
|
||||
uint32_t integer:ISP_SHARPEN_M_FREQ_COEF_INT_BITS; ///< Decimal part
|
||||
uint32_t reserved:ISP_SHARPEN_M_FREQ_COEF_RES_BITS; ///< Reserved
|
||||
};
|
||||
uint32_t val;
|
||||
uint32_t val; ///< 32-bit medium freq pixel sharpeness coeff register value
|
||||
} isp_sharpen_m_freq_coeff;
|
||||
|
||||
/**
|
||||
@ -215,6 +214,27 @@ typedef enum {
|
||||
ISP_SHARPEN_EDGE_PADDING_MODE_CUSTOM_DATA, ///< Fill Sharpen edge padding data with custom pixel data
|
||||
} isp_sharpen_edge_padding_mode_t;
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
Gamma Correction
|
||||
---------------------------------------------------------------*/
|
||||
#define ISP_GAMMA_CURVE_POINTS_NUM 16 ///< Number of points to define a gamma correction curve
|
||||
|
||||
/**
|
||||
* @brief Structure that declares the points on an ISP gamma curve
|
||||
*
|
||||
* Constraint on pt[n].x:
|
||||
* When n = 0, pt[n].x = 2 ^ a[n]
|
||||
* When 0 < n < ISP_GAMMA_CURVE_POINTS_NUM-1, pt[n].x - pt[n-1].x = 2 ^ a[n]
|
||||
* When n = ISP_GAMMA_CURVE_POINTS_NUM-1, pt[n].x = 255, (pt[n].x + 1) - pt[n-1].x = 2 ^ a[n]
|
||||
* a[n] within [0, 7]
|
||||
*/
|
||||
typedef struct {
|
||||
struct {
|
||||
uint8_t x; ///< Raw value (0, 255]
|
||||
uint8_t y; ///< gamma-corrected value (0, 255]
|
||||
} pt[ISP_GAMMA_CURVE_POINTS_NUM]; ///< Point (x, y)
|
||||
} isp_gamma_curve_points_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -689,605 +689,205 @@ typedef union {
|
||||
uint32_t val;
|
||||
} isp_gamma_ctrl_reg_t;
|
||||
|
||||
/** Type of gamma_ry1 register
|
||||
* point of Y-axis of r channel gamma curve register 1
|
||||
/** Type of gamma_y1 register
|
||||
* point of Y-axis of r/g/b channel gamma curve register 1
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_r_y03 : R/W; bitpos: [7:0]; default: 64;
|
||||
* this field configures the point 3 of Y-axis of r channel gamma curve
|
||||
/** gamma_y03 : R/W; bitpos: [7:0]; default: 64;
|
||||
* this field configures the point 3 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y03:8;
|
||||
/** gamma_r_y02 : R/W; bitpos: [15:8]; default: 48;
|
||||
* this field configures the point 2 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y03:8;
|
||||
/** gamma_y02 : R/W; bitpos: [15:8]; default: 48;
|
||||
* this field configures the point 2 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y02:8;
|
||||
/** gamma_r_y01 : R/W; bitpos: [23:16]; default: 32;
|
||||
* this field configures the point 1 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y02:8;
|
||||
/** gamma_y01 : R/W; bitpos: [23:16]; default: 32;
|
||||
* this field configures the point 1 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y01:8;
|
||||
/** gamma_r_y00 : R/W; bitpos: [31:24]; default: 16;
|
||||
* this field configures the point 0 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y01:8;
|
||||
/** gamma_y00 : R/W; bitpos: [31:24]; default: 16;
|
||||
* this field configures the point 0 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y00:8;
|
||||
uint32_t gamma_y00:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_ry1_reg_t;
|
||||
} isp_gamma_y1_reg_t;
|
||||
|
||||
/** Type of gamma_ry2 register
|
||||
* point of Y-axis of r channel gamma curve register 2
|
||||
/** Type of gamma_y2 register
|
||||
* point of Y-axis of r/g/b channel gamma curve register 2
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_r_y07 : R/W; bitpos: [7:0]; default: 128;
|
||||
* this field configures the point 7 of Y-axis of r channel gamma curve
|
||||
/** gamma_y07 : R/W; bitpos: [7:0]; default: 128;
|
||||
* this field configures the point 7 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y07:8;
|
||||
/** gamma_r_y06 : R/W; bitpos: [15:8]; default: 112;
|
||||
* this field configures the point 6 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y07:8;
|
||||
/** gamma_y06 : R/W; bitpos: [15:8]; default: 112;
|
||||
* this field configures the point 6 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y06:8;
|
||||
/** gamma_r_y05 : R/W; bitpos: [23:16]; default: 96;
|
||||
* this field configures the point 5 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y06:8;
|
||||
/** gamma_y05 : R/W; bitpos: [23:16]; default: 96;
|
||||
* this field configures the point 5 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y05:8;
|
||||
/** gamma_r_y04 : R/W; bitpos: [31:24]; default: 80;
|
||||
* this field configures the point 4 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y05:8;
|
||||
/** gamma_y04 : R/W; bitpos: [31:24]; default: 80;
|
||||
* this field configures the point 4 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y04:8;
|
||||
uint32_t gamma_y04:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_ry2_reg_t;
|
||||
} isp_gamma_y2_reg_t;
|
||||
|
||||
/** Type of gamma_ry3 register
|
||||
* point of Y-axis of r channel gamma curve register 3
|
||||
/** Type of gamma_y3 register
|
||||
* point of Y-axis of r/g/b channel gamma curve register 3
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_r_y0b : R/W; bitpos: [7:0]; default: 192;
|
||||
* this field configures the point 11 of Y-axis of r channel gamma curve
|
||||
/** gamma_y0b : R/W; bitpos: [7:0]; default: 192;
|
||||
* this field configures the point 11 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y0b:8;
|
||||
/** gamma_r_y0a : R/W; bitpos: [15:8]; default: 176;
|
||||
* this field configures the point 10 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y0b:8;
|
||||
/** gamma_y0a : R/W; bitpos: [15:8]; default: 176;
|
||||
* this field configures the point 10 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y0a:8;
|
||||
/** gamma_r_y09 : R/W; bitpos: [23:16]; default: 160;
|
||||
* this field configures the point 9 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y0a:8;
|
||||
/** gamma_y09 : R/W; bitpos: [23:16]; default: 160;
|
||||
* this field configures the point 9 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y09:8;
|
||||
/** gamma_r_y08 : R/W; bitpos: [31:24]; default: 144;
|
||||
* this field configures the point 8 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y09:8;
|
||||
/** gamma_y08 : R/W; bitpos: [31:24]; default: 144;
|
||||
* this field configures the point 8 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y08:8;
|
||||
uint32_t gamma_y08:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_ry3_reg_t;
|
||||
} isp_gamma_y3_reg_t;
|
||||
|
||||
/** Type of gamma_ry4 register
|
||||
* point of Y-axis of r channel gamma curve register 4
|
||||
/** Type of gamma_y4 register
|
||||
* point of Y-axis of r/g/b channel gamma curve register 4
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_r_y0f : R/W; bitpos: [7:0]; default: 255;
|
||||
* this field configures the point 15 of Y-axis of r channel gamma curve
|
||||
/** gamma_y0f : R/W; bitpos: [7:0]; default: 255;
|
||||
* this field configures the point 15 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y0f:8;
|
||||
/** gamma_r_y0e : R/W; bitpos: [15:8]; default: 240;
|
||||
* this field configures the point 14 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y0f:8;
|
||||
/** gamma_y0e : R/W; bitpos: [15:8]; default: 240;
|
||||
* this field configures the point 14 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y0e:8;
|
||||
/** gamma_r_y0d : R/W; bitpos: [23:16]; default: 224;
|
||||
* this field configures the point 13 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y0e:8;
|
||||
/** gamma_y0d : R/W; bitpos: [23:16]; default: 224;
|
||||
* this field configures the point 13 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y0d:8;
|
||||
/** gamma_r_y0c : R/W; bitpos: [31:24]; default: 208;
|
||||
* this field configures the point 12 of Y-axis of r channel gamma curve
|
||||
uint32_t gamma_y0d:8;
|
||||
/** gamma_y0c : R/W; bitpos: [31:24]; default: 208;
|
||||
* this field configures the point 12 of Y-axis of r/g/b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_r_y0c:8;
|
||||
uint32_t gamma_y0c:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_ry4_reg_t;
|
||||
} isp_gamma_y4_reg_t;
|
||||
|
||||
/** Type of gamma_gy1 register
|
||||
* point of Y-axis of g channel gamma curve register 1
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_g_y03 : R/W; bitpos: [7:0]; default: 64;
|
||||
* this field configures the point 3 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y03:8;
|
||||
/** gamma_g_y02 : R/W; bitpos: [15:8]; default: 48;
|
||||
* this field configures the point 2 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y02:8;
|
||||
/** gamma_g_y01 : R/W; bitpos: [23:16]; default: 32;
|
||||
* this field configures the point 1 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y01:8;
|
||||
/** gamma_g_y00 : R/W; bitpos: [31:24]; default: 16;
|
||||
* this field configures the point 0 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y00:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_gy1_reg_t;
|
||||
|
||||
/** Type of gamma_gy2 register
|
||||
* point of Y-axis of g channel gamma curve register 2
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_g_y07 : R/W; bitpos: [7:0]; default: 128;
|
||||
* this field configures the point 7 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y07:8;
|
||||
/** gamma_g_y06 : R/W; bitpos: [15:8]; default: 112;
|
||||
* this field configures the point 6 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y06:8;
|
||||
/** gamma_g_y05 : R/W; bitpos: [23:16]; default: 96;
|
||||
* this field configures the point 5 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y05:8;
|
||||
/** gamma_g_y04 : R/W; bitpos: [31:24]; default: 80;
|
||||
* this field configures the point 4 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y04:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_gy2_reg_t;
|
||||
|
||||
/** Type of gamma_gy3 register
|
||||
* point of Y-axis of g channel gamma curve register 3
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_g_y0b : R/W; bitpos: [7:0]; default: 192;
|
||||
* this field configures the point 11 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y0b:8;
|
||||
/** gamma_g_y0a : R/W; bitpos: [15:8]; default: 176;
|
||||
* this field configures the point 10 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y0a:8;
|
||||
/** gamma_g_y09 : R/W; bitpos: [23:16]; default: 160;
|
||||
* this field configures the point 9 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y09:8;
|
||||
/** gamma_g_y08 : R/W; bitpos: [31:24]; default: 144;
|
||||
* this field configures the point 8 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y08:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_gy3_reg_t;
|
||||
|
||||
/** Type of gamma_gy4 register
|
||||
* point of Y-axis of g channel gamma curve register 4
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_g_y0f : R/W; bitpos: [7:0]; default: 255;
|
||||
* this field configures the point 15 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y0f:8;
|
||||
/** gamma_g_y0e : R/W; bitpos: [15:8]; default: 240;
|
||||
* this field configures the point 14 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y0e:8;
|
||||
/** gamma_g_y0d : R/W; bitpos: [23:16]; default: 224;
|
||||
* this field configures the point 13 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y0d:8;
|
||||
/** gamma_g_y0c : R/W; bitpos: [31:24]; default: 208;
|
||||
* this field configures the point 12 of Y-axis of g channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_g_y0c:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_gy4_reg_t;
|
||||
|
||||
/** Type of gamma_by1 register
|
||||
* point of Y-axis of b channel gamma curve register 1
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_b_y03 : R/W; bitpos: [7:0]; default: 64;
|
||||
* this field configures the point 3 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y03:8;
|
||||
/** gamma_b_y02 : R/W; bitpos: [15:8]; default: 48;
|
||||
* this field configures the point 2 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y02:8;
|
||||
/** gamma_b_y01 : R/W; bitpos: [23:16]; default: 32;
|
||||
* this field configures the point 1 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y01:8;
|
||||
/** gamma_b_y00 : R/W; bitpos: [31:24]; default: 16;
|
||||
* this field configures the point 0 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y00:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_by1_reg_t;
|
||||
|
||||
/** Type of gamma_by2 register
|
||||
* point of Y-axis of b channel gamma curve register 2
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_b_y07 : R/W; bitpos: [7:0]; default: 128;
|
||||
* this field configures the point 7 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y07:8;
|
||||
/** gamma_b_y06 : R/W; bitpos: [15:8]; default: 112;
|
||||
* this field configures the point 6 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y06:8;
|
||||
/** gamma_b_y05 : R/W; bitpos: [23:16]; default: 96;
|
||||
* this field configures the point 5 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y05:8;
|
||||
/** gamma_b_y04 : R/W; bitpos: [31:24]; default: 80;
|
||||
* this field configures the point 4 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y04:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_by2_reg_t;
|
||||
|
||||
/** Type of gamma_by3 register
|
||||
* point of Y-axis of b channel gamma curve register 3
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_b_y0b : R/W; bitpos: [7:0]; default: 192;
|
||||
* this field configures the point 11 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y0b:8;
|
||||
/** gamma_b_y0a : R/W; bitpos: [15:8]; default: 176;
|
||||
* this field configures the point 10 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y0a:8;
|
||||
/** gamma_b_y09 : R/W; bitpos: [23:16]; default: 160;
|
||||
* this field configures the point 9 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y09:8;
|
||||
/** gamma_b_y08 : R/W; bitpos: [31:24]; default: 144;
|
||||
* this field configures the point 8 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y08:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_by3_reg_t;
|
||||
|
||||
/** Type of gamma_by4 register
|
||||
* point of Y-axis of b channel gamma curve register 4
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_b_y0f : R/W; bitpos: [7:0]; default: 255;
|
||||
* this field configures the point 15 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y0f:8;
|
||||
/** gamma_b_y0e : R/W; bitpos: [15:8]; default: 240;
|
||||
* this field configures the point 14 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y0e:8;
|
||||
/** gamma_b_y0d : R/W; bitpos: [23:16]; default: 224;
|
||||
* this field configures the point 13 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y0d:8;
|
||||
/** gamma_b_y0c : R/W; bitpos: [31:24]; default: 208;
|
||||
* this field configures the point 12 of Y-axis of b channel gamma curve
|
||||
*/
|
||||
uint32_t gamma_b_y0c:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_by4_reg_t;
|
||||
|
||||
/** Type of gamma_rx1 register
|
||||
* point of X-axis of r channel gamma curve register 1
|
||||
/** Type of gamma_x1 register
|
||||
* point of X-axis of r/g/b channel gamma curve register 1
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_r_x07 : R/W; bitpos: [2:0]; default: 4;
|
||||
* this field configures the point 7 of X-axis of r channel gamma curve, it represents
|
||||
* this field configures the point 7 of X-axis of r/g/b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x07:3;
|
||||
uint32_t gamma_x07:3;
|
||||
/** gamma_r_x06 : R/W; bitpos: [5:3]; default: 4;
|
||||
* this field configures the point 6 of X-axis of r channel gamma curve, it represents
|
||||
* this field configures the point 6 of X-axis of r/g/b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x06:3;
|
||||
/** gamma_r_x05 : R/W; bitpos: [8:6]; default: 4;
|
||||
* this field configures the point 5 of X-axis of r channel gamma curve, it represents
|
||||
uint32_t gamma_x06:3;
|
||||
/** gamma_x05 : R/W; bitpos: [8:6]; default: 4;
|
||||
* this field configures the point 5 of X-axis of r/g/b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x05:3;
|
||||
/** gamma_r_x04 : R/W; bitpos: [11:9]; default: 4;
|
||||
* this field configures the point 4 of X-axis of r channel gamma curve, it represents
|
||||
uint32_t gamma_x05:3;
|
||||
/** gamma_x04 : R/W; bitpos: [11:9]; default: 4;
|
||||
* this field configures the point 4 of X-axis of r/g/b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x04:3;
|
||||
/** gamma_r_x03 : R/W; bitpos: [14:12]; default: 4;
|
||||
* this field configures the point 3 of X-axis of r channel gamma curve, it represents
|
||||
uint32_t gamma_x04:3;
|
||||
/** gamma_x03 : R/W; bitpos: [14:12]; default: 4;
|
||||
* this field configures the point 3 of X-axis of r/g/b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x03:3;
|
||||
/** gamma_r_x02 : R/W; bitpos: [17:15]; default: 4;
|
||||
* this field configures the point 2 of X-axis of r channel gamma curve, it represents
|
||||
uint32_t gamma_x03:3;
|
||||
/** gamma_x02 : R/W; bitpos: [17:15]; default: 4;
|
||||
* this field configures the point 2 of X-axis of r/g/b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x02:3;
|
||||
/** gamma_r_x01 : R/W; bitpos: [20:18]; default: 4;
|
||||
* this field configures the point 1 of X-axis of r channel gamma curve, it represents
|
||||
uint32_t gamma_x02:3;
|
||||
/** gamma_x01 : R/W; bitpos: [20:18]; default: 4;
|
||||
* this field configures the point 1 of X-axis of r/g/b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x01:3;
|
||||
/** gamma_r_x00 : R/W; bitpos: [23:21]; default: 4;
|
||||
* this field configures the point 0 of X-axis of r channel gamma curve, it represents
|
||||
uint32_t gamma_x01:3;
|
||||
/** gamma_x00 : R/W; bitpos: [23:21]; default: 4;
|
||||
* this field configures the point 0 of X-axis of r/g/b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x00:3;
|
||||
uint32_t gamma_x00:3;
|
||||
uint32_t reserved_24:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_rx1_reg_t;
|
||||
} isp_gamma_x1_reg_t;
|
||||
|
||||
/** Type of gamma_rx2 register
|
||||
* point of X-axis of r channel gamma curve register 2
|
||||
/** Type of gamma_x2 register
|
||||
* point of X-axis of r/g/b channel gamma curve register 2
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_r_x0f : R/W; bitpos: [2:0]; default: 4;
|
||||
* this field configures the point 15 of X-axis of r channel gamma curve, it
|
||||
/** gamma_x0f : R/W; bitpos: [2:0]; default: 4;
|
||||
* this field configures the point 15 of X-axis of r/g/b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x0f:3;
|
||||
/** gamma_r_x0e : R/W; bitpos: [5:3]; default: 4;
|
||||
* this field configures the point 14 of X-axis of r channel gamma curve, it
|
||||
uint32_t gamma_x0f:3;
|
||||
/** gamma_x0e : R/W; bitpos: [5:3]; default: 4;
|
||||
* this field configures the point 14 of X-axis of r/g/b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x0e:3;
|
||||
/** gamma_r_x0d : R/W; bitpos: [8:6]; default: 4;
|
||||
* this field configures the point 13 of X-axis of r channel gamma curve, it
|
||||
uint32_t gamma_x0e:3;
|
||||
/** gamma_x0d : R/W; bitpos: [8:6]; default: 4;
|
||||
* this field configures the point 13 of X-axis of r/g/b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x0d:3;
|
||||
/** gamma_r_x0c : R/W; bitpos: [11:9]; default: 4;
|
||||
* this field configures the point 12 of X-axis of r channel gamma curve, it
|
||||
uint32_t gamma_x0d:3;
|
||||
/** gamma_x0c : R/W; bitpos: [11:9]; default: 4;
|
||||
* this field configures the point 12 of X-axis of r/g/b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x0c:3;
|
||||
/** gamma_r_x0b : R/W; bitpos: [14:12]; default: 4;
|
||||
* this field configures the point 11 of X-axis of r channel gamma curve, it
|
||||
uint32_t gamma_x0c:3;
|
||||
/** gamma_x0b : R/W; bitpos: [14:12]; default: 4;
|
||||
* this field configures the point 11 of X-axis of r/g/b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x0b:3;
|
||||
/** gamma_r_x0a : R/W; bitpos: [17:15]; default: 4;
|
||||
* this field configures the point 10 of X-axis of r channel gamma curve, it
|
||||
uint32_t gamma_x0b:3;
|
||||
/** gamma_x0a : R/W; bitpos: [17:15]; default: 4;
|
||||
* this field configures the point 10 of X-axis of r/g/b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x0a:3;
|
||||
/** gamma_r_x09 : R/W; bitpos: [20:18]; default: 4;
|
||||
* this field configures the point 9 of X-axis of r channel gamma curve, it represents
|
||||
uint32_t gamma_x0a:3;
|
||||
/** gamma_x09 : R/W; bitpos: [20:18]; default: 4;
|
||||
* this field configures the point 9 of X-axis of r/g/b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x09:3;
|
||||
/** gamma_r_x08 : R/W; bitpos: [23:21]; default: 4;
|
||||
* this field configures the point 8 of X-axis of r channel gamma curve, it represents
|
||||
uint32_t gamma_x09:3;
|
||||
/** gamma_x08 : R/W; bitpos: [23:21]; default: 4;
|
||||
* this field configures the point 8 of X-axis of r/g/b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_r_x08:3;
|
||||
uint32_t gamma_x08:3;
|
||||
uint32_t reserved_24:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_rx2_reg_t;
|
||||
|
||||
/** Type of gamma_gx1 register
|
||||
* point of X-axis of g channel gamma curve register 1
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_g_x07 : R/W; bitpos: [2:0]; default: 4;
|
||||
* this field configures the point 7 of X-axis of g channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x07:3;
|
||||
/** gamma_g_x06 : R/W; bitpos: [5:3]; default: 4;
|
||||
* this field configures the point 6 of X-axis of g channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x06:3;
|
||||
/** gamma_g_x05 : R/W; bitpos: [8:6]; default: 4;
|
||||
* this field configures the point 5 of X-axis of g channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x05:3;
|
||||
/** gamma_g_x04 : R/W; bitpos: [11:9]; default: 4;
|
||||
* this field configures the point 4 of X-axis of g channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x04:3;
|
||||
/** gamma_g_x03 : R/W; bitpos: [14:12]; default: 4;
|
||||
* this field configures the point 3 of X-axis of g channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x03:3;
|
||||
/** gamma_g_x02 : R/W; bitpos: [17:15]; default: 4;
|
||||
* this field configures the point 2 of X-axis of g channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x02:3;
|
||||
/** gamma_g_x01 : R/W; bitpos: [20:18]; default: 4;
|
||||
* this field configures the point 1 of X-axis of g channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x01:3;
|
||||
/** gamma_g_x00 : R/W; bitpos: [23:21]; default: 4;
|
||||
* this field configures the point 0 of X-axis of g channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x00:3;
|
||||
uint32_t reserved_24:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_gx1_reg_t;
|
||||
|
||||
/** Type of gamma_gx2 register
|
||||
* point of X-axis of g channel gamma curve register 2
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_g_x0f : R/W; bitpos: [2:0]; default: 4;
|
||||
* this field configures the point 15 of X-axis of g channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x0f:3;
|
||||
/** gamma_g_x0e : R/W; bitpos: [5:3]; default: 4;
|
||||
* this field configures the point 14 of X-axis of g channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x0e:3;
|
||||
/** gamma_g_x0d : R/W; bitpos: [8:6]; default: 4;
|
||||
* this field configures the point 13 of X-axis of g channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x0d:3;
|
||||
/** gamma_g_x0c : R/W; bitpos: [11:9]; default: 4;
|
||||
* this field configures the point 12 of X-axis of g channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x0c:3;
|
||||
/** gamma_g_x0b : R/W; bitpos: [14:12]; default: 4;
|
||||
* this field configures the point 11 of X-axis of g channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x0b:3;
|
||||
/** gamma_g_x0a : R/W; bitpos: [17:15]; default: 4;
|
||||
* this field configures the point 10 of X-axis of g channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x0a:3;
|
||||
/** gamma_g_x09 : R/W; bitpos: [20:18]; default: 4;
|
||||
* this field configures the point 9 of X-axis of g channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x09:3;
|
||||
/** gamma_g_x08 : R/W; bitpos: [23:21]; default: 4;
|
||||
* this field configures the point 8 of X-axis of g channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_g_x08:3;
|
||||
uint32_t reserved_24:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_gx2_reg_t;
|
||||
|
||||
/** Type of gamma_bx1 register
|
||||
* point of X-axis of b channel gamma curve register 1
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_b_x07 : R/W; bitpos: [2:0]; default: 4;
|
||||
* this field configures the point 7 of X-axis of b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x07:3;
|
||||
/** gamma_b_x06 : R/W; bitpos: [5:3]; default: 4;
|
||||
* this field configures the point 6 of X-axis of b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x06:3;
|
||||
/** gamma_b_x05 : R/W; bitpos: [8:6]; default: 4;
|
||||
* this field configures the point 5 of X-axis of b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x05:3;
|
||||
/** gamma_b_x04 : R/W; bitpos: [11:9]; default: 4;
|
||||
* this field configures the point 4 of X-axis of b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x04:3;
|
||||
/** gamma_b_x03 : R/W; bitpos: [14:12]; default: 4;
|
||||
* this field configures the point 3 of X-axis of b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x03:3;
|
||||
/** gamma_b_x02 : R/W; bitpos: [17:15]; default: 4;
|
||||
* this field configures the point 2 of X-axis of b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x02:3;
|
||||
/** gamma_b_x01 : R/W; bitpos: [20:18]; default: 4;
|
||||
* this field configures the point 1 of X-axis of b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x01:3;
|
||||
/** gamma_b_x00 : R/W; bitpos: [23:21]; default: 4;
|
||||
* this field configures the point 0 of X-axis of b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x00:3;
|
||||
uint32_t reserved_24:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_bx1_reg_t;
|
||||
|
||||
/** Type of gamma_bx2 register
|
||||
* point of X-axis of b channel gamma curve register 2
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** gamma_b_x0f : R/W; bitpos: [2:0]; default: 4;
|
||||
* this field configures the point 15 of X-axis of b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x0f:3;
|
||||
/** gamma_b_x0e : R/W; bitpos: [5:3]; default: 4;
|
||||
* this field configures the point 14 of X-axis of b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x0e:3;
|
||||
/** gamma_b_x0d : R/W; bitpos: [8:6]; default: 4;
|
||||
* this field configures the point 13 of X-axis of b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x0d:3;
|
||||
/** gamma_b_x0c : R/W; bitpos: [11:9]; default: 4;
|
||||
* this field configures the point 12 of X-axis of b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x0c:3;
|
||||
/** gamma_b_x0b : R/W; bitpos: [14:12]; default: 4;
|
||||
* this field configures the point 11 of X-axis of b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x0b:3;
|
||||
/** gamma_b_x0a : R/W; bitpos: [17:15]; default: 4;
|
||||
* this field configures the point 10 of X-axis of b channel gamma curve, it
|
||||
* represents the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x0a:3;
|
||||
/** gamma_b_x09 : R/W; bitpos: [20:18]; default: 4;
|
||||
* this field configures the point 9 of X-axis of b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x09:3;
|
||||
/** gamma_b_x08 : R/W; bitpos: [23:21]; default: 4;
|
||||
* this field configures the point 8 of X-axis of b channel gamma curve, it represents
|
||||
* the power of the distance from the previous point
|
||||
*/
|
||||
uint32_t gamma_b_x08:3;
|
||||
uint32_t reserved_24:8;
|
||||
};
|
||||
uint32_t val;
|
||||
} isp_gamma_bx2_reg_t;
|
||||
} isp_gamma_x2_reg_t;
|
||||
|
||||
/** Type of ae_ctrl register
|
||||
* ae control register
|
||||
@ -3739,6 +3339,17 @@ typedef union {
|
||||
uint32_t val;
|
||||
} isp_int_clr_reg_t;
|
||||
|
||||
typedef struct {
|
||||
volatile isp_gamma_y1_reg_t gamma_y1;
|
||||
volatile isp_gamma_y2_reg_t gamma_y2;
|
||||
volatile isp_gamma_y3_reg_t gamma_y3;
|
||||
volatile isp_gamma_y4_reg_t gamma_y4;
|
||||
} isp_gamma_y_reg_t;
|
||||
|
||||
typedef struct {
|
||||
volatile isp_gamma_x1_reg_t gamma_x1;
|
||||
volatile isp_gamma_x2_reg_t gamma_x2;
|
||||
} isp_gamma_x_reg_t;
|
||||
|
||||
typedef struct {
|
||||
volatile isp_ver_date_reg_t ver_date;
|
||||
@ -3771,24 +3382,8 @@ typedef struct {
|
||||
volatile isp_int_ena_reg_t int_ena;
|
||||
volatile isp_int_clr_reg_t int_clr;
|
||||
volatile isp_gamma_ctrl_reg_t gamma_ctrl;
|
||||
volatile isp_gamma_ry1_reg_t gamma_ry1;
|
||||
volatile isp_gamma_ry2_reg_t gamma_ry2;
|
||||
volatile isp_gamma_ry3_reg_t gamma_ry3;
|
||||
volatile isp_gamma_ry4_reg_t gamma_ry4;
|
||||
volatile isp_gamma_gy1_reg_t gamma_gy1;
|
||||
volatile isp_gamma_gy2_reg_t gamma_gy2;
|
||||
volatile isp_gamma_gy3_reg_t gamma_gy3;
|
||||
volatile isp_gamma_gy4_reg_t gamma_gy4;
|
||||
volatile isp_gamma_by1_reg_t gamma_by1;
|
||||
volatile isp_gamma_by2_reg_t gamma_by2;
|
||||
volatile isp_gamma_by3_reg_t gamma_by3;
|
||||
volatile isp_gamma_by4_reg_t gamma_by4;
|
||||
volatile isp_gamma_rx1_reg_t gamma_rx1;
|
||||
volatile isp_gamma_rx2_reg_t gamma_rx2;
|
||||
volatile isp_gamma_gx1_reg_t gamma_gx1;
|
||||
volatile isp_gamma_gx2_reg_t gamma_gx2;
|
||||
volatile isp_gamma_bx1_reg_t gamma_bx1;
|
||||
volatile isp_gamma_bx2_reg_t gamma_bx2;
|
||||
volatile isp_gamma_y_reg_t gamma_rgb_y[3]; // r: gamma_rgb_y[0], g: gamma_rgb_y[1], b: gamma_rgb_y[2]
|
||||
volatile isp_gamma_x_reg_t gamma_rgb_x[3]; // r: gamma_rgb_x[0], g: gamma_rgb_x[1], b: gamma_rgb_x[2]
|
||||
volatile isp_ae_ctrl_reg_t ae_ctrl;
|
||||
volatile isp_ae_monitor_reg_t ae_monitor;
|
||||
volatile isp_ae_bx_reg_t ae_bx;
|
||||
|
@ -20,6 +20,7 @@ INPUT += \
|
||||
$(PROJECT_PATH)/components/esp_driver_cam/include/esp_cam_ctlr_types.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_cam/csi/include/esp_cam_ctlr_csi.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_cam/isp_dvp/include/esp_cam_ctlr_isp_dvp.h \
|
||||
$(PROJECT_PATH)/components/hal/include/hal/isp_types.h \
|
||||
$(PROJECT_PATH)/components/hal/include/hal/jpeg_types.h \
|
||||
$(PROJECT_PATH)/components/hal/include/hal/ppa_types.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_touch_sens/include/driver/touch_sens.h \
|
||||
@ -27,12 +28,12 @@ INPUT += \
|
||||
$(PROJECT_PATH)/components/esp_driver_touch_sens/hw_ver3/include/driver/touch_version_types.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_jpeg/include/driver/jpeg_types.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_types.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_af.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_awb.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_ccm.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_bf.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_core.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_gamma.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_jpeg/include/driver/jpeg_decode.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_jpeg/include/driver/jpeg_encode.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_ppa/include/driver/ppa.h \
|
||||
|
@ -40,14 +40,14 @@ ISP Pipeline
|
||||
isp_chs [label = "Contrast &\n Hue & Saturation", width = 150, height = 70];
|
||||
isp_yuv [label = "YUV Limit\nYUB2RGB", width = 120, height = 70];
|
||||
|
||||
isp_header -> BF -> Demosaic -> CCM -> RGB2YUV -> isp_chs -> isp_yuv -> isp_tail;
|
||||
isp_header -> BF -> Demosaic -> CCM -> Gamma -> RGB2YUV -> isp_chs -> isp_yuv -> isp_tail;
|
||||
|
||||
BF -> HIST
|
||||
Demosaic -> AWB
|
||||
Demosaic -> AE
|
||||
Demosaic -> HIST
|
||||
CCM -> AWB
|
||||
CCM -> AE
|
||||
Gamma -> AE
|
||||
RGB2YUV -> HIST
|
||||
RGB2YUV -> AF
|
||||
}
|
||||
@ -62,7 +62,8 @@ The ISP driver offers following services:
|
||||
- `Get AF statistics in one shot or continuous way <#isp-af-statistics>`__ - covers how to get AF statistics one-shot or continuously.
|
||||
- `Get AWB statistics in one shot or continuous way <#isp-awb-statistics>`__ - covers how to get AWB white patches statistics one-shot or continuously.
|
||||
- `Enable BF function <#isp_bf>`__ - covers how to enable and configure BF function.
|
||||
- `Configure CCM <#isp-ccm-config>`__ - covers how to config the Color Correction Matrix.
|
||||
- `Configure CCM <#isp-ccm-config>`__ - covers how to configure the Color Correction Matrix.
|
||||
- `Enable Gamma Correction <#isp-gamma-correction>`__ - covers how to enable and configure gamma correction.
|
||||
- `Register callback <#isp-callback>`__ - covers how to hook user specific code to ISP driver event callback function.
|
||||
- `Thread Safety <#isp-thread-safety>`__ - lists which APIs are guaranteed to be thread safe by the driver.
|
||||
- `Kconfig Options <#isp-kconfig-options>`__ - lists the supported Kconfig options that can bring different effects to the driver.
|
||||
@ -416,6 +417,7 @@ After calling :cpp:func:`esp_isp_bf_configure`, you need to enable the ISP BF pr
|
||||
* Switches the driver state from **init** to **enable**.
|
||||
|
||||
Calling :cpp:func:`esp_isp_bf_disable` does the opposite, that is, put the driver back to the **init** state.
|
||||
|
||||
.. _isp-ccm-config:
|
||||
|
||||
Configure CCM
|
||||
@ -457,6 +459,39 @@ To adjust the color correction matrix, here is the formula:
|
||||
// Disable CCM if no longer needed
|
||||
ESP_ERROR_CHECK(esp_isp_ccm_disable(isp_proc));
|
||||
|
||||
.. _isp-gamma-correction:
|
||||
|
||||
Enable Gamma Correction
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The human visual system is non-linearly sensitive to the physical luminance. Adding gamma correction to the ISP pipeline to transforms RGB coordinates into a space in which coordinates are proportional to subjective brightness.
|
||||
|
||||
The driver provides a helper API :cpp:func:`esp_isp_gamma_fill_curve_points` to fill :cpp:type:`isp_gamma_curve_points_t`, which is a group of points used to describe the gamma correction curve. Or you can manually declare the points as your desired 'gamma' correction curve. Each R / G / B component can have its own gamma correction curve, you can set the configuration by calling :cpp:func:`esp_isp_gamma_configure`.
|
||||
|
||||
A typical code example is:
|
||||
|
||||
.. code:: c
|
||||
|
||||
#include <math.h>
|
||||
|
||||
// Set the camera gamma to be 0.7, so the gamma correction curve is y = 256 * (x / 256) ^ 0.7
|
||||
static uint32_t s_gamma_curve(uint32_t x)
|
||||
{
|
||||
return pow((double)x / 256, 0.7) * 256;
|
||||
}
|
||||
|
||||
isp_gamma_curve_points_t pts = {};
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_fill_curve_points(s_gamma_curve, &pts));
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_configure(isp_proc, COLOR_COMPONENT_R, &pts));
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_configure(isp_proc, COLOR_COMPONENT_G, &pts));
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_configure(isp_proc, COLOR_COMPONENT_B, &pts));
|
||||
|
||||
// Enable gamma module after curve parameters configured
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_enable(isp_proc));
|
||||
|
||||
// Disable gamma if no longer needed
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_disable(isp_proc));
|
||||
|
||||
.. _isp-callback:
|
||||
|
||||
Register Event Callbacks
|
||||
@ -516,3 +551,4 @@ API Reference
|
||||
.. include-build-file:: inc/isp.inc
|
||||
.. include-build-file:: inc/isp_types.inc
|
||||
.. include-build-file:: inc/isp_af.inc
|
||||
.. include-build-file:: inc/isp_gamma.inc
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_heap_caps.h"
|
||||
@ -16,6 +17,8 @@
|
||||
#include "esp_cache.h"
|
||||
#include "driver/i2c_master.h"
|
||||
#include "driver/isp.h"
|
||||
#include "driver/isp_gamma.h"
|
||||
#include "driver/isp_sharpen.h"
|
||||
#include "isp_af_scheme_sa.h"
|
||||
#include "esp_cam_ctlr_csi.h"
|
||||
#include "esp_cam_ctlr.h"
|
||||
@ -175,6 +178,15 @@ static void af_task(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
Gamma Correction
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
static uint32_t s_gamma_correction_curve(uint32_t x)
|
||||
{
|
||||
return pow((double)x / 256, 0.7) * 256;
|
||||
}
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
esp_err_t ret = ESP_FAIL;
|
||||
@ -295,6 +307,13 @@ void app_main(void)
|
||||
ESP_ERROR_CHECK(esp_isp_bf_configure(isp_proc, &bf_config));
|
||||
ESP_ERROR_CHECK(esp_isp_bf_enable(isp_proc));
|
||||
|
||||
isp_gamma_curve_points_t pts = {};
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_fill_curve_points(s_gamma_correction_curve, &pts));
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_configure(isp_proc, COLOR_COMPONENT_R, &pts));
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_configure(isp_proc, COLOR_COMPONENT_G, &pts));
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_configure(isp_proc, COLOR_COMPONENT_B, &pts));
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_enable(isp_proc));
|
||||
|
||||
esp_isp_sharpen_config_t sharpen_config = {
|
||||
.h_freq_coeff = {
|
||||
.integer = 2,
|
||||
|
Loading…
Reference in New Issue
Block a user