diff --git a/components/esp_driver_cam/csi/include/esp_cam_ctlr_csi.h b/components/esp_driver_cam/csi/include/esp_cam_ctlr_csi.h index 18eed2e00cc..a4dd41beac0 100644 --- a/components/esp_driver_cam/csi/include/esp_cam_ctlr_csi.h +++ b/components/esp_driver_cam/csi/include/esp_cam_ctlr_csi.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -29,9 +29,11 @@ typedef struct { cam_ctlr_color_t output_data_color_type; ///< Output color type int queue_items; ///< Queue items struct { - uint32_t byte_swap_en : 1; ///< Enable byte swap - uint32_t bk_buffer_dis : 1; ///< Disable backup buffer - }; ///< Boolean Flags + uint32_t input_8bit_swap_en : 1; /*!< Set to 1 to enable input 8bit bit swap. [31:24] [23:16] [15:8] [7:0] -> [7:0] [15:8] [23:16] [31:24]*/ + uint32_t input_16bit_swap_en : 1; /*!< Set to 1 to enable input 16bit bit swap. [31:16] [15:0] -> [15:0] [31:16] */ + uint32_t byte_swap_en : 1; /*!< Set to 1 to enable output byte swap. */ + uint32_t bk_buffer_dis : 1; /*!< Set to 1 to disable backup buffer. */ + }; /*!< Boolean flags. */ } esp_cam_ctlr_csi_config_t; /** diff --git a/components/esp_driver_cam/csi/src/esp_cam_ctlr_csi.c b/components/esp_driver_cam/csi/src/esp_cam_ctlr_csi.c index cb605c6d179..dc0b394568a 100644 --- a/components/esp_driver_cam/csi/src/esp_cam_ctlr_csi.c +++ b/components/esp_driver_cam/csi/src/esp_cam_ctlr_csi.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -21,6 +21,8 @@ #include "hal/mipi_csi_ll.h" #include "soc/mipi_csi_periph.h" #include "hal/color_hal.h" +#include "hal/efuse_hal.h" +#include "soc/chip_revision.h" #include "esp_private/periph_ctrl.h" #include "esp_private/mipi_csi_share_hw_ctrl.h" #include "esp_private/esp_cache_private.h" @@ -59,6 +61,7 @@ static esp_err_t s_csi_ctlr_disable(esp_cam_ctlr_handle_t ctlr); static esp_err_t s_ctlr_csi_receive(esp_cam_ctlr_handle_t handle, esp_cam_ctlr_trans_t *trans, uint32_t timeout_ms); static void *s_csi_ctlr_alloc_buffer(esp_cam_ctlr_t *handle, size_t size, uint32_t buf_caps); static esp_err_t s_csi_ctlr_format_conversion(esp_cam_ctlr_t *handle, const cam_ctlr_format_conv_config_t *config); +static bool s_is_color_format_conversion_supported(cam_ctlr_color_t color_format); static esp_err_t s_csi_claim_controller(csi_controller_t *controller) { @@ -107,6 +110,15 @@ esp_err_t esp_cam_new_csi_ctlr(const esp_cam_ctlr_csi_config_t *config, esp_cam_ ESP_RETURN_ON_FALSE(config && ret_handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer"); ESP_RETURN_ON_FALSE(config->data_lane_num <= MIPI_CSI_HOST_LL_LANE_NUM_MAX, ESP_ERR_INVALID_ARG, TAG, "lane num should be equal or smaller than %d", MIPI_CSI_HOST_LL_LANE_NUM_MAX); + bool is_less_v1 = false; //version 1 since P4 rev3 +#if CONFIG_IDF_TARGET_ESP32P4 + unsigned chip_version = efuse_hal_chip_revision(); + if (!ESP_CHIP_REV_ABOVE(chip_version, 300)) { + is_less_v1 = true; + } +#endif + ESP_RETURN_ON_FALSE(!(is_less_v1 && (config->input_8bit_swap_en || config->input_16bit_swap_en)), ESP_ERR_NOT_SUPPORTED, TAG, "input 8bit or 16bit swap is not supported on this chip"); + csi_controller_t *ctlr = heap_caps_calloc(1, sizeof(csi_controller_t), CSI_MEM_ALLOC_CAPS); ESP_RETURN_ON_FALSE(ctlr, ESP_ERR_NO_MEM, TAG, "no mem for csi controller context"); @@ -188,6 +200,19 @@ esp_err_t esp_cam_new_csi_ctlr(const esp_cam_ctlr_csi_config_t *config, esp_cam_ mipi_csi_hal_init(&ctlr->hal, &hal_config); mipi_csi_brg_ll_set_burst_len(ctlr->hal.bridge_dev, 512); + cam_ctlr_format_conv_config_t format_conv_config = { + .src_format = config->input_data_color_type, + .dst_format = config->output_data_color_type, + }; + ESP_GOTO_ON_ERROR(s_csi_ctlr_format_conversion(&(ctlr->base), &format_conv_config), err, TAG, "failed to configure format conversion"); + + if (config->input_8bit_swap_en) { + mipi_csi_brg_ll_set_8bit_swap(ctlr->hal.bridge_dev, true); + } + if (config->input_16bit_swap_en) { + mipi_csi_brg_ll_set_16bit_swap(ctlr->hal.bridge_dev, true); + } + //---------------DWGDMA Init For CSI------------------// dw_gdma_channel_handle_t csi_dma_chan = NULL; dw_gdma_channel_alloc_config_t csi_dma_alloc_config = { @@ -641,9 +666,45 @@ static void *s_csi_ctlr_alloc_buffer(esp_cam_ctlr_t *handle, size_t size, uint32 return buffer; } +static bool s_is_color_format_conversion_supported(cam_ctlr_color_t color_format) +{ + return (color_format == CAM_CTLR_COLOR_RGB888 || + color_format == CAM_CTLR_COLOR_RGB565 || + color_format == CAM_CTLR_COLOR_YUV420 || + color_format == CAM_CTLR_COLOR_YUV422_YVYU || + color_format == CAM_CTLR_COLOR_YUV422_YUYV || + color_format == CAM_CTLR_COLOR_YUV422_UYVY || + color_format == CAM_CTLR_COLOR_YUV422_VYUY); +} + static esp_err_t s_csi_ctlr_format_conversion(esp_cam_ctlr_t *handle, const cam_ctlr_format_conv_config_t *config) { - ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer"); - // CSI controller doesn't support format conversion yet - return ESP_ERR_NOT_SUPPORTED; + ESP_RETURN_ON_FALSE(handle && config, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer"); + csi_controller_t *ctlr = __containerof(handle, csi_controller_t, base); + + mipi_csi_brg_ll_enable_color_conversion(ctlr->hal.bridge_dev, true); + + if (config->src_format == config->dst_format) { + mipi_csi_brg_ll_set_color_mode_bypass(ctlr->hal.bridge_dev, true); + return ESP_OK; + } else { +#if CONFIG_IDF_TARGET_ESP32P4 + //If ESP32P4 chip version is less than v3.0, not support color format conversion + unsigned chip_version = efuse_hal_chip_revision(); + if (!ESP_CHIP_REV_ABOVE(chip_version, 300)) { + return ESP_ERR_NOT_SUPPORTED; + } +#endif + + if (!s_is_color_format_conversion_supported(config->src_format) || !s_is_color_format_conversion_supported(config->dst_format)) { + return ESP_ERR_NOT_SUPPORTED; + } else { + mipi_csi_brg_ll_set_input_color_format(ctlr->hal.bridge_dev, config->src_format); + mipi_csi_brg_ll_set_output_color_format(ctlr->hal.bridge_dev, config->dst_format); + mipi_csi_brg_ll_set_color_mode_bypass(ctlr->hal.bridge_dev, false); + } + ctlr->in_color_format.color_type_id = config->src_format; + ctlr->out_color_format.color_type_id = config->dst_format; + return ESP_OK; + } } diff --git a/components/esp_driver_cam/test_apps/csi/main/test_csi_driver.c b/components/esp_driver_cam/test_apps/csi/main/test_csi_driver.c index 28a995d1b1f..b671037ce7d 100644 --- a/components/esp_driver_cam/test_apps/csi/main/test_csi_driver.c +++ b/components/esp_driver_cam/test_apps/csi/main/test_csi_driver.c @@ -16,7 +16,7 @@ TEST_CASE("TEST CSI driver allocation", "[csi]") .h_res = 800, .v_res = 640, .lane_bit_rate_mbps = 200, - .input_data_color_type = CAM_CTLR_COLOR_RAW8, + .input_data_color_type = CAM_CTLR_COLOR_RGB565, .output_data_color_type = CAM_CTLR_COLOR_RGB565, .data_lane_num = 2, .byte_swap_en = false, @@ -42,7 +42,7 @@ TEST_CASE("TEST CSI driver no backup buffer usage", "[csi]") .h_res = 800, .v_res = 640, .lane_bit_rate_mbps = 200, - .input_data_color_type = CAM_CTLR_COLOR_RAW8, + .input_data_color_type = CAM_CTLR_COLOR_RGB565, .output_data_color_type = CAM_CTLR_COLOR_RGB565, .data_lane_num = 2, .byte_swap_en = false, diff --git a/components/esp_driver_cam/test_apps/csi/main/test_csi_ov5647.c b/components/esp_driver_cam/test_apps/csi/main/test_csi_ov5647.c index 69b8d16ee8f..dc37b155a42 100644 --- a/components/esp_driver_cam/test_apps/csi/main/test_csi_ov5647.c +++ b/components/esp_driver_cam/test_apps/csi/main/test_csi_ov5647.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -111,7 +111,7 @@ TEST_CASE("TEST esp_cam on ov5647", "[csi][camera][ov5647]") .v_res = TEST_MIPI_CSI_DISP_VRES, .lane_bit_rate_mbps = TEST_MIPI_CSI_LANE_BITRATE_MBPS, .input_data_color_type = CAM_CTLR_COLOR_RAW8, - .output_data_color_type = CAM_CTLR_COLOR_RGB565, + .output_data_color_type = CAM_CTLR_COLOR_RAW8, .data_lane_num = 2, .byte_swap_en = false, .queue_items = 1, diff --git a/components/hal/esp32p4/include/hal/mipi_csi_brg_ll.h b/components/hal/esp32p4/include/hal/mipi_csi_brg_ll.h index 5ce3feec202..58f26833996 100644 --- a/components/hal/esp32p4/include/hal/mipi_csi_brg_ll.h +++ b/components/hal/esp32p4/include/hal/mipi_csi_brg_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ #include "hal/misc.h" #include "hal/assert.h" #include "hal/hal_utils.h" +#include "hal/config.h" #include "hal/mipi_csi_types.h" #include "soc/mipi_csi_bridge_struct.h" @@ -135,16 +136,199 @@ static inline void mipi_csi_brg_ll_set_dma_req_interval(csi_brg_dev_t *dev, uint } /** - * @brief Set the data endianness order in bytes + * @brief Set the output data endianness order in bytes * * @param dev Pointer to the CSI bridge controller register base address * @param byte_swap_en byte swap enable or not */ -static inline void mipi_csi_brg_ll_set_byte_endian(csi_brg_dev_t *dev, bool byte_swap_en) +static inline void mipi_csi_brg_ll_set_output_byte_endian(csi_brg_dev_t *dev, bool byte_swap_en) { dev->endian_mode.byte_endian_order = byte_swap_en; } +#if HAL_CONFIG(CHIP_SUPPORT_MIN_REV) >= 300 + +/** + * @brief Set RGB element order for input color data + * + * @param dev Pointer to the CSI bridge controller register base address + * @param rgb_format RGB element order: 0=RGB, 1=BGR, 2=RBG, 3=BRG, 4=GRB, 5=GBR + * + */ +static inline void mipi_csi_brg_ll_set_input_rgb_format(csi_brg_dev_t *dev, uint32_t rgb_format) +{ + dev->host_cm_ctrl.csi_host_cm_rx_rgb_format = rgb_format; +} + +/** + * @brief Set the color format for the input color data + * + * @param dev Pointer to the CSI bridge controller register base address + * @param color_format Camera controller color format + */ +static inline void mipi_csi_brg_ll_set_input_color_format(csi_brg_dev_t *dev, cam_ctlr_color_t color_format) +{ + // Set format type + if (color_format == CAM_CTLR_COLOR_RGB888) { + dev->host_cm_ctrl.csi_host_cm_rx = 0; + mipi_csi_brg_ll_set_input_rgb_format(dev, 0); // Default: RGB order + } else if (color_format == CAM_CTLR_COLOR_RGB565) { + dev->host_cm_ctrl.csi_host_cm_rx = 1; + mipi_csi_brg_ll_set_input_rgb_format(dev, 0); // Default: RGB order + } else if (color_format == CAM_CTLR_COLOR_YUV420) { + dev->host_cm_ctrl.csi_host_cm_rx = 3; + } else if (color_format == CAM_CTLR_COLOR_YUV422_YVYU || + color_format == CAM_CTLR_COLOR_YUV422_YUYV || + color_format == CAM_CTLR_COLOR_YUV422_UYVY || + color_format == CAM_CTLR_COLOR_YUV422_VYUY) { + dev->host_cm_ctrl.csi_host_cm_rx = 2; + // Set YUV422 packing order: YVYU=0, YUYV=1, VYUY=2, UYVY=3 + if (color_format == CAM_CTLR_COLOR_YUV422_YVYU) { + dev->host_cm_ctrl.csi_host_cm_rx_yuv422_format = 0; + } else if (color_format == CAM_CTLR_COLOR_YUV422_YUYV) { + dev->host_cm_ctrl.csi_host_cm_rx_yuv422_format = 1; + } else if (color_format == CAM_CTLR_COLOR_YUV422_VYUY) { + dev->host_cm_ctrl.csi_host_cm_rx_yuv422_format = 2; + } else if (color_format == CAM_CTLR_COLOR_YUV422_UYVY) { + dev->host_cm_ctrl.csi_host_cm_rx_yuv422_format = 3; + } + } else { + HAL_ASSERT(false && "Unsupported input color format"); + } +} + +/** + * @brief Enable or disable color mode conversion output + * + * @param dev Pointer to the CSI bridge controller register base address + * @param en true to enable, false to disable + * + */ +static inline void mipi_csi_brg_ll_enable_color_conversion(csi_brg_dev_t *dev, bool en) +{ + dev->host_cm_ctrl.csi_host_cm_en = en; +} + +/** + * @brief Enable or disable color mode conversion bypass + * + * @param dev Pointer to the CSI bridge controller regihost_cm_ctrlster base address + * @param bypass true to bypass (input directly to output), false to enable conversion + * + */ +static inline void mipi_csi_brg_ll_set_color_mode_bypass(csi_brg_dev_t *dev, bool bypass) +{ + dev->host_cm_ctrl.csi_host_cm_bypass = bypass; +} + +/** + * @brief Set the color format for the output color data + * + * @param dev Pointer to the CSI bridge controller register base address + * @param color_format Camera controller color format + */ +static inline void mipi_csi_brg_ll_set_output_color_format(csi_brg_dev_t *dev, cam_ctlr_color_t color_format) +{ + if (color_format == CAM_CTLR_COLOR_RGB888) { + dev->host_cm_ctrl.csi_host_cm_tx = 0; + } else if (color_format == CAM_CTLR_COLOR_RGB565) { + dev->host_cm_ctrl.csi_host_cm_tx = 1; + } else if (color_format == CAM_CTLR_COLOR_YUV420) { + dev->host_cm_ctrl.csi_host_cm_tx = 3; + } else if (color_format == CAM_CTLR_COLOR_YUV422_YVYU || + color_format == CAM_CTLR_COLOR_YUV422_YUYV || + color_format == CAM_CTLR_COLOR_YUV422_UYVY || + color_format == CAM_CTLR_COLOR_YUV422_VYUY) { + dev->host_cm_ctrl.csi_host_cm_tx = 2; + } else { + HAL_ASSERT(false && "Unsupported output color format"); + } +} + +/* + * @brief Set the 16-bit swap + * + * @note + * [31:16] [15:0] + * -> + * [15:0] [31:16] + * + * @param dev Pointer to the CSI bridge controller register base address + * @param swap true to swap, false to not swap + */ +static inline void mipi_csi_brg_ll_set_16bit_swap(csi_brg_dev_t *dev, bool swap) +{ + dev->host_cm_ctrl.csi_host_cm_16bit_swap = swap; +} + +/** + * @brief Set the 8-bit swap + * + * @note + * [31:24] [23:16] [15:8] [7:0] + * -> + * [7:0] [15:8] [23:16] [31:24] + * + * @param dev Pointer to the CSI bridge controller register base address + * @param swap true to swap, false to not swap + */ +static inline void mipi_csi_brg_ll_set_8bit_swap(csi_brg_dev_t *dev, bool swap) +{ + dev->host_cm_ctrl.csi_host_cm_8bit_swap = swap; +} + +#else +static inline void mipi_csi_brg_ll_set_input_rgb_format(csi_brg_dev_t *dev, uint32_t rgb_format) +{ + //for compatibility + (void)dev; + (void)rgb_format; +} + +static inline void mipi_csi_brg_ll_set_input_color_format(csi_brg_dev_t *dev, cam_ctlr_color_t color_format) +{ + //for compatibility + (void)dev; + (void)color_format; +} + +static inline void mipi_csi_brg_ll_enable_color_conversion(csi_brg_dev_t *dev, bool en) +{ + //for compatibility + (void)dev; + (void)en; +} + +static inline void mipi_csi_brg_ll_set_color_mode_bypass(csi_brg_dev_t *dev, bool bypass) +{ + //for compatibility + (void)dev; + (void)bypass; +} + +static inline void mipi_csi_brg_ll_set_output_color_format(csi_brg_dev_t *dev, cam_ctlr_color_t color_format) +{ + //for compatibility + (void)dev; + (void)color_format; +} + +static inline void mipi_csi_brg_ll_set_16bit_swap(csi_brg_dev_t *dev, bool swap) +{ + //for compatibility + (void)dev; + (void)swap; +} + +static inline void mipi_csi_brg_ll_set_8bit_swap(csi_brg_dev_t *dev, bool swap) +{ + //for compatibility + (void)dev; + (void)swap; +} + +#endif // HAL_CONFIG(CHIP_SUPPORT_MIN_REV) >= 300 + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32p4/include/hal/mipi_csi_ll.h b/components/hal/esp32p4/include/hal/mipi_csi_ll.h index 57cc8c2e0f8..6dcaa2cc82d 100644 --- a/components/hal/esp32p4/include/hal/mipi_csi_ll.h +++ b/components/hal/esp32p4/include/hal/mipi_csi_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/hal/include/hal/cam_ctlr_types.h b/components/hal/include/hal/cam_ctlr_types.h index 7b0001e9792..83bb564b30c 100644 --- a/components/hal/include/hal/cam_ctlr_types.h +++ b/components/hal/include/hal/cam_ctlr_types.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -25,6 +25,10 @@ typedef enum { CAM_CTLR_COLOR_RGB888 = COLOR_TYPE_ID(COLOR_SPACE_RGB, COLOR_PIXEL_RGB888), ///< RGB888 CAM_CTLR_COLOR_YUV420 = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV420), ///< YUV420 CAM_CTLR_COLOR_YUV422 = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV422), ///< YUV422 + CAM_CTLR_COLOR_YUV422_YVYU = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YVYU422), ///< YUV422 YVYU + CAM_CTLR_COLOR_YUV422_YUYV = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUYV422), ///< YUV422 YUYV + CAM_CTLR_COLOR_YUV422_UYVY = CAM_CTLR_COLOR_YUV422, ///< YUV422 UYVY + CAM_CTLR_COLOR_YUV422_VYUY = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_VYUY422), ///< YUV422 VYUY CAM_CTLR_COLOR_GRAY4 = COLOR_TYPE_ID(COLOR_SPACE_GRAY, COLOR_PIXEL_GRAY4), ///< GRAY4 CAM_CTLR_COLOR_GRAY8 = COLOR_TYPE_ID(COLOR_SPACE_GRAY, COLOR_PIXEL_GRAY8), ///< GRAY8 } cam_ctlr_color_t; diff --git a/components/hal/mipi_csi_hal.c b/components/hal/mipi_csi_hal.c index 80f3e1e6361..cbdde514e0d 100644 --- a/components/hal/mipi_csi_hal.c +++ b/components/hal/mipi_csi_hal.c @@ -71,5 +71,5 @@ void mipi_csi_hal_init(mipi_csi_hal_context_t *hal, const mipi_csi_hal_config_t mipi_csi_brg_ll_set_flow_ctl_buf_afull_thrd(hal->bridge_dev, 960); mipi_csi_brg_ll_set_data_type_min(hal->bridge_dev, 0x12); mipi_csi_brg_ll_set_data_type_max(hal->bridge_dev, 0x2f); - mipi_csi_brg_ll_set_byte_endian(hal->bridge_dev, config->byte_swap_en); + mipi_csi_brg_ll_set_output_byte_endian(hal->bridge_dev, config->byte_swap_en); } diff --git a/docs/en/api-reference/peripherals/camera_driver.rst b/docs/en/api-reference/peripherals/camera_driver.rst index 3c2eb9db71e..e1bce5c45f2 100644 --- a/docs/en/api-reference/peripherals/camera_driver.rst +++ b/docs/en/api-reference/peripherals/camera_driver.rst @@ -159,7 +159,7 @@ Camera controller driver can be implemented in one of following ways: ESP_ERROR_CHECK(esp_cam_new_dvp_ctlr(&dvp_config, &cam_handle)); const cam_ctlr_format_conv_config_t conv_cfg = { - .src_format = CAM_CTLR_COLOR_YUV422, // Source format: YUV422 + .src_format = CAM_CTLR_COLOR_YUV422_UYVY, // Source format: YUV422 UYVY .dst_format = CAM_CTLR_COLOR_RGB565, // Destination format: RGB565 .conv_std = COLOR_CONV_STD_RGB_YUV_BT601, .data_width = 8, diff --git a/docs/zh_CN/api-reference/peripherals/camera_driver.rst b/docs/zh_CN/api-reference/peripherals/camera_driver.rst index 6b7fe1fbc49..c6f37f48ce6 100644 --- a/docs/zh_CN/api-reference/peripherals/camera_driver.rst +++ b/docs/zh_CN/api-reference/peripherals/camera_driver.rst @@ -159,8 +159,8 @@ ESP_ERROR_CHECK(esp_cam_new_dvp_ctlr(&dvp_config, &cam_handle)); const cam_ctlr_format_conv_config_t conv_cfg = { - .src_format = CAM_CTLR_COLOR_YUV422, // 源格式:YUV422 - .dst_format = CAM_CTLR_COLOR_RGB565, // 目标格式:RGB565 + .src_format = CAM_CTLR_COLOR_YUV422_UYVY, // 源格式:YUV422 UYVY + .dst_format = CAM_CTLR_COLOR_RGB565, // 目标格式:RGB565 .conv_std = COLOR_CONV_STD_RGB_YUV_BT601, .data_width = 8, .input_range = COLOR_RANGE_LIMIT, diff --git a/examples/peripherals/camera/dvp_spi_lcd/main/dvp_spi_lcd_main.c b/examples/peripherals/camera/dvp_spi_lcd/main/dvp_spi_lcd_main.c index d9032a57c5c..d75cc885c3c 100644 --- a/examples/peripherals/camera/dvp_spi_lcd/main/dvp_spi_lcd_main.c +++ b/examples/peripherals/camera/dvp_spi_lcd/main/dvp_spi_lcd_main.c @@ -147,7 +147,7 @@ void app_main(void) .h_res = CONFIG_EXAMPLE_CAM_HRES, .v_res = CONFIG_EXAMPLE_CAM_VRES, #if CONFIG_EXAMPLE_CAM_INPUT_FORMAT_YUV422 - .input_data_color_type = CAM_CTLR_COLOR_YUV422, + .input_data_color_type = CAM_CTLR_COLOR_YUV422_UYVY, #else .input_data_color_type = CAM_CTLR_COLOR_RGB565, #endif @@ -208,7 +208,7 @@ void app_main(void) ESP_LOGI(TAG, "Configure format conversion: YUV422 -> RGB565"); // Configure format conversion const cam_ctlr_format_conv_config_t conv_cfg = { - .src_format = CAM_CTLR_COLOR_YUV422, // Source format: YUV422 + .src_format = CAM_CTLR_COLOR_YUV422_UYVY, // Source format: YUV422 UYVY .dst_format = CAM_CTLR_COLOR_RGB565, // Destination format: RGB565 .conv_std = COLOR_CONV_STD_RGB_YUV_BT601, .data_width = 8, diff --git a/examples/peripherals/camera/mipi_isp_dsi/sdkconfig.defaults.esp32p4 b/examples/peripherals/camera/mipi_isp_dsi/sdkconfig.defaults.esp32p4 index 2c02a3b7ee1..9956837cc20 100644 --- a/examples/peripherals/camera/mipi_isp_dsi/sdkconfig.defaults.esp32p4 +++ b/examples/peripherals/camera/mipi_isp_dsi/sdkconfig.defaults.esp32p4 @@ -1,3 +1,2 @@ -CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_SPIRAM=y -CONFIG_SPIRAM_SPEED_200M=y +CONFIG_SPIRAM_SPEED_250M=y