From 43ba57e7042d8fe23eebee99691c58956e4decf3 Mon Sep 17 00:00:00 2001 From: Armando Date: Wed, 24 Jul 2024 15:59:26 +0800 Subject: [PATCH] change(isp): rename isp_af example to isp example --- examples/peripherals/.build-test-rules.yml | 2 +- .../CMakeLists.txt | 2 +- .../{auto_focus => multi_pipelines}/README.md | 7 +++-- .../components/isp_af_schemes/CMakeLists.txt | 0 .../isp_af_schemes/include/isp_af_scheme.h | 0 .../isp_af_schemes/include/isp_af_scheme_sa.h | 0 .../interface/isp_af_scheme_interface.h | 0 .../isp_af_schemes/src/isp_af_scheme.c | 0 .../isp_af_schemes/src/isp_af_scheme_sa.c | 0 .../main/CMakeLists.txt | 2 +- .../main/Kconfig.projbuild | 0 .../main/example_config.h | 0 .../main/idf_component.yml | 2 +- .../main/isp_dsi_main.c} | 31 +++++++++++++++++-- .../sdkconfig.defaults | 0 15 files changed, 37 insertions(+), 9 deletions(-) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/CMakeLists.txt (88%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/README.md (98%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/components/isp_af_schemes/CMakeLists.txt (100%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/components/isp_af_schemes/include/isp_af_scheme.h (100%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/components/isp_af_schemes/include/isp_af_scheme_sa.h (100%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/components/isp_af_schemes/interface/isp_af_scheme_interface.h (100%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/components/isp_af_schemes/src/isp_af_scheme.c (100%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/components/isp_af_schemes/src/isp_af_scheme_sa.c (100%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/main/CMakeLists.txt (77%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/main/Kconfig.projbuild (100%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/main/example_config.h (100%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/main/idf_component.yml (72%) rename examples/peripherals/isp/{auto_focus/main/isp_af_dsi_main.c => multi_pipelines/main/isp_dsi_main.c} (92%) rename examples/peripherals/isp/{auto_focus => multi_pipelines}/sdkconfig.defaults (100%) diff --git a/examples/peripherals/.build-test-rules.yml b/examples/peripherals/.build-test-rules.yml index f7fd70f16e..fa0fee84b3 100644 --- a/examples/peripherals/.build-test-rules.yml +++ b/examples/peripherals/.build-test-rules.yml @@ -127,7 +127,7 @@ examples/peripherals/i2s/i2s_recorder: - esp_driver_spi - esp_driver_i2s -examples/peripherals/isp/auto_focus: +examples/peripherals/isp/multi_pipelines: disable: - if: SOC_MIPI_CSI_SUPPORTED != 1 or SOC_MIPI_DSI_SUPPORTED != 1 or SOC_ISP_SUPPORTED != 1 depends_components: diff --git a/examples/peripherals/isp/auto_focus/CMakeLists.txt b/examples/peripherals/isp/multi_pipelines/CMakeLists.txt similarity index 88% rename from examples/peripherals/isp/auto_focus/CMakeLists.txt rename to examples/peripherals/isp/multi_pipelines/CMakeLists.txt index dd9fec70ab..3f12d866db 100644 --- a/examples/peripherals/isp/auto_focus/CMakeLists.txt +++ b/examples/peripherals/isp/multi_pipelines/CMakeLists.txt @@ -3,4 +3,4 @@ cmake_minimum_required(VERSION 3.16) include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(isp_af_dsi) +project(isp_multi_pipelines) diff --git a/examples/peripherals/isp/auto_focus/README.md b/examples/peripherals/isp/multi_pipelines/README.md similarity index 98% rename from examples/peripherals/isp/auto_focus/README.md rename to examples/peripherals/isp/multi_pipelines/README.md index 3e3ba628b4..06bb873d2f 100644 --- a/examples/peripherals/isp/auto_focus/README.md +++ b/examples/peripherals/isp/multi_pipelines/README.md @@ -2,11 +2,14 @@ | ----------------- | -------- | -# Camera display via DSI example +# Camera display plus ISP via DSI example ## Overview -This example demonstrates how to use the ISP (image signal processor) to work with esp_driver_cam component. This example will capture camera sensor signals via CSI interface and display it via DSI interface. This example also enables the ISP AF (auto-focus) feature and ISP BF (bayer denoise) feature. +This example demonstrates how to use the ISP (image signal processor) to work with esp_driver_cam component. This example will capture camera sensor signals via CSI interface and display it via DSI interface. This example enables +- ISP AF (auto-focus) feature +- ISP BF (bayer denoise) feature +- ISP Sharpen feature ## Usage diff --git a/examples/peripherals/isp/auto_focus/components/isp_af_schemes/CMakeLists.txt b/examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/CMakeLists.txt similarity index 100% rename from examples/peripherals/isp/auto_focus/components/isp_af_schemes/CMakeLists.txt rename to examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/CMakeLists.txt diff --git a/examples/peripherals/isp/auto_focus/components/isp_af_schemes/include/isp_af_scheme.h b/examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/include/isp_af_scheme.h similarity index 100% rename from examples/peripherals/isp/auto_focus/components/isp_af_schemes/include/isp_af_scheme.h rename to examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/include/isp_af_scheme.h diff --git a/examples/peripherals/isp/auto_focus/components/isp_af_schemes/include/isp_af_scheme_sa.h b/examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/include/isp_af_scheme_sa.h similarity index 100% rename from examples/peripherals/isp/auto_focus/components/isp_af_schemes/include/isp_af_scheme_sa.h rename to examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/include/isp_af_scheme_sa.h diff --git a/examples/peripherals/isp/auto_focus/components/isp_af_schemes/interface/isp_af_scheme_interface.h b/examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/interface/isp_af_scheme_interface.h similarity index 100% rename from examples/peripherals/isp/auto_focus/components/isp_af_schemes/interface/isp_af_scheme_interface.h rename to examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/interface/isp_af_scheme_interface.h diff --git a/examples/peripherals/isp/auto_focus/components/isp_af_schemes/src/isp_af_scheme.c b/examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/src/isp_af_scheme.c similarity index 100% rename from examples/peripherals/isp/auto_focus/components/isp_af_schemes/src/isp_af_scheme.c rename to examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/src/isp_af_scheme.c diff --git a/examples/peripherals/isp/auto_focus/components/isp_af_schemes/src/isp_af_scheme_sa.c b/examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/src/isp_af_scheme_sa.c similarity index 100% rename from examples/peripherals/isp/auto_focus/components/isp_af_schemes/src/isp_af_scheme_sa.c rename to examples/peripherals/isp/multi_pipelines/components/isp_af_schemes/src/isp_af_scheme_sa.c diff --git a/examples/peripherals/isp/auto_focus/main/CMakeLists.txt b/examples/peripherals/isp/multi_pipelines/main/CMakeLists.txt similarity index 77% rename from examples/peripherals/isp/auto_focus/main/CMakeLists.txt rename to examples/peripherals/isp/multi_pipelines/main/CMakeLists.txt index 60d0b9d605..32c38fe02a 100644 --- a/examples/peripherals/isp/auto_focus/main/CMakeLists.txt +++ b/examples/peripherals/isp/multi_pipelines/main/CMakeLists.txt @@ -1,4 +1,4 @@ -idf_component_register(SRCS "isp_af_dsi_main.c" +idf_component_register(SRCS "isp_dsi_main.c" INCLUDE_DIRS "." REQUIRES esp_mm esp_driver_isp esp_driver_cam esp_driver_i2c esp_lcd dsi_init ) diff --git a/examples/peripherals/isp/auto_focus/main/Kconfig.projbuild b/examples/peripherals/isp/multi_pipelines/main/Kconfig.projbuild similarity index 100% rename from examples/peripherals/isp/auto_focus/main/Kconfig.projbuild rename to examples/peripherals/isp/multi_pipelines/main/Kconfig.projbuild diff --git a/examples/peripherals/isp/auto_focus/main/example_config.h b/examples/peripherals/isp/multi_pipelines/main/example_config.h similarity index 100% rename from examples/peripherals/isp/auto_focus/main/example_config.h rename to examples/peripherals/isp/multi_pipelines/main/example_config.h diff --git a/examples/peripherals/isp/auto_focus/main/idf_component.yml b/examples/peripherals/isp/multi_pipelines/main/idf_component.yml similarity index 72% rename from examples/peripherals/isp/auto_focus/main/idf_component.yml rename to examples/peripherals/isp/multi_pipelines/main/idf_component.yml index 0e139a9d08..eddc6c99e9 100644 --- a/examples/peripherals/isp/auto_focus/main/idf_component.yml +++ b/examples/peripherals/isp/multi_pipelines/main/idf_component.yml @@ -4,6 +4,6 @@ dependencies: idf: version: ">=5.3.0" isp_af_schemes: - path: ${IDF_PATH}/examples/peripherals/isp/auto_focus/components/isp_af_schemes + path: ${IDF_PATH}/examples/peripherals/isp/multi_pipelines/components/isp_af_schemes dsi_init: path: ${IDF_PATH}/examples/peripherals/camera/camera_dsi/components/dsi_init diff --git a/examples/peripherals/isp/auto_focus/main/isp_af_dsi_main.c b/examples/peripherals/isp/multi_pipelines/main/isp_dsi_main.c similarity index 92% rename from examples/peripherals/isp/auto_focus/main/isp_af_dsi_main.c rename to examples/peripherals/isp/multi_pipelines/main/isp_dsi_main.c index 8f167c66c1..eca2d55dbc 100644 --- a/examples/peripherals/isp/auto_focus/main/isp_af_dsi_main.c +++ b/examples/peripherals/isp/multi_pipelines/main/isp_dsi_main.c @@ -16,7 +16,6 @@ #include "esp_cache.h" #include "driver/i2c_master.h" #include "driver/isp.h" -#include "driver/isp_bf.h" #include "isp_af_scheme_sa.h" #include "esp_cam_ctlr_csi.h" #include "esp_cam_ctlr.h" @@ -33,6 +32,9 @@ static const char *TAG = "isp_dsi"; static bool s_camera_get_new_vb(esp_cam_ctlr_handle_t handle, esp_cam_ctlr_trans_t *trans, void *user_data); static bool s_camera_get_finished_trans(esp_cam_ctlr_handle_t handle, esp_cam_ctlr_trans_t *trans, void *user_data); +/*--------------------------------------------------------------- + AF +---------------------------------------------------------------*/ typedef union { struct { uint16_t s : 4; @@ -47,7 +49,7 @@ typedef union { uint16_t val; } dw9714_reg_t; -static bool IRAM_ATTR s_env_change_cb(isp_af_ctlr_t af_ctrlr, const esp_isp_af_env_detector_evt_data_t *edata, void *user_data) +static bool IRAM_ATTR s_af_env_change_cb(isp_af_ctlr_t af_ctrlr, const esp_isp_af_env_detector_evt_data_t *edata, void *user_data) { BaseType_t mustYield = pdFALSE; TaskHandle_t task_handle = (TaskHandle_t)user_data; @@ -141,7 +143,7 @@ static void af_task(void *arg) ESP_ERROR_CHECK(esp_isp_af_controller_set_env_detector(af_ctrlr, &env_config)); esp_isp_af_env_detector_evt_cbs_t cbs = { - .on_env_change = s_env_change_cb, + .on_env_change = s_af_env_change_cb, }; ESP_ERROR_CHECK(esp_isp_af_env_detector_register_event_callbacks(af_ctrlr, &cbs, task_handle)); @@ -293,6 +295,29 @@ void app_main(void) ESP_ERROR_CHECK(esp_isp_bf_configure(isp_proc, &bf_config)); ESP_ERROR_CHECK(esp_isp_bf_enable(isp_proc)); + esp_isp_sharpen_config_t sharpen_config = { + .h_freq_coeff = { + .integer = 2, + .decimal = 0, + }, + .m_freq_coeff = { + .integer = 2, + .decimal = 0, + }, + .h_thresh = 255, + .l_thresh = 0, + .padding_mode = ISP_SHARPEN_EDGE_PADDING_MODE_SRND_DATA, + .sharpen_template = { + {1, 2, 1}, + {2, 4, 2}, + {1, 2, 1}, + }, + .padding_line_tail_valid_start_pixel = 0, + .padding_line_tail_valid_end_pixel = 0, + }; + ESP_ERROR_CHECK(esp_isp_sharpen_configure(isp_proc, &sharpen_config)); + ESP_ERROR_CHECK(esp_isp_sharpen_enable(isp_proc)); + typedef struct af_task_param_t { isp_proc_handle_t isp_proc; esp_sccb_io_handle_t dw9714_io_handle; diff --git a/examples/peripherals/isp/auto_focus/sdkconfig.defaults b/examples/peripherals/isp/multi_pipelines/sdkconfig.defaults similarity index 100% rename from examples/peripherals/isp/auto_focus/sdkconfig.defaults rename to examples/peripherals/isp/multi_pipelines/sdkconfig.defaults