change(isp): change isp_af_window_t to isp_window_t

This commit is contained in:
Armando 2024-06-04 14:58:51 +08:00
parent 9a1f67f222
commit ba79a66502
6 changed files with 38 additions and 36 deletions

View File

@ -19,7 +19,7 @@ extern "C" {
* @brief AF controller config
*/
typedef struct {
isp_af_window_t window[ISP_AF_WINDOW_NUM]; ///< The sampling windows of AF
isp_window_t window[ISP_AF_WINDOW_NUM]; ///< The sampling windows of AF
int edge_thresh; ///< Edge threshold, definition higher than this value will be counted as a valid pixel for calculating AF result
int intr_priority; ///< The interrupt priority, range 0~7, if set to 0, the driver will try to allocate an interrupt with a relative low priority (1,2,3) otherwise the larger the higher, 7 is NMI
} esp_isp_af_config_t;

View File

@ -88,17 +88,17 @@ esp_err_t esp_isp_new_af_controller(isp_proc_handle_t isp_proc, const esp_isp_af
ESP_RETURN_ON_FALSE(demosaic_en && rgb2yuv_en, ESP_ERR_INVALID_STATE, TAG, "RGB2YUV not enabled, please update the output_data_color_type");
for (int i = 0; i < SOC_ISP_AF_WINDOW_NUMS; i++) {
ESP_LOGV(TAG, "af_config->window[%d].top_left_x: %"PRId32, i, af_config->window[i].top_left_x);
ESP_LOGV(TAG, "af_config->window[%d].bottom_right_x: %"PRId32, i, af_config->window[i].bottom_right_x);
ESP_LOGV(TAG, "af_config->window[%d].bottom_right_y: %"PRId32, i, af_config->window[i].bottom_right_y);
ESP_LOGV(TAG, "af_config->window[%d].top_left_y: %"PRId32, i, af_config->window[i].top_left_y);
ESP_LOGV(TAG, "af_config->window[%d].top_left.x: %"PRId32, i, af_config->window[i].top_left.x);
ESP_LOGV(TAG, "af_config->window[%d].btm_right.x: %"PRId32, i, af_config->window[i].btm_right.x);
ESP_LOGV(TAG, "af_config->window[%d].btm_right.y: %"PRId32, i, af_config->window[i].btm_right.y);
ESP_LOGV(TAG, "af_config->window[%d].top_left.y: %"PRId32, i, af_config->window[i].top_left.y);
ESP_RETURN_ON_FALSE(((af_config->window[i].top_left_x < ISP_LL_AF_WINDOW_MAX_RANGE) &&
(af_config->window[i].bottom_right_x >= af_config->window[i].top_left_x) &&
(af_config->window[i].bottom_right_x < ISP_LL_AF_WINDOW_MAX_RANGE) &&
(af_config->window[i].top_left_y < ISP_LL_AF_WINDOW_MAX_RANGE) &&
(af_config->window[i].bottom_right_y >= af_config->window[i].top_left_y) &&
(af_config->window[i].bottom_right_y < ISP_LL_AF_WINDOW_MAX_RANGE)), ESP_ERR_INVALID_ARG, TAG, "invalid window");
ESP_RETURN_ON_FALSE(((af_config->window[i].top_left.x < ISP_LL_AF_WINDOW_MAX_RANGE) &&
(af_config->window[i].btm_right.x >= af_config->window[i].top_left.x) &&
(af_config->window[i].btm_right.x < ISP_LL_AF_WINDOW_MAX_RANGE) &&
(af_config->window[i].top_left.y < ISP_LL_AF_WINDOW_MAX_RANGE) &&
(af_config->window[i].btm_right.y >= af_config->window[i].top_left.y) &&
(af_config->window[i].btm_right.y < ISP_LL_AF_WINDOW_MAX_RANGE)), ESP_ERR_INVALID_ARG, TAG, "invalid window");
}
ESP_RETURN_ON_FALSE(af_config->edge_thresh > 0, ESP_ERR_INVALID_ARG, TAG, "edge threshold should be larger than 0");

View File

@ -64,7 +64,7 @@ void isp_hal_init(isp_hal_context_t *hal, int isp_id);
* @param[in] window_id Window ID
* @param[in] window Window info, see `isp_window_t`
*/
void isp_hal_af_window_config(const isp_hal_context_t *hal, int window_id, const isp_af_window_t *window);
void isp_hal_af_window_config(const isp_hal_context_t *hal, int window_id, const isp_window_t *window);
/*---------------------------------------------------------------
INTR

View File

@ -81,16 +81,6 @@ typedef enum {
#define ISP_AF_WINDOW_NUM 0
#endif
/**
* @brief ISP AF window
*/
typedef struct {
uint32_t top_left_x; ///< Top left x axis value
uint32_t top_left_y; ///< Top left y axis value
uint32_t bottom_right_x; ///< Bottom right x axis value
uint32_t bottom_right_y; ///< Bottom right y axis value
} isp_af_window_t;
/*---------------------------------------------------------------
BF
---------------------------------------------------------------*/

View File

@ -29,9 +29,9 @@ void isp_hal_init(isp_hal_context_t *hal, int isp_id)
/*---------------------------------------------------------------
AF
---------------------------------------------------------------*/
void isp_hal_af_window_config(const isp_hal_context_t *hal, int window_id, const isp_af_window_t *window)
void isp_hal_af_window_config(const 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->bottom_right_x, window->bottom_right_y);
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);
}
/*---------------------------------------------------------------

View File

@ -99,22 +99,34 @@ static void af_task(void *arg)
esp_isp_af_config_t af_config = {
.window = {
[0] = {
.top_left_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
.bottom_right_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
.top_left_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
.bottom_right_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
.top_left = {
.x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
.y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
},
.btm_right = {
.x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
.y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
},
},
[1] = {
.top_left_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
.bottom_right_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
.top_left_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
.bottom_right_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
.top_left = {
.x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
.y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
},
.btm_right = {
.x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
.y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
},
},
[2] = {
.top_left_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
.bottom_right_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
.top_left_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
.bottom_right_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
.top_left = {
.x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
.y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
},
.btm_right = {
.x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
.y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
},
},
},
.edge_thresh = 128,