Merge branch 'feat/isp_demosaic' into 'master'

isp: demosaic

Closes IDF-10519

See merge request espressif/esp-idf!33111
This commit is contained in:
Armando (Dou Yiwen)
2024-08-29 16:13:27 +08:00
16 changed files with 409 additions and 31 deletions
+27 -1
View File
@@ -33,11 +33,26 @@ typedef struct {
uint8_t padding_line_tail_valid_end_pixel; ///< BF edge padding line tail valid end pixel
} isp_hal_bf_cfg_t;
/**
* @brief Demosaic configurations
*/
typedef struct {
isp_demosaic_grad_ratio_t grad_ratio; /**< Demosaic gradient ratio,
- gradient_x * grad_ratio < gradient_y, use interpolation results in X direction
- gradient_y * grad_ratio < gradient_x, use interpolation results in Y direction
- else use the average results between X and Y
*/
isp_demosaic_edge_padding_mode_t padding_mode; ///< Sharpen edge padding mode
uint8_t padding_data; ///< Sharpen edge padding pixel data
uint8_t padding_line_tail_valid_start_pixel; ///< Sharpen edge padding line tail valid start pixel
uint8_t padding_line_tail_valid_end_pixel; ///< Sharpen edge padding line tail valid end pixel
} isp_hal_demosaic_cfg_t;
/**
* @brief Sharpen configurations
*/
typedef struct {
isp_sharpen_h_freq_coeff h_freq_coeff; ///< High freq pixel sharpeness coeff
isp_sharpen_h_freq_coeff_t h_freq_coeff; ///< High freq pixel sharpeness coeff
isp_sharpen_m_freq_coeff m_freq_coeff; ///< Medium freq pixel sharpeness coeff
uint8_t h_thresh; ///< High threshold, pixel value higher than this threshold will be multiplied by `h_freq_coeff`
uint8_t l_thresh; ///< Low threshold, pixel value higher than this threshold but lower than `h_thresh` will be multiplied by `m_freq_coeff`. Pixel value lower than this threshold will be set to 0
@@ -166,6 +181,17 @@ void isp_hal_bf_config(isp_hal_context_t *hal, isp_hal_bf_cfg_t *config);
*/
bool isp_hal_ccm_set_matrix(const isp_hal_context_t *hal, bool saturation, const float flt_matrix[ISP_CCM_DIMENSION][ISP_CCM_DIMENSION]);
/*---------------------------------------------------------------
Demosaic
---------------------------------------------------------------*/
/**
* @brief Configure ISP Demosaic
*
* @param[in] hal Context of the HAL layer
* @param[in] config Demosaic config, set NULL to de-config the ISP Demosaic
*/
void isp_hal_demosaic_config(isp_hal_context_t *hal, isp_hal_demosaic_cfg_t *config);
/*---------------------------------------------------------------
INTR
---------------------------------------------------------------*/
+34 -1
View File
@@ -161,6 +161,39 @@ typedef enum {
#define ISP_CCM_DIMENSION 0 ///< Not support CCM
#endif
/*---------------------------------------------------------------
Demosaic
---------------------------------------------------------------*/
#if SOC_ISP_DEMOSAIC_SUPPORTED
#define ISP_DEMOSAIC_GRAD_RATIO_INT_BITS SOC_ISP_DEMOSAIC_GRAD_RATIO_INT_BITS
#define ISP_DEMOSAIC_GRAD_RATIO_DEC_BITS SOC_ISP_DEMOSAIC_GRAD_RATIO_DEC_BITS
#define ISP_DEMOSAIC_GRAD_RATIO_RES_BITS SOC_ISP_DEMOSAIC_GRAD_RATIO_RES_BITS
#else
#define ISP_DEMOSAIC_GRAD_RATIO_INT_BITS 8
#define ISP_DEMOSAIC_GRAD_RATIO_DEC_BITS 8
#define ISP_DEMOSAIC_GRAD_RATIO_RES_BITS 16
#endif
/**
* @brief Gradient ratio
*/
typedef union {
struct {
uint32_t decimal:ISP_DEMOSAIC_GRAD_RATIO_DEC_BITS; ///< Integer part
uint32_t integer:ISP_DEMOSAIC_GRAD_RATIO_INT_BITS; ///< Decimal part
uint32_t reserved:ISP_DEMOSAIC_GRAD_RATIO_RES_BITS; ///< Reserved
};
uint32_t val; ///< 32-bit gradient ratio value
} isp_demosaic_grad_ratio_t;
/**
* @brief ISP Demosaic edge padding mode
*/
typedef enum {
ISP_DEMOSAIC_EDGE_PADDING_MODE_SRND_DATA, ///< Fill Demosaic edge padding data with surrounding pixel data
ISP_DEMOSAIC_EDGE_PADDING_MODE_CUSTOM_DATA, ///< Fill Demosaic edge padding data with custom pixel data
} isp_demosaic_edge_padding_mode_t;
/*---------------------------------------------------------------
DVP
---------------------------------------------------------------*/
@@ -203,7 +236,7 @@ typedef union {
uint32_t reserved:ISP_SHARPEN_H_FREQ_COEF_RES_BITS; ///< Reserved
};
uint32_t val; ///< 32-bit high freq pixel sharpeness coeff register value
} isp_sharpen_h_freq_coeff;
} isp_sharpen_h_freq_coeff_t;
/**
* @brief Medium freq pixel sharpeness coeff