Merge branch 'doc/isp_lsc_doc' into 'master'

isp: isp lsc programming guide

See merge request espressif/esp-idf!34818
This commit is contained in:
Armando (Dou Yiwen)
2024-11-18 10:17:38 +08:00
4 changed files with 45 additions and 12 deletions

View File

@@ -34,7 +34,7 @@ typedef struct {
/** /**
* @brief Helper function to allocate gain array for LSC * @brief Helper function to allocate gain array for LSC
* *
* @param[in] proc Processor handle * @param[in] isp_proc Processor handle
* @param[in] gain_array Gain array to be allocated * @param[in] gain_array Gain array to be allocated
* @param[out] out_array_size_per_channel Array size * @param[out] out_array_size_per_channel Array size
* *
@@ -51,7 +51,7 @@ esp_err_t esp_isp_lsc_allocate_gain_array(isp_proc_handle_t isp_proc, esp_isp_ls
* *
* @note After calling this API, LSC doesn't take into effect until `esp_isp_lsc_enable` is called * @note After calling this API, LSC doesn't take into effect until `esp_isp_lsc_enable` is called
* *
* @param[in] proc Processor handle * @param[in] isp_proc Processor handle
* @param[in] config LSC configurations * @param[in] config LSC configurations
* *
* @return * @return
@@ -65,7 +65,7 @@ esp_err_t esp_isp_lsc_configure(isp_proc_handle_t isp_proc, const esp_isp_lsc_co
/** /**
* @brief Enable ISP LSC function * @brief Enable ISP LSC function
* *
* @param[in] proc Processor handle * @param[in] isp_proc Processor handle
* *
* @return * @return
* - ESP_OK On success * - ESP_OK On success
@@ -77,7 +77,7 @@ esp_err_t esp_isp_lsc_enable(isp_proc_handle_t isp_proc);
/** /**
* @brief Disable ISP LSC function * @brief Disable ISP LSC function
* *
* @param[in] proc Processor handle * @param[in] isp_proc Processor handle
* *
* @return * @return
* - ESP_OK On success * - ESP_OK On success

View File

@@ -1003,11 +1003,7 @@ void sdmmc_host_enable_clk_cmd11(int slot, bool enable)
{ {
sdmmc_ll_enable_card_clock(s_host_ctx.hal.dev, slot, enable); sdmmc_ll_enable_card_clock(s_host_ctx.hal.dev, slot, enable);
sdmmc_host_clock_update_command(slot, true); sdmmc_host_clock_update_command(slot, true);
if (enable) { sdmmc_ll_enable_1v8_mode(s_host_ctx.hal.dev, slot, enable);
sdmmc_ll_enable_1v8_mode(s_host_ctx.hal.dev, slot, true);
} else {
sdmmc_ll_enable_1v8_mode(s_host_ctx.hal.dev, slot, false);
}
} }
void sdmmc_host_dma_stop(void) void sdmmc_host_dma_stop(void)

View File

@@ -34,6 +34,7 @@ INPUT += \
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_awb.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_ccm.h \
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_bf.h \ $(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_bf.h \
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_lsc.h \
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_demosaic.h \ $(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_demosaic.h \
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_sharpen.h \ $(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_sharpen.h \
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_core.h \ $(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_core.h \

View File

@@ -45,9 +45,9 @@ ISP Pipeline
isp_chs [label = "Contrast &\n Hue & Saturation", width = 150, height = 70]; isp_chs [label = "Contrast &\n Hue & Saturation", width = 150, height = 70];
isp_yuv [label = "YUV Limit\n YUB2RGB", width = 120, height = 70]; isp_yuv [label = "YUV Limit\n YUB2RGB", width = 120, height = 70];
isp_header -> BF -> Demosaic -> CCM -> Gamma -> RGB2YUV -> SHARP -> isp_chs -> isp_yuv -> isp_tail; isp_header -> BF -> LSC -> Demosaic -> CCM -> Gamma -> RGB2YUV -> SHARP -> isp_chs -> isp_yuv -> isp_tail;
BF -> HIST LSC -> HIST
Demosaic -> AWB Demosaic -> AWB
Demosaic -> AE Demosaic -> AE
Demosaic -> HIST Demosaic -> HIST
@@ -69,6 +69,7 @@ The ISP driver offers following services:
- :ref:`isp-ae-statistics` - covers how to get AE statistics one-shot or continuously. - :ref:`isp-ae-statistics` - covers how to get AE statistics one-shot or continuously.
- :ref:`isp-hist-statistics` - covers how to get histogram statistics one-shot or continuously. - :ref:`isp-hist-statistics` - covers how to get histogram statistics one-shot or continuously.
- :ref:`isp-bf` - covers how to enable and configure BF function. - :ref:`isp-bf` - covers how to enable and configure BF function.
- :ref:`isp-lsc` - covers how to enable and configure LSC function.
- :ref:`isp-ccm-config` - covers how to configure the CCM. - :ref:`isp-ccm-config` - covers how to configure the CCM.
- :ref:`isp-demosaic` - covers how to configure the Demosaic function. - :ref:`isp-demosaic` - covers how to configure the Demosaic function.
- :ref:`isp-gamma-correction` - covers how to enable and configure gamma correction. - :ref:`isp-gamma-correction` - covers how to enable and configure gamma correction.
@@ -509,6 +510,40 @@ After calling :cpp:func:`esp_isp_bf_configure`, you need to enable the ISP BF co
Calling :cpp:func:`esp_isp_bf_disable` does the opposite, that is, put the driver back to the **init** state. Calling :cpp:func:`esp_isp_bf_disable` does the opposite, that is, put the driver back to the **init** state.
.. _isp-lsc:
ISP LSC Controller
~~~~~~~~~~~~~~~~~~
Lens Shading Correction (LSC) aims for the issues caused by the uneven refraction of light through the camera lens.
Calling :cpp:func:`esp_isp_lsc_configure` to configure the LSC module to do the correction. The :cpp:type:`esp_isp_lsc_gain_array_t` is necessary for the hardware to do the correction related calculation. :cpp:func:`esp_isp_lsc_allocate_gain_array` is a helper function to help allocate proper size of memory for the gains.
.. code-block:: c
esp_isp_lsc_gain_array_t gain_array = {};
size_t gain_size = 0;
ESP_ERROR_CHECK(esp_isp_lsc_allocate_gain_array(isp_proc, &gain_array, &gain_size));
esp_isp_lsc_config_t lsc_config = {
.gain_array = &gain_array,
};
isp_lsc_gain_t gain_val = {
.decimal = 204,
.integer = 0,
};
for (int i = 0; i < gain_size; i++) {
gain_array.gain_r[i].val = gain_val.val;
gain_array.gain_gr[i].val = gain_val.val;
gain_array.gain_gb[i].val = gain_val.val;
gain_array.gain_b[i].val = gain_val.val;
}
ESP_ERROR_CHECK(esp_isp_lsc_configure(isp_proc, &lsc_config));
After calling :cpp:func:`esp_isp_lsc_configure`, you need to enable the ISP LSC controller, by calling :cpp:func:`esp_isp_lsc_enable`. The LSC can be disabled by calling :cpp:func:`esp_isp_lsc_disable`. It's allowed to call :cpp:func:`esp_isp_lsc_configure` when the LSC isn't enabled, but the LSC function will only take effect when it's enabled.
.. _isp-color: .. _isp-color:
ISP Color Controller ISP Color Controller
@@ -815,6 +850,7 @@ API Reference
.. include-build-file:: inc/isp_ae.inc .. include-build-file:: inc/isp_ae.inc
.. include-build-file:: inc/isp_awb.inc .. include-build-file:: inc/isp_awb.inc
.. include-build-file:: inc/isp_bf.inc .. include-build-file:: inc/isp_bf.inc
.. include-build-file:: inc/isp_lsc.inc
.. include-build-file:: inc/isp_ccm.inc .. include-build-file:: inc/isp_ccm.inc
.. include-build-file:: inc/isp_demosaic.inc .. include-build-file:: inc/isp_demosaic.inc
.. include-build-file:: inc/isp_sharpen.inc .. include-build-file:: inc/isp_sharpen.inc