feat(isp): added isp sharp driver

This commit is contained in:
Armando 2024-07-24 15:47:48 +08:00
parent eff2e4eddd
commit f1b5846a55
18 changed files with 804 additions and 172 deletions

View File

@ -20,6 +20,10 @@ if(CONFIG_SOC_ISP_BF_SUPPORTED)
list(APPEND srcs "src/isp_bf.c")
endif()
if(CONFIG_SOC_ISP_SHARPEN_SUPPORTED)
list(APPEND srcs "src/isp_sharpen.c")
endif()
if(NOT ${target} STREQUAL "linux")
list(APPEND requires esp_mm)
endif()
@ -28,4 +32,5 @@ idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${public_include}
REQUIRES ${requires}
PRIV_REQUIRES ${priv_requires}
LDFRAGMENTS "linker.lf"
)

View File

@ -8,4 +8,15 @@ menu "ESP-Driver:ISP Configurations"
Ensure the ISP driver ISR is IRAM-Safe. When enabled, the ISR handler
will be available when the cache is disabled.
config ISP_CTRL_FUNC_IN_IRAM
bool "Place ISP control functions into IRAM"
default n
help
Place ISP control functions into IRAM,
so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context.
Enabling this option can improve driver performance as well.
Function list:
- `esp_isp_sharpen_configure`
endmenu # ISP Configuration

View File

@ -12,8 +12,9 @@
#pragma once
#include "driver/isp_core.h"
#include "driver/isp_ae.h"
#include "driver/isp_af.h"
#include "driver/isp_awb.h"
#include "driver/isp_bf.h"
#include "driver/isp_ccm.h"
#include "driver/isp_ae.h"
#include "driver/isp_sharpen.h"

View File

@ -82,6 +82,28 @@ esp_err_t esp_isp_enable(isp_proc_handle_t proc);
*/
esp_err_t esp_isp_disable(isp_proc_handle_t proc);
/*---------------------------------------------
Event Callbacks
----------------------------------------------*/
/**
* @brief Register ISP event callbacks
*
* @note User can deregister a previously registered callback by calling this function and setting the to-be-deregistered callback member in
* the `cbs` structure to NULL.
* @note When CONFIG_ISP_ISR_IRAM_SAFE is enabled, the callback itself and functions called by it should be placed in IRAM.
* Involved variables (including `user_data`) should be in internal RAM as well.
*
* @param[in] proc Processor handle
* @param[in] cbs Group of callback functions
* @param[in] user_data User data, which will be delivered to the callback functions directly
*
* @return
* - ESP_OK: On success
* - ESP_ERR_INVALID_ARG: Invalid arguments
* - ESP_ERR_INVALID_STATE: Driver state is invalid, you shouldn't call this API at this moment
*/
esp_err_t esp_isp_register_event_callbacks(isp_proc_handle_t proc, const esp_isp_evt_cbs_t *cbs, void *user_data);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,72 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include "esp_err.h"
#include "driver/isp_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief ISP Sharpen configurations
*/
typedef struct {
isp_sharpen_h_freq_coeff h_freq_coeff; ///< High freq pixel sharpeness coeff
isp_sharpen_m_freq_coeff m_freq_coeff; ///< Medium freq pixel sharpeness coeff
uint8_t h_thresh; ///< High threshold, pixel value higher than this threshold will be multiplied by `h_freq_coeff`
uint8_t l_thresh; ///< Low threshold, pixel value higher than this threshold but lower than `h_thresh` will be multiplied by `m_freq_coeff`. Pixel value lower than this threshold will be set to 0
isp_sharpen_edge_padding_mode_t padding_mode; ///< Sharpen edge padding mode
uint8_t padding_data; ///< Sharpen edge padding pixel data
uint8_t sharpen_template[ISP_SHARPEN_TEMPLATE_X_NUMS][ISP_SHARPEN_TEMPLATE_Y_NUMS]; ///< Sharpen template data
uint8_t padding_line_tail_valid_start_pixel; ///< Sharpen edge padding line tail valid start pixel, padding data will only be valid between the valid start pixel and the valid end pixel. Set both the start and end pixel to 0 to make all padding pixel valid
uint8_t padding_line_tail_valid_end_pixel; ///< Sharpen edge padding line tail valid end pixel, padding data will only be valid between the valid start pixel and the valid end pixel. Set both the start and end pixel to 0 to make all padding pixel valid
} esp_isp_sharpen_config_t;
/**
* @brief ISP Sharpen configuration
*
* @note After calling this API, sharpen doesn't take into effect until `esp_isp_sharpen_enable` is called
*
* @param[in] proc Processor handle
* @param[in] config Sharpen configurations, set NULL to de-configure the ISP Sharpen
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG If the combination of arguments is invalid
*/
esp_err_t esp_isp_sharpen_configure(isp_proc_handle_t proc, const esp_isp_sharpen_config_t *config);
/**
* @brief Enable ISP Sharpen function
*
* @param[in] proc Processor handle
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG If the combination of arguments is invalid.
* - ESP_ERR_INVALID_STATE Driver state is invalid.
*/
esp_err_t esp_isp_sharpen_enable(isp_proc_handle_t proc);
/**
* @brief Disable ISP Sharpen function
*
* @param[in] proc Processor handle
*
* @return
* - ESP_OK On success
* - ESP_ERR_INVALID_ARG If the combination of arguments is invalid.
* - ESP_ERR_INVALID_STATE Driver state is invalid.
*/
esp_err_t esp_isp_sharpen_disable(isp_proc_handle_t proc);
#ifdef __cplusplus
}
#endif

View File

@ -5,6 +5,7 @@
*/
#pragma once
#include <stdbool.h>
#include "hal/isp_types.h"
#include "hal/color_types.h"
@ -75,6 +76,38 @@ typedef struct isp_awb_controller_t *isp_awb_ctlr_t;
*/
typedef struct isp_ae_controller_t *isp_ae_ctlr_t;
/*---------------------------------------------
Event Callbacks
----------------------------------------------*/
/**
* @brief Event data structure
*/
typedef struct {
uint8_t high_freq_pixel_max; ///< high freq pixel max value
} esp_isp_sharpen_evt_data_t;
/**
* @brief Prototype of ISP sharpen event callback
*
* @param[in] proc Processor handle
* @param[in] edata ISP sharpen event data
* @param[in] user_data User registered context, registered when in `esp_isp_register_event_callbacks()`
*
* @return Whether a high priority task is woken up by this function
*/
typedef bool (*esp_isp_sharpen_callback_t)(isp_proc_handle_t proc, const esp_isp_sharpen_evt_data_t *edata, void *user_data);
/**
* @brief Group of ISP event callbacks
*
* @note These callbacks are all running in an ISR environment.
* @note When CONFIG_ISP_ISR_IRAM_SAFE is enabled, the callback itself and functions called by it should be placed in IRAM.
* Involved variables should be in internal RAM as well.
*/
typedef struct {
esp_isp_sharpen_callback_t on_sharpen_frame_done; ///< Event callback, invoked when sharpen frame done
} esp_isp_evt_cbs_t;
#ifdef __cplusplus
}
#endif

View File

@ -31,7 +31,7 @@
extern "C" {
#endif
#if CONFIG_ISP_ISR_IRAM_SAFE
#if CONFIG_ISP_ISR_IRAM_SAFE || CONFIG_ISP_CTRL_FUNC_IN_IRAM
#define ISP_INTR_ALLOC_FLAGS (ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_IRAM)
#define ISP_MEM_ALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
#else
@ -43,7 +43,6 @@ typedef enum {
ISP_FSM_INIT, // Controller is initialized, but not enabled
ISP_FSM_ENABLE, // Controller is enabled, but is not running
ISP_FSM_START, // Controller is in running
ISP_FSM_ONESHOT, // Controller is in oneshot sampling
ISP_FSM_CONTINUOUS, // Controller is in continuous sampling
} isp_fsm_t;
@ -68,8 +67,12 @@ typedef struct isp_processor_t {
/* sub module contexts */
isp_af_ctlr_t af_ctlr[SOC_ISP_AF_CTLR_NUMS];
isp_awb_ctlr_t awb_ctlr;
isp_fsm_t bf_fsm;
isp_ae_ctlr_t ae_ctlr;
isp_fsm_t bf_fsm;
isp_fsm_t sharpen_fsm;
esp_isp_evt_cbs_t cbs;
void *user_data;
/* ISR */
intr_handle_t intr_hdl;
int intr_priority;
@ -78,6 +81,7 @@ typedef struct isp_processor_t {
uint32_t af_isr_added: 1;
uint32_t ae_isr_added: 1;
uint32_t awb_isr_added: 1;
uint32_t sharp_isr_added: 1;
} isr_users;
} isp_processor_t;
@ -87,6 +91,7 @@ typedef enum {
ISP_SUBMODULE_AF,
ISP_SUBMODULE_AE,
ISP_SUBMODULE_AWB,
ISP_SUBMODULE_SHARPEN,
} isp_submodule_t;
/*---------------------------------------------------------------
@ -97,6 +102,7 @@ esp_err_t esp_isp_deregister_isr(isp_proc_handle_t proc, isp_submodule_t submodu
bool esp_isp_af_isr(isp_proc_handle_t proc, uint32_t af_events);
bool esp_isp_ae_isr(isp_proc_handle_t proc, uint32_t ae_events);
bool esp_isp_awb_isr(isp_proc_handle_t proc, uint32_t awb_events);
bool esp_isp_sharpen_isr(isp_proc_handle_t proc, uint32_t sharp_events);
#ifdef __cplusplus
}

View File

@ -0,0 +1,11 @@
[mapping:isp_driver]
archive: libesp_driver_isp.a
entries:
if ISP_CTRL_FUNC_IN_IRAM = y:
isp_sharpen: esp_isp_sharpen_configure (noflash)
[mapping:isp_hal]
archive: libhal.a
entries:
if ISP_CTRL_FUNC_IN_IRAM = y:
isp_hal: isp_hal_sharpen_config (noflash)

View File

@ -14,11 +14,6 @@
#include "esp_clk_tree.h"
#include "driver/isp_core.h"
#include "driver/isp_bf.h"
#include "esp_private/periph_ctrl.h"
#include "esp_private/mipi_csi_share_hw_ctrl.h"
#include "hal/hal_utils.h"
#include "soc/mipi_csi_bridge_struct.h"
#include "soc/isp_periph.h"
#include "esp_private/isp_private.h"
static const char *TAG = "ISP_BF";

View File

@ -167,6 +167,31 @@ esp_err_t esp_isp_del_processor(isp_proc_handle_t proc)
return ESP_OK;
}
esp_err_t esp_isp_register_event_callbacks(isp_proc_handle_t proc, const esp_isp_evt_cbs_t *cbs, void *user_data)
{
ESP_RETURN_ON_FALSE(proc && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
ESP_RETURN_ON_FALSE(proc->isp_fsm == ISP_FSM_INIT, ESP_ERR_INVALID_STATE, TAG, "processor isn't in the init state");
#if CONFIG_ISP_ISR_IRAM_SAFE
if (cbs->on_sharpen_frame_done) {
ESP_RETURN_ON_FALSE(esp_ptr_in_iram(cbs->on_sharpen_frame_done), ESP_ERR_INVALID_ARG, TAG, "on_sharpen_frame_done callback not in IRAM");
}
if (user_data) {
ESP_RETURN_ON_FALSE(esp_ptr_internal(user_data), ESP_ERR_INVALID_ARG, TAG, "user context not in internal RAM");
}
#endif
proc->cbs.on_sharpen_frame_done = cbs->on_sharpen_frame_done;
proc->user_data = user_data;
if (cbs->on_sharpen_frame_done) {
ESP_RETURN_ON_ERROR(esp_isp_register_isr(proc, ISP_SUBMODULE_SHARPEN), TAG, "fail to register ISR");
} else {
ESP_RETURN_ON_ERROR(esp_isp_deregister_isr(proc, ISP_SUBMODULE_SHARPEN), TAG, "fail to deregister ISR");
}
return ESP_OK;
}
esp_err_t esp_isp_enable(isp_proc_handle_t proc)
{
ESP_RETURN_ON_FALSE(proc, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
@ -201,6 +226,7 @@ static void IRAM_ATTR s_isp_isr_dispatcher(void *arg)
uint32_t af_events = isp_hal_check_clear_intr_event(&proc->hal, ISP_LL_EVENT_AF_MASK);
uint32_t awb_events = isp_hal_check_clear_intr_event(&proc->hal, ISP_LL_EVENT_AWB_MASK);
uint32_t ae_events = isp_hal_check_clear_intr_event(&proc->hal, ISP_LL_EVENT_AE_MASK);
uint32_t sharp_events = isp_hal_check_clear_intr_event(&proc->hal, ISP_LL_EVENT_SHARP_MASK);
bool do_dispatch = false;
//Deal with hw events
@ -234,6 +260,17 @@ static void IRAM_ATTR s_isp_isr_dispatcher(void *arg)
}
do_dispatch = false;
}
if (sharp_events) {
portENTER_CRITICAL_ISR(&proc->spinlock);
do_dispatch = proc->isr_users.sharp_isr_added;
portEXIT_CRITICAL_ISR(&proc->spinlock);
if (do_dispatch) {
need_yield |= esp_isp_sharpen_isr(proc, sharp_events);
}
do_dispatch = false;
}
if (need_yield) {
portYIELD_FROM_ISR();
}
@ -262,6 +299,9 @@ esp_err_t esp_isp_register_isr(isp_proc_handle_t proc, isp_submodule_t submodule
case ISP_SUBMODULE_AE:
proc->isr_users.ae_isr_added = true;
break;
case ISP_SUBMODULE_SHARPEN:
proc->isr_users.sharp_isr_added = true;
break;
default:
assert(false);
}
@ -307,6 +347,9 @@ esp_err_t esp_isp_deregister_isr(isp_proc_handle_t proc, isp_submodule_t submodu
case ISP_SUBMODULE_AE:
proc->isr_users.ae_isr_added = false;
break;
case ISP_SUBMODULE_SHARPEN:
proc->isr_users.sharp_isr_added = false;
break;
default:
assert(false);
}

View File

@ -0,0 +1,95 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <esp_types.h>
#include <sys/lock.h>
#include "sdkconfig.h"
#include "esp_log.h"
#include "esp_check.h"
#include "freertos/FreeRTOS.h"
#include "driver/isp_core.h"
#include "driver/isp_sharpen.h"
#include "soc/isp_periph.h"
#include "esp_private/isp_private.h"
static const char *TAG = "ISP_SHARPEN";
/*---------------------------------------------------------------
Sharpen
---------------------------------------------------------------*/
esp_err_t esp_isp_sharpen_configure(isp_proc_handle_t proc, const esp_isp_sharpen_config_t *config)
{
ESP_RETURN_ON_FALSE_ISR(proc, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
if (config) {
bool valid_padding_setting = (!config->padding_line_tail_valid_end_pixel && !config->padding_line_tail_valid_start_pixel) || (config->padding_line_tail_valid_end_pixel > config->padding_line_tail_valid_start_pixel);
ESP_RETURN_ON_FALSE_ISR(valid_padding_setting, ESP_ERR_INVALID_ARG, TAG, "wrong padding line tail valid pixel setting");
isp_hal_sharpen_cfg_t sharpen_hal_cfg = {
.h_freq_coeff = config->h_freq_coeff,
.m_freq_coeff = config->m_freq_coeff,
.h_thresh = config->h_thresh,
.l_thresh = config->l_thresh,
.padding_mode = config->padding_mode,
.padding_data = config->padding_data,
.padding_line_tail_valid_start_pixel = config->padding_line_tail_valid_start_pixel,
.padding_line_tail_valid_end_pixel = config->padding_line_tail_valid_end_pixel,
};
memcpy(sharpen_hal_cfg.sharpen_template, config->sharpen_template, ISP_SHARPEN_TEMPLATE_X_NUMS * ISP_SHARPEN_TEMPLATE_X_NUMS * sizeof(uint8_t));
isp_hal_sharpen_config(&(proc->hal), &sharpen_hal_cfg);
} else {
isp_hal_sharpen_config(&(proc->hal), NULL);
}
return ESP_OK;
}
esp_err_t esp_isp_sharpen_enable(isp_proc_handle_t proc)
{
ESP_RETURN_ON_FALSE(proc, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
ESP_RETURN_ON_FALSE(proc->sharpen_fsm == ISP_FSM_INIT, ESP_ERR_INVALID_STATE, TAG, "sharpen is enabled already");
isp_ll_sharp_clk_enable(proc->hal.hw, true);
isp_ll_enable_intr(proc->hal.hw, ISP_LL_EVENT_SHARP_FRAME, true);
isp_ll_sharp_enable(proc->hal.hw, true);
proc->sharpen_fsm = ISP_FSM_ENABLE;
return ESP_OK;
}
esp_err_t esp_isp_sharpen_disable(isp_proc_handle_t proc)
{
ESP_RETURN_ON_FALSE(proc, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
ESP_RETURN_ON_FALSE(proc->sharpen_fsm == ISP_FSM_ENABLE, ESP_ERR_INVALID_STATE, TAG, "sharpen isn't enabled yet");
isp_ll_sharp_enable(proc->hal.hw, false);
isp_ll_enable_intr(proc->hal.hw, ISP_LL_EVENT_SHARP_FRAME, false);
isp_ll_sharp_clk_enable(proc->hal.hw, false);
proc->sharpen_fsm = ISP_FSM_INIT;
return ESP_OK;
}
/*---------------------------------------------------------------
INTR
---------------------------------------------------------------*/
bool IRAM_ATTR esp_isp_sharpen_isr(isp_proc_handle_t proc, uint32_t sharp_events)
{
bool need_yield = false;
esp_isp_sharpen_evt_data_t edata = {};
if (sharp_events) {
edata.high_freq_pixel_max = isp_ll_sharp_get_high_freq_pixel_max(proc->hal.hw);
}
if (sharp_events & ISP_LL_EVENT_SHARP_FRAME) {
if (proc->cbs.on_sharpen_frame_done) {
need_yield |= proc->cbs.on_sharpen_frame_done(proc, &edata, proc->user_data);
}
}
return need_yield;
}

View File

@ -67,6 +67,7 @@ extern "C" {
#define ISP_LL_EVENT_AF_MASK (ISP_LL_EVENT_AF_FDONE | ISP_LL_EVENT_AF_ENV)
#define ISP_LL_EVENT_AE_MASK (ISP_LL_EVENT_AE_FDONE | ISP_LL_EVENT_AE_ENV)
#define ISP_LL_EVENT_AWB_MASK (ISP_LL_EVENT_AWB_FDONE)
#define ISP_LL_EVENT_SHARP_MASK (ISP_LL_EVENT_SHARP_FRAME)
/*---------------------------------------------------------------
AF
@ -787,6 +788,7 @@ static inline void isp_ll_bf_set_template(isp_dev_t *hw, uint8_t template_arr[SO
hw->bf_gau1.gau_template22 = template_arr[2][2];
}
/*---------------------------------------------------------------
CCM
---------------------------------------------------------------*/
@ -1324,6 +1326,166 @@ static inline uint32_t isp_ll_awb_get_accumulated_b_value(isp_dev_t *hw)
return hw->awb0_acc_b.awb0_acc_b;
}
/*---------------------------------------------------------------
Sharpen
---------------------------------------------------------------*/
/**
* @brief Enable / Disable sharpen clock
*
* @param[in] hw Hardware instance address
* @param[in] enable Enable / Disable
*/
static inline void isp_ll_sharp_clk_enable(isp_dev_t *hw, bool enable)
{
hw->clk_en.clk_sharp_force_on = enable;
}
/**
* @brief Enable / Disable sharpen
*
* @param[in] hw Hardware instance address
* @param[in] enable Enable / Disable
*/
static inline void isp_ll_sharp_enable(isp_dev_t *hw, bool enable)
{
hw->cntl.sharp_en = enable;
}
/**
* @brief Set sharpen low thresh
*
* @param[in] hw Hardware instance address
* @param[in] thresh Thresh
*/
__attribute__((always_inline))
static inline void isp_ll_sharp_set_low_thresh(isp_dev_t *hw, uint8_t thresh)
{
hw->sharp_ctrl0.sharp_threshold_low = thresh;
}
/**
* @brief Set sharpen high thresh
*
* @param[in] hw Hardware instance address
* @param[in] thresh Thresh
*/
__attribute__((always_inline))
static inline void isp_ll_sharp_set_high_thresh(isp_dev_t *hw, uint8_t thresh)
{
hw->sharp_ctrl0.sharp_threshold_high = thresh;
}
/**
* @brief Set sharpen medium pixel coeff
*
* @param[in] hw Hardware instance address
* @param[in] coeff coeff
*/
__attribute__((always_inline))
static inline void isp_ll_sharp_set_medium_freq_coeff(isp_dev_t *hw, isp_sharpen_m_freq_coeff coeff)
{
//val between `sharp_amount_low` and `sharp_threshold_high` will be multiplied by `sharp_amount_low`
hw->sharp_ctrl0.sharp_amount_low = coeff.val;
}
/**
* @brief Set sharpen high freq pixel coeff
*
* @param[in] hw Hardware instance address
* @param[in] coeff coeff
*/
__attribute__((always_inline))
static inline void isp_ll_sharp_set_high_freq_coeff(isp_dev_t *hw, isp_sharpen_h_freq_coeff coeff)
{
//val higher than `sharp_threshold_high` will be multiplied by `sharp_amount_high`
hw->sharp_ctrl0.sharp_amount_high = coeff.val;
}
/**
* @brief Set ISP sharpen padding mode
*
* @param[in] hw Hardware instance address
* @param[in] padding_mode padding mode
*/
__attribute__((always_inline))
static inline void isp_ll_sharp_set_padding_mode(isp_dev_t *hw, isp_sharpen_edge_padding_mode_t padding_mode)
{
hw->sharp_matrix_ctrl.sharp_padding_mode = padding_mode;
}
/**
* @brief Set ISP sharpen padding data
*
* @param[in] hw Hardware instance address
* @param[in] padding_data padding data
*/
__attribute__((always_inline))
static inline void isp_ll_sharp_set_padding_data(isp_dev_t *hw, uint32_t padding_data)
{
hw->sharp_matrix_ctrl.sharp_padding_data = padding_data;
}
/**
* @brief Set ISP sharpen tail start pulse pixel
*
* @param[in] hw Hardware instance address
* @param[in] start_pixel start pixel value
*/
__attribute__((always_inline))
static inline void isp_ll_sharp_set_padding_line_tail_valid_start_pixel(isp_dev_t *hw, uint32_t start_pixel)
{
hw->sharp_matrix_ctrl.sharp_tail_pixen_pulse_tl = start_pixel;
}
/**
* @brief Set ISP sharpen tail pulse end pixel
*
* @param[in] hw Hardware instance address
* @param[in] end_pixel end pixel value
*/
__attribute__((always_inline))
static inline void isp_ll_sharp_set_padding_line_tail_valid_end_pixel(isp_dev_t *hw, uint32_t end_pixel)
{
hw->sharp_matrix_ctrl.sharp_tail_pixen_pulse_th = end_pixel;
}
/**
* @brief Set ISP sharpen template
*
* @param[in] hw Hardware instance address
* @param[in] template_arr 2-d array for the template
*/
__attribute__((always_inline))
static inline void isp_ll_sharp_set_template(isp_dev_t *hw, uint8_t template_arr[SOC_ISP_SHARPEN_TEMPLATE_X_NUMS][SOC_ISP_SHARPEN_TEMPLATE_Y_NUMS])
{
for (int i = 0; i < SOC_ISP_SHARPEN_TEMPLATE_X_NUMS; i++) {
for (int j = 0; j < SOC_ISP_SHARPEN_TEMPLATE_Y_NUMS; j++) {
if (j == 0) {
hw->sharp_filter[i].sharp_filter_coe0 = template_arr[i][j];
} else if (j == 1) {
hw->sharp_filter[i].sharp_filter_coe1 = template_arr[i][j];
} else if (j == 2) {
hw->sharp_filter[i].sharp_filter_coe2 = template_arr[i][j];
} else {
HAL_ASSERT(false);
}
}
}
}
/**
* @brief Get ISP sharpen high freq image pixel max value
*
* @param[in] hw Hardware instance address
*
* @return Max value
*/
__attribute__((always_inline))
static inline uint8_t isp_ll_sharp_get_high_freq_pixel_max(isp_dev_t *hw)
{
return hw->sharp_ctrl1.sharp_gradient_max;
}
#ifdef __cplusplus
}
#endif

View File

@ -33,6 +33,21 @@ typedef struct {
uint8_t padding_line_tail_valid_end_pixel; ///< BF edge padding line tail valid end pixel
} isp_hal_bf_cfg_t;
/**
* @brief Sharpen configurations
*/
typedef struct {
isp_sharpen_h_freq_coeff h_freq_coeff; ///< High freq pixel sharpeness coeff
isp_sharpen_m_freq_coeff m_freq_coeff; ///< Medium freq pixel sharpeness coeff
uint8_t h_thresh; ///< High threshold, pixel value higher than this threshold will be multiplied by `h_freq_coeff`
uint8_t l_thresh; ///< Low threshold, pixel value higher than this threshold but lower than `h_thresh` will be multiplied by `m_freq_coeff`. Pixel value lower than this threshold will be set to 0
isp_sharpen_edge_padding_mode_t padding_mode; ///< Sharpen edge padding mode
uint8_t padding_data; ///< Sharpen edge padding pixel data
uint8_t sharpen_template[ISP_SHARPEN_TEMPLATE_X_NUMS][ISP_SHARPEN_TEMPLATE_Y_NUMS]; ///< Sharpen template data
uint8_t padding_line_tail_valid_start_pixel; ///< Sharpen edge padding line tail valid start pixel
uint8_t padding_line_tail_valid_end_pixel; ///< Sharpen edge padding line tail valid end pixel
} isp_hal_sharpen_cfg_t;
/**
* @brief Context that should be maintained by both the driver and the HAL
*/
@ -77,43 +92,6 @@ void isp_hal_af_window_config(isp_hal_context_t *hal, int window_id, const isp_w
*/
void isp_hal_ae_window_config(isp_hal_context_t *hal, const isp_window_t *window);
/*---------------------------------------------------------------
INTR
---------------------------------------------------------------*/
/**
* @brief Clear ISP HW intr event
*
* @param[in] hal Context of the HAL layer
* @param[in] mask HW event mask
*/
uint32_t isp_hal_check_clear_intr_event(isp_hal_context_t *hal, uint32_t mask);
/*---------------------------------------------------------------
BF
---------------------------------------------------------------*/
/**
* @brief Configure ISP BF registers
*
* @param[in] hal Context of the HAL layer
* @param[in] config BF config, set NULL to de-config the ISP BF
*/
void isp_hal_bf_config(isp_hal_context_t *hal, isp_hal_bf_cfg_t *config);
/*---------------------------------------------------------------
Color Correction Matrix
---------------------------------------------------------------*/
/**
* @brief Set Color Correction Matrix
*
* @param[in] hal Context of the HAL layer
* @param[in] saturation Whether to enable saturation when float data overflow
* @param[in] flt_matrix 3x3 RGB correction matrix
* @return
* - true Set success
* - false Invalid argument
*/
bool isp_hal_ccm_set_matrix(isp_hal_context_t *hal, bool saturation, const float flt_matrix[ISP_CCM_DIMENSION][ISP_CCM_DIMENSION]);
/*---------------------------------------------------------------
AWB
---------------------------------------------------------------*/
@ -162,6 +140,54 @@ bool isp_hal_awb_set_rg_ratio_range(isp_hal_context_t *hal, float rg_min, float
*/
bool isp_hal_awb_set_bg_ratio_range(isp_hal_context_t *hal, float bg_min, float bg_max);
/*---------------------------------------------------------------
BF
---------------------------------------------------------------*/
/**
* @brief Configure ISP BF
*
* @param[in] hal Context of the HAL layer
* @param[in] config BF config, set NULL to de-config the ISP BF
*/
void isp_hal_bf_config(isp_hal_context_t *hal, isp_hal_bf_cfg_t *config);
/*---------------------------------------------------------------
Color Correction Matrix
---------------------------------------------------------------*/
/**
* @brief Set Color Correction Matrix
*
* @param[in] hal Context of the HAL layer
* @param[in] saturation Whether to enable saturation when float data overflow
* @param[in] flt_matrix 3x3 RGB correction matrix
* @return
* - true Set success
* - false Invalid argument
*/
bool isp_hal_ccm_set_matrix(const isp_hal_context_t *hal, bool saturation, const float flt_matrix[ISP_CCM_DIMENSION][ISP_CCM_DIMENSION]);
/*---------------------------------------------------------------
INTR
---------------------------------------------------------------*/
/**
* @brief Clear ISP HW intr event
*
* @param[in] hal Context of the HAL layer
* @param[in] mask HW event mask
*/
uint32_t isp_hal_check_clear_intr_event(const isp_hal_context_t *hal, uint32_t mask);
/*---------------------------------------------------------------
Sharpness
---------------------------------------------------------------*/
/**
* @brief Configure ISP sharpeness
*
* @param[in] hal Context of the HAL layer
* @param[in] config Sharpness config, set NULL to de-config the ISP sharpness
*/
void isp_hal_sharpen_config(isp_hal_context_t *hal, isp_hal_sharpen_cfg_t *config);
#ifdef __cplusplus
}
#endif

View File

@ -64,14 +64,26 @@ typedef enum {
} isp_color_t;
/*---------------------------------------------------------------
DVP
AE
---------------------------------------------------------------*/
#if SOC_ISP_DVP_DATA_WIDTH_MAX
#define ISP_DVP_DATA_SIG_NUM SOC_ISP_DVP_DATA_WIDTH_MAX // The ISP DVP data signal number
#if (SOC_ISP_AE_BLOCK_X_NUMS && SOC_ISP_AE_BLOCK_Y_NUMS)
#define ISP_AE_BLOCK_X_NUM SOC_ISP_AE_BLOCK_X_NUMS // The AF window number for sampling
#define ISP_AE_BLOCK_Y_NUM SOC_ISP_AE_BLOCK_Y_NUMS // The AF window number for sampling
#else
#define ISP_DVP_DATA_SIG_NUM 0
#define ISP_AE_BLOCK_X_NUM 0
#define ISP_AE_BLOCK_Y_NUM 0
#endif
/**
* @brief ISP AE input data source
*
*/
typedef enum {
ISP_AE_SAMPLE_POINT_AFTER_DEMOSAIC, ///< AE input data after demosaic
ISP_AE_SAMPLE_POINT_AFTER_GAMMA, ///< AE input data after gamma
} isp_ae_sample_point_t;
/*---------------------------------------------------------------
AF
---------------------------------------------------------------*/
@ -81,6 +93,19 @@ typedef enum {
#define ISP_AF_WINDOW_NUM 0
#endif
/*---------------------------------------------------------------
AWB
---------------------------------------------------------------*/
/**
* @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)
ISP_AWB_SAMPLE_POINT_AFTER_CCM, ///< Sample AWB data after CCM (Color Correction Matrix)
} isp_awb_sample_point_t;
/*---------------------------------------------------------------
BF
---------------------------------------------------------------*/
@ -110,38 +135,69 @@ typedef enum {
#endif
/*---------------------------------------------------------------
AWB
DVP
---------------------------------------------------------------*/
/**
* @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)
ISP_AWB_SAMPLE_POINT_AFTER_CCM, ///< Sample AWB data after CCM (Color Correction Matrix)
} isp_awb_sample_point_t;
/*---------------------------------------------------------------
AE
---------------------------------------------------------------*/
#if (SOC_ISP_AE_BLOCK_X_NUMS && SOC_ISP_AE_BLOCK_Y_NUMS)
#define ISP_AE_BLOCK_X_NUM SOC_ISP_AE_BLOCK_X_NUMS // The AF window number for sampling
#define ISP_AE_BLOCK_Y_NUM SOC_ISP_AE_BLOCK_Y_NUMS // The AF window number for sampling
#if SOC_ISP_DVP_DATA_WIDTH_MAX
#define ISP_DVP_DATA_SIG_NUM SOC_ISP_DVP_DATA_WIDTH_MAX // The ISP DVP data signal number
#else
#define ISP_AE_BLOCK_X_NUM 0
#define ISP_AE_BLOCK_Y_NUM 0
#define ISP_DVP_DATA_SIG_NUM 0
#endif
/*---------------------------------------------------------------
Sharpen
---------------------------------------------------------------*/
#if SOC_ISP_SHARPEN_SUPPORTED
#define ISP_SHARPEN_TEMPLATE_X_NUMS SOC_ISP_SHARPEN_TEMPLATE_X_NUMS // Sharpen template x field nums
#define ISP_SHARPEN_TEMPLATE_Y_NUMS SOC_ISP_SHARPEN_TEMPLATE_Y_NUMS // Sharpen template y field nums
#define ISP_SHARPEN_H_FREQ_COEF_INT_BITS SOC_ISP_SHARPEN_H_FREQ_COEF_INT_BITS
#define ISP_SHARPEN_H_FREQ_COEF_DEC_BITS SOC_ISP_SHARPEN_H_FREQ_COEF_DEC_BITS
#define ISP_SHARPEN_H_FREQ_COEF_RES_BITS SOC_ISP_SHARPEN_H_FREQ_COEF_RES_BITS
#define ISP_SHARPEN_M_FREQ_COEF_INT_BITS SOC_ISP_SHARPEN_M_FREQ_COEF_INT_BITS
#define ISP_SHARPEN_M_FREQ_COEF_DEC_BITS SOC_ISP_SHARPEN_M_FREQ_COEF_DEC_BITS
#define ISP_SHARPEN_M_FREQ_COEF_RES_BITS SOC_ISP_SHARPEN_M_FREQ_COEF_RES_BITS
#else
#define ISP_SHARPEN_TEMPLATE_X_NUMS 0
#define ISP_SHARPEN_TEMPLATE_Y_NUMS 0
#define ISP_SHARPEN_H_FREQ_COEF_INT_BITS 8
#define ISP_SHARPEN_H_FREQ_COEF_DEC_BITS 8
#define ISP_SHARPEN_H_FREQ_COEF_RES_BITS 16
#define ISP_SHARPEN_M_FREQ_COEF_INT_BITS 8
#define ISP_SHARPEN_M_FREQ_COEF_DEC_BITS 8
#define ISP_SHARPEN_M_FREQ_COEF_RES_BITS 16
#endif
/**
* @brief ISP AE input data source
*
* @brief High freq pixel sharpeness coeff
*/
typedef union {
struct {
uint32_t decimal:ISP_SHARPEN_H_FREQ_COEF_DEC_BITS; ///< Integer part
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;
} isp_sharpen_h_freq_coeff;
/**
* @brief Medium freq pixel sharpeness coeff
*/
typedef union {
struct {
uint32_t decimal:ISP_SHARPEN_M_FREQ_COEF_DEC_BITS; ///< Integer part
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;
} isp_sharpen_m_freq_coeff;
/**
* @brief ISP Sharpen edge padding mode
*/
typedef enum {
ISP_AE_SAMPLE_POINT_AFTER_DEMOSAIC, ///< AE input data after demosaic
ISP_AE_SAMPLE_POINT_AFTER_GAMMA, ///< AE input data after gamma
} isp_ae_sample_point_t;
ISP_SHARPEN_EDGE_PADDING_MODE_SRND_DATA, ///< Fill Sharpen edge padding data with surrounding pixel data
ISP_SHARPEN_EDGE_PADDING_MODE_CUSTOM_DATA, ///< Fill Sharpen edge padding data with custom pixel data
} isp_sharpen_edge_padding_mode_t;
#ifdef __cplusplus
}

View File

@ -26,38 +26,6 @@ void isp_hal_init(isp_hal_context_t *hal, int isp_id)
isp_ll_init(hal->hw);
}
/*---------------------------------------------------------------
AF
---------------------------------------------------------------*/
void isp_hal_af_window_config(isp_hal_context_t *hal, int window_id, const isp_window_t *window)
{
isp_ll_af_set_window_range(hal->hw, window_id, window->top_left.x, window->top_left.y, window->btm_right.x, window->btm_right.y);
}
/*---------------------------------------------------------------
BF
---------------------------------------------------------------*/
void isp_hal_bf_config(isp_hal_context_t *hal, isp_hal_bf_cfg_t *config)
{
if (config) {
isp_ll_bf_set_sigma(hal->hw, config->denoising_level);
isp_ll_bf_set_padding_mode(hal->hw, config->padding_mode);
isp_ll_bf_set_padding_data(hal->hw, config->padding_data);
isp_ll_bf_set_padding_line_tail_valid_start_pixel(hal->hw, config->padding_line_tail_valid_start_pixel);
isp_ll_bf_set_padding_line_tail_valid_end_pixel(hal->hw, config->padding_line_tail_valid_end_pixel);
isp_ll_bf_set_template(hal->hw, config->bf_template);
} else {
isp_ll_bf_set_sigma(hal->hw, 0);
isp_ll_bf_set_padding_mode(hal->hw, 0);
isp_ll_bf_set_padding_data(hal->hw, 0);
isp_ll_bf_set_padding_line_tail_valid_start_pixel(hal->hw, 0);
isp_ll_bf_set_padding_line_tail_valid_end_pixel(hal->hw, 0);
uint8_t default_template[SOC_ISP_BF_TEMPLATE_X_NUMS][SOC_ISP_BF_TEMPLATE_Y_NUMS] = {};
memset(default_template, SOC_ISP_BF_TEMPLATE_X_NUMS, sizeof(default_template));
isp_ll_bf_set_template(hal->hw, default_template);
}
}
/*---------------------------------------------------------------
AE
---------------------------------------------------------------*/
@ -76,41 +44,11 @@ void isp_hal_ae_window_config(isp_hal_context_t *hal, const isp_window_t *window
}
/*---------------------------------------------------------------
INTR, put in iram
AF
---------------------------------------------------------------*/
uint32_t isp_hal_check_clear_intr_event(isp_hal_context_t *hal, uint32_t mask)
void isp_hal_af_window_config(isp_hal_context_t *hal, int window_id, const isp_window_t *window)
{
uint32_t triggered_events = isp_ll_get_intr_status(hal->hw) & mask;
if (triggered_events) {
isp_ll_clear_intr(hal->hw, triggered_events);
}
return triggered_events;
}
/*---------------------------------------------------------------
Color Correction Matrix
---------------------------------------------------------------*/
bool isp_hal_ccm_set_matrix(isp_hal_context_t *hal, bool saturation, const float flt_matrix[ISP_CCM_DIMENSION][ISP_CCM_DIMENSION])
{
isp_ll_ccm_gain_t fp_matrix[ISP_CCM_DIMENSION][ISP_CCM_DIMENSION] = {};
hal_utils_fixed_point_t fp_cfg = {
.int_bit = ISP_LL_CCM_MATRIX_INT_BITS,
.frac_bit = ISP_LL_CCM_MATRIX_FRAC_BITS,
.saturation = saturation,
};
int err_level = saturation ? -1 : 0;
/* Transfer the float type to fixed point */
for (int i = 0; i < ISP_CCM_DIMENSION; i++) {
for (int j = 0; j < ISP_CCM_DIMENSION; j++) {
if (hal_utils_float_to_fixed_point_32b(flt_matrix[i][j], &fp_cfg, &fp_matrix[i][j].val) < err_level) {
return false;
}
}
}
isp_ll_ccm_set_matrix(hal->hw, fp_matrix);
return true;
isp_ll_af_set_window_range(hal->hw, window_id, window->top_left.x, window->top_left.y, window->btm_right.x, window->btm_right.y);
}
/*---------------------------------------------------------------
@ -181,3 +119,97 @@ bool isp_hal_awb_set_bg_ratio_range(isp_hal_context_t *hal, float bg_min, float
isp_ll_awb_set_bg_ratio_range(hal->hw, fp_bg_min, fp_bg_max);
return true;
}
/*---------------------------------------------------------------
BF
---------------------------------------------------------------*/
void isp_hal_bf_config(isp_hal_context_t *hal, isp_hal_bf_cfg_t *config)
{
if (config) {
isp_ll_bf_set_sigma(hal->hw, config->denoising_level);
isp_ll_bf_set_padding_mode(hal->hw, config->padding_mode);
isp_ll_bf_set_padding_data(hal->hw, config->padding_data);
isp_ll_bf_set_padding_line_tail_valid_start_pixel(hal->hw, config->padding_line_tail_valid_start_pixel);
isp_ll_bf_set_padding_line_tail_valid_end_pixel(hal->hw, config->padding_line_tail_valid_end_pixel);
isp_ll_bf_set_template(hal->hw, config->bf_template);
} else {
isp_ll_bf_set_sigma(hal->hw, 0);
isp_ll_bf_set_padding_mode(hal->hw, 0);
isp_ll_bf_set_padding_data(hal->hw, 0);
isp_ll_bf_set_padding_line_tail_valid_start_pixel(hal->hw, 0);
isp_ll_bf_set_padding_line_tail_valid_end_pixel(hal->hw, 0);
uint8_t default_template[SOC_ISP_BF_TEMPLATE_X_NUMS][SOC_ISP_BF_TEMPLATE_Y_NUMS] = {};
memset(default_template, 0, sizeof(default_template));
isp_ll_bf_set_template(hal->hw, default_template);
}
}
/*---------------------------------------------------------------
Color Correction Matrix
---------------------------------------------------------------*/
bool isp_hal_ccm_set_matrix(const isp_hal_context_t *hal, bool saturation, const float flt_matrix[ISP_CCM_DIMENSION][ISP_CCM_DIMENSION])
{
isp_ll_ccm_gain_t fp_matrix[ISP_CCM_DIMENSION][ISP_CCM_DIMENSION] = {};
hal_utils_fixed_point_t fp_cfg = {
.int_bit = ISP_LL_CCM_MATRIX_INT_BITS,
.frac_bit = ISP_LL_CCM_MATRIX_FRAC_BITS,
.saturation = saturation,
};
int err_level = saturation ? -1 : 0;
/* Transfer the float type to fixed point */
for (int i = 0; i < ISP_CCM_DIMENSION; i++) {
for (int j = 0; j < ISP_CCM_DIMENSION; j++) {
if (hal_utils_float_to_fixed_point_32b(flt_matrix[i][j], &fp_cfg, &fp_matrix[i][j].val) < err_level) {
return false;
}
}
}
isp_ll_ccm_set_matrix(hal->hw, fp_matrix);
return true;
}
/*---------------------------------------------------------------
INTR, put in iram
---------------------------------------------------------------*/
uint32_t isp_hal_check_clear_intr_event(const isp_hal_context_t *hal, uint32_t mask)
{
uint32_t triggered_events = isp_ll_get_intr_status(hal->hw) & mask;
if (triggered_events) {
isp_ll_clear_intr(hal->hw, triggered_events);
}
return triggered_events;
}
/*---------------------------------------------------------------
Sharpness
---------------------------------------------------------------*/
void isp_hal_sharpen_config(isp_hal_context_t *hal, isp_hal_sharpen_cfg_t *config)
{
if (config) {
isp_ll_sharp_set_low_thresh(hal->hw, config->l_thresh);
isp_ll_sharp_set_high_thresh(hal->hw, config->h_thresh);
isp_ll_sharp_set_medium_freq_coeff(hal->hw, config->m_freq_coeff);
isp_ll_sharp_set_high_freq_coeff(hal->hw, config->h_freq_coeff);
isp_ll_sharp_set_padding_mode(hal->hw, config->padding_mode);
isp_ll_sharp_set_padding_data(hal->hw, config->padding_data);
isp_ll_sharp_set_padding_line_tail_valid_start_pixel(hal->hw, config->padding_line_tail_valid_start_pixel);
isp_ll_sharp_set_padding_line_tail_valid_end_pixel(hal->hw, config->padding_line_tail_valid_end_pixel);
isp_ll_sharp_set_template(hal->hw, config->sharpen_template);
} else {
isp_ll_sharp_set_low_thresh(hal->hw, 0);
isp_ll_sharp_set_high_thresh(hal->hw, 0);
isp_sharpen_m_freq_coeff m_freq = {};
isp_sharpen_h_freq_coeff h_freq = {};
isp_ll_sharp_set_medium_freq_coeff(hal->hw, m_freq);
isp_ll_sharp_set_high_freq_coeff(hal->hw, h_freq);
isp_ll_sharp_set_padding_mode(hal->hw, 0);
isp_ll_sharp_set_padding_data(hal->hw, 0);
isp_ll_sharp_set_padding_line_tail_valid_start_pixel(hal->hw, 0);
isp_ll_sharp_set_padding_line_tail_valid_end_pixel(hal->hw, 0);
uint8_t default_template[SOC_ISP_SHARPEN_TEMPLATE_X_NUMS][SOC_ISP_SHARPEN_TEMPLATE_Y_NUMS] = {};
memset(default_template, 0, sizeof(default_template));
isp_ll_sharp_set_template(hal->hw, default_template);
}
}

View File

@ -835,6 +835,14 @@ config SOC_ISP_DVP_SUPPORTED
bool
default y
config SOC_ISP_SHARPEN_SUPPORTED
bool
default y
config SOC_ISP_SHARE_CSI_BRG
bool
default y
config SOC_ISP_NUMS
int
default 1
@ -843,14 +851,6 @@ config SOC_ISP_DVP_CTLR_NUMS
int
default 1
config SOC_ISP_AF_CTLR_NUMS
int
default 1
config SOC_ISP_AF_WINDOW_NUMS
int
default 3
config SOC_ISP_AE_CTLR_NUMS
int
default 1
@ -863,9 +863,13 @@ config SOC_ISP_AE_BLOCK_Y_NUMS
int
default 5
config SOC_ISP_SHARE_CSI_BRG
bool
default y
config SOC_ISP_AF_CTLR_NUMS
int
default 1
config SOC_ISP_AF_WINDOW_NUMS
int
default 3
config SOC_ISP_BF_TEMPLATE_X_NUMS
int
@ -883,6 +887,38 @@ config SOC_ISP_DVP_DATA_WIDTH_MAX
int
default 16
config SOC_ISP_SHARPEN_TEMPLATE_X_NUMS
int
default 3
config SOC_ISP_SHARPEN_TEMPLATE_Y_NUMS
int
default 3
config SOC_ISP_SHARPEN_H_FREQ_COEF_INT_BITS
int
default 3
config SOC_ISP_SHARPEN_H_FREQ_COEF_DEC_BITS
int
default 5
config SOC_ISP_SHARPEN_H_FREQ_COEF_RES_BITS
int
default 24
config SOC_ISP_SHARPEN_M_FREQ_COEF_INT_BITS
int
default 3
config SOC_ISP_SHARPEN_M_FREQ_COEF_DEC_BITS
int
default 5
config SOC_ISP_SHARPEN_M_FREQ_COEF_RES_BITS
int
default 24
config SOC_LEDC_SUPPORT_PLL_DIV_CLOCK
bool
default y

View File

@ -1484,6 +1484,25 @@ typedef union {
uint32_t val;
} isp_sharp_filter2_reg_t;
typedef union {
struct {
/** sharp_filter_coe0 : R/W; bitpos: [4:0]; default: 1;
* this field configures usm filter coefficient
*/
uint32_t sharp_filter_coe0:5;
/** sharp_filter_coe1 : R/W; bitpos: [9:5]; default: 2;
* this field configures usm filter coefficient
*/
uint32_t sharp_filter_coe1:5;
/** sharp_filter_coe2 : R/W; bitpos: [14:10]; default: 1;
* this field configures usm filter coefficient
*/
uint32_t sharp_filter_coe2:5;
uint32_t reserved_15:17;
};
uint32_t val;
} isp_sharp_filter_reg_t;
/** Type of sharp_matrix_ctrl register
* sharp pix2matrix ctrl
*/
@ -3778,9 +3797,7 @@ typedef struct {
volatile isp_ae_win_reciprocal_reg_t ae_win_reciprocal;
volatile isp_ae_block_mean_reg_t ae_block_mean[7];
volatile isp_sharp_ctrl0_reg_t sharp_ctrl0;
volatile isp_sharp_filter0_reg_t sharp_filter0;
volatile isp_sharp_filter1_reg_t sharp_filter1;
volatile isp_sharp_filter2_reg_t sharp_filter2;
volatile isp_sharp_filter_reg_t sharp_filter[3];
volatile isp_sharp_matrix_ctrl_reg_t sharp_matrix_ctrl;
volatile isp_sharp_ctrl1_reg_t sharp_ctrl1;
volatile isp_dma_cntl_reg_t dma_cntl;

View File

@ -333,19 +333,28 @@
#define SOC_ISP_BF_SUPPORTED 1
#define SOC_ISP_CCM_SUPPORTED 1
#define SOC_ISP_DVP_SUPPORTED 1
#define SOC_ISP_SHARPEN_SUPPORTED 1
#define SOC_ISP_SHARE_CSI_BRG 1
#define SOC_ISP_NUMS 1U
#define SOC_ISP_DVP_CTLR_NUMS 1U
#define SOC_ISP_AF_CTLR_NUMS 1U
#define SOC_ISP_AF_WINDOW_NUMS 3
#define SOC_ISP_AE_CTLR_NUMS 1U
#define SOC_ISP_AE_BLOCK_X_NUMS 5
#define SOC_ISP_AE_BLOCK_Y_NUMS 5
#define SOC_ISP_SHARE_CSI_BRG 1
#define SOC_ISP_AF_CTLR_NUMS 1U
#define SOC_ISP_AF_WINDOW_NUMS 3
#define SOC_ISP_BF_TEMPLATE_X_NUMS 3
#define SOC_ISP_BF_TEMPLATE_Y_NUMS 3
#define SOC_ISP_CCM_DIMENSION 3
#define SOC_ISP_DVP_DATA_WIDTH_MAX 16
#define SOC_ISP_SHARPEN_TEMPLATE_X_NUMS 3
#define SOC_ISP_SHARPEN_TEMPLATE_Y_NUMS 3
#define SOC_ISP_SHARPEN_H_FREQ_COEF_INT_BITS 3
#define SOC_ISP_SHARPEN_H_FREQ_COEF_DEC_BITS 5
#define SOC_ISP_SHARPEN_H_FREQ_COEF_RES_BITS 24
#define SOC_ISP_SHARPEN_M_FREQ_COEF_INT_BITS 3
#define SOC_ISP_SHARPEN_M_FREQ_COEF_DEC_BITS 5
#define SOC_ISP_SHARPEN_M_FREQ_COEF_RES_BITS 24
/*-------------------------- LEDC CAPS ---------------------------------------*/
#define SOC_LEDC_SUPPORT_PLL_DIV_CLOCK (1)