diff --git a/Kconfig b/Kconfig index 66253d0..1f0dcea 100755 --- a/Kconfig +++ b/Kconfig @@ -142,6 +142,12 @@ menu "Camera configuration" bool "Subsample Mode" endchoice + config CAMERA_TASK_STACK_SIZE + int "CAM task stack size" + default 2048 + help + Camera task stack size + choice CAMERA_TASK_PINNED_TO_CORE bool "Camera task pinned to core" default CAMERA_CORE0 @@ -163,8 +169,8 @@ menu "Camera configuration" default 32768 help Maximum value of DMA buffer - Larger values may fail to allocate due to insufficient contiguous memory blocks, and smaller value may cause DMA interrupt to be too frequent - + Larger values may fail to allocate due to insufficient contiguous memory blocks, and smaller value may cause DMA interrupt to be too frequent. + config CAMERA_CONVERTER_ENABLED bool "Enable camera RGB/YUV converter" depends on IDF_TARGET_ESP32S3 @@ -184,4 +190,16 @@ menu "Camera configuration" config LCD_CAM_CONV_BT709_ENABLED bool "BT709" endchoice + + config LCD_CAM_CONV_FULL_RANGE_ENABLED + bool "Camera converter full range mode" + depends on CAMERA_CONVERTER_ENABLED + default y + help + Supports format conversion under both full color range mode and limited color range mode. + If full color range mode is selected, the color range of RGB or YUV is 0~255. + If limited color range mode is selected, the color range of RGB is 16~240, and the color range of YUV is Y[16~240], UV[16~235]. + Full color range mode has a wider color range, so details in the image show more clearly. + Please confirm the color range mode of the current camera sensor, incorrect color range mode may cause color difference in the final converted image. + Full range mode is used by default. If this option is not selected, the format conversion function will be done using the limited range mode. endmenu diff --git a/driver/cam_hal.c b/driver/cam_hal.c index 80b36b8..eb0f7ab 100644 --- a/driver/cam_hal.c +++ b/driver/cam_hal.c @@ -32,6 +32,12 @@ #endif // ESP_IDF_VERSION_MAJOR #define ESP_CAMERA_ETS_PRINTF ets_printf +#if CONFIG_CAM_TASK_STACK_SIZE +#define CAM_TASK_STACK CONFIG_CAM_TASK_STACK_SIZE +#else +#define CAM_TASK_STACK (2*1024) +#endif + static const char *TAG = "cam_hal"; static cam_obj_t *cam_obj = NULL; @@ -392,11 +398,11 @@ esp_err_t cam_config(const camera_config_t *config, framesize_t frame_size, uint #if CONFIG_CAMERA_CORE0 - xTaskCreatePinnedToCore(cam_task, "cam_task", 2048, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 0); + xTaskCreatePinnedToCore(cam_task, "cam_task", CAM_TASK_STACK, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 0); #elif CONFIG_CAMERA_CORE1 - xTaskCreatePinnedToCore(cam_task, "cam_task", 2048, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 1); + xTaskCreatePinnedToCore(cam_task, "cam_task", CAM_TASK_STACK, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle, 1); #else - xTaskCreate(cam_task, "cam_task", 2048, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle); + xTaskCreate(cam_task, "cam_task", CAM_TASK_STACK, NULL, configMAX_PRIORITIES - 2, &cam_obj->task_handle); #endif ESP_LOGI(TAG, "cam config ok"); diff --git a/target/esp32s3/ll_cam.c b/target/esp32s3/ll_cam.c index d79e7fb..f64339f 100644 --- a/target/esp32s3/ll_cam.c +++ b/target/esp32s3/ll_cam.c @@ -218,8 +218,13 @@ static esp_err_t ll_cam_converter_config(cam_obj_t *cam, const camera_config_t * #else LCD_CAM.cam_rgb_yuv.cam_conv_protocol_mode = 0; #endif +#if CONFIG_LCD_CAM_CONV_FULL_RANGE_ENABLED + LCD_CAM.cam_rgb_yuv.cam_conv_data_out_mode = 1; + LCD_CAM.cam_rgb_yuv.cam_conv_data_in_mode = 1; +#else LCD_CAM.cam_rgb_yuv.cam_conv_data_out_mode = 0; LCD_CAM.cam_rgb_yuv.cam_conv_data_in_mode = 0; +#endif LCD_CAM.cam_rgb_yuv.cam_conv_mode_8bits_on = 1; LCD_CAM.cam_rgb_yuv.cam_conv_bypass = 1; cam->conv_mode = config->conv_mode;