mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-04 06:11:06 +00:00 
			
		
		
		
	change(isp): change isp_af_window_t to isp_window_t
This commit is contained in:
		@@ -19,7 +19,7 @@ extern "C" {
 | 
				
			|||||||
 * @brief AF controller config
 | 
					 * @brief AF controller config
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
typedef struct {
 | 
					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 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
 | 
					    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;
 | 
					} esp_isp_af_config_t;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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");
 | 
					    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++) {
 | 
					    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].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].btm_right.x: %"PRId32, i, af_config->window[i].btm_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].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_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) &&
 | 
					        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].btm_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].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].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].btm_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");
 | 
					                             (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");
 | 
					    ESP_RETURN_ON_FALSE(af_config->edge_thresh > 0, ESP_ERR_INVALID_ARG, TAG, "edge threshold should be larger than 0");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,7 +62,7 @@ void isp_hal_init(isp_hal_context_t *hal, int isp_id);
 | 
				
			|||||||
 * @param[in] window_id  Window ID
 | 
					 * @param[in] window_id  Window ID
 | 
				
			||||||
 * @param[in] window     Window info, see `isp_af_window_t`
 | 
					 * @param[in] window     Window info, see `isp_af_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
 | 
					                      INTR
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,6 +23,24 @@ typedef soc_periph_isp_clk_src_t    isp_clk_src_t;     ///< Clock source type of
 | 
				
			|||||||
typedef int                         isp_clk_src_t;     ///< Default type
 | 
					typedef int                         isp_clk_src_t;     ///< Default type
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @brief ISP coordinate type
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					    uint32_t    x;      ///< X coordinate of the point
 | 
				
			||||||
 | 
					    uint32_t    y;      ///< Y coordinate of the point
 | 
				
			||||||
 | 
					} isp_coordinate_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @brief ISP window type
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					    isp_coordinate_t top_left;       ///< The top left point coordinate
 | 
				
			||||||
 | 
					    isp_coordinate_t btm_right;      ///< The bottom right point coordinate
 | 
				
			||||||
 | 
					} isp_window_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief ISP Input Source
 | 
					 * @brief ISP Input Source
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -63,16 +81,6 @@ typedef enum {
 | 
				
			|||||||
#define ISP_AF_WINDOW_NUM   0
 | 
					#define ISP_AF_WINDOW_NUM   0
 | 
				
			||||||
#endif
 | 
					#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;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief ISP AF result
 | 
					 * @brief ISP AF result
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,9 +27,9 @@ void isp_hal_init(isp_hal_context_t *hal, int isp_id)
 | 
				
			|||||||
/*---------------------------------------------------------------
 | 
					/*---------------------------------------------------------------
 | 
				
			||||||
                      AF
 | 
					                      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);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*---------------------------------------------------------------
 | 
					/*---------------------------------------------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -99,22 +99,34 @@ static void af_task(void *arg)
 | 
				
			|||||||
    esp_isp_af_config_t af_config = {
 | 
					    esp_isp_af_config_t af_config = {
 | 
				
			||||||
        .window = {
 | 
					        .window = {
 | 
				
			||||||
            [0] = {
 | 
					            [0] = {
 | 
				
			||||||
                .top_left_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
 | 
					                .top_left = {
 | 
				
			||||||
                .bottom_right_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
 | 
					                    .x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
 | 
				
			||||||
                .top_left_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
 | 
					                    .y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
 | 
				
			||||||
                .bottom_right_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
 | 
					                },
 | 
				
			||||||
 | 
					                .btm_right = {
 | 
				
			||||||
 | 
					                    .x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
 | 
				
			||||||
 | 
					                    .y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            [1] = {
 | 
					            [1] = {
 | 
				
			||||||
                .top_left_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
 | 
					                .top_left = {
 | 
				
			||||||
                .bottom_right_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
 | 
					                    .x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
 | 
				
			||||||
                .top_left_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
 | 
					                    .y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
 | 
				
			||||||
                .bottom_right_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
 | 
					                },
 | 
				
			||||||
 | 
					                .btm_right = {
 | 
				
			||||||
 | 
					                    .x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
 | 
				
			||||||
 | 
					                    .y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            [2] = {
 | 
					            [2] = {
 | 
				
			||||||
                .top_left_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
 | 
					                .top_left = {
 | 
				
			||||||
                .bottom_right_x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
 | 
					                    .x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) - 100,
 | 
				
			||||||
                .top_left_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
 | 
					                    .y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) - 100,
 | 
				
			||||||
                .bottom_right_y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
 | 
					                },
 | 
				
			||||||
 | 
					                .btm_right = {
 | 
				
			||||||
 | 
					                    .x = (CONFIG_EXAMPLE_MIPI_CSI_DISP_HRES / 2) + 99,
 | 
				
			||||||
 | 
					                    .y = (CONFIG_EXAMPLE_MIPI_CSI_DISP_VRES / 2) + 99,
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        .edge_thresh = 128,
 | 
					        .edge_thresh = 128,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user