luckfox-pico-sdk/sysdrv/source/mcu/rt-thread/applications/battery-ipc/rkaiq_parse_iq.h
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

173 lines
5.1 KiB
C

#ifndef __RKAIQ_PARSE_IQ_H__
#define __RKAIQ_PARSE_IQ_H__
#include "RkAiqCalibDbTypesV2.h"
#include "rkisp32-config.h"
#include "fast_ae.h"
#include "rkaiq_calib.h"
#include "../drivers/isp3/drv_isp3.h"
/******************************************************************************
* TO DEFINE SELECTED CALIB PARAMS HERE
*****************************************************************************/
#define FIXVSTINV 10 // VST fix
#define FIXNLMCALC 10 // NLM calc fix
#define EXP2RECISION_FIX (1<<(FIXNLMCALC+5))
#define MAX(a,b) ((a) < (b) ? (b) : (a))
#define CLIP(a, min_v, max_v) (((a) < (min_v)) ? (min_v) : (((a) > (max_v)) ? (max_v) : (a)))
#define RK_BAYERNR_V23_MAX_ISO_NUM 13
typedef struct RK_Bayer2dnr_Params_V23_Select_s {
// v23 version register // edge filter params
bool enable;
bool hdrdgain_ctrl_en;
float filter_strength;
uint16_t lumapoint[16];
uint16_t sigma[16];
uint8_t gain_bypass;
float gain_scale;
uint8_t gain_lumapoint[16];
uint16_t gain_adj[16];
float edgesofts;
float ratio;
float weight;
uint8_t gauss_guide;
uint16_t pix_diff;
uint16_t diff_thld;
uint8_t trans_en;
uint8_t trans_mode;
uint16_t trans_offset;
uint16_t itrans_offset;
int trans_datmax;
float hdr_dgain_scale_s;
float hdr_dgain_scale_m;
} RK_Bayer2dnrV23_Params_Select_t;
typedef struct RK_Bayer2dnr_Params_V23_s
{
// bayernr version
bool enable;
bool hdrdgain_ctrl_en;
// v23 parse
float iso[RK_BAYERNR_V23_MAX_ISO_NUM];
RK_Bayer2dnrV23_Params_Select_t Bayer2dnrParamsISO[RK_BAYERNR_V23_MAX_ISO_NUM];
} RK_Bayer2dnr_Params_V23_t;
typedef struct RK_Bayertnr_Params_V23_Select_s
{
bool enable;
//calib
uint16_t lumapoint[16];
uint16_t sigma[16];
uint16_t lumapoint2[16];
uint16_t lo_sigma[16];
uint16_t hi_sigma[16];
//tuning
uint8_t thumbds_w;
uint8_t thumbds_h;
bool lo_enable;
bool hi_enable;
bool lo_med_en;
bool lo_gsbay_en;
bool lo_gslum_en;
bool hi_med_en;
bool hi_gslum_en;
bool trans_en;
bool wgt_use_mode;
bool wgt_mge_mode;
bool hi_guass;
bool kl_guass;
bool global_pk_en;
int global_pksq;
float lo_filter_strength;
float hi_filter_strength;
float soft_threshold_ratio;
float lo_clipwgt;
float hi_wgt_comp;
uint16_t hidif_th;
float lo_filter_rat0;
uint16_t lo_filter_thed0;
uint8_t hi_filter_abs_ctrl;
uint8_t hi_filter_filt_bay;
uint8_t hi_filter_filt_avg;
uint8_t hi_filter_filt_mode;
float hi_filter_rat0;
uint16_t hi_filter_thed0;
float hi_filter_rat1;
uint16_t hi_filter_thed1;
uint8_t guass_guide_coeff0;
uint8_t guass_guide_coeff1;
uint8_t guass_guide_coeff2;
uint8_t guass_guide_coeff3;
} RK_Bayertnr_Params_V23_Select_t;
typedef struct RK_Bayertnr_Params_V23_s
{
bool enable;
float iso[RK_BAYERNR_V23_MAX_ISO_NUM];
RK_Bayertnr_Params_V23_Select_t bayertnrParamISO[RK_BAYERNR_V23_MAX_ISO_NUM];
} RK_Bayertnr_Params_V23_t;
typedef struct AblcParams_V32_s {
bool enable;
float iso[ABLCV32_MAX_ISO_LEVEL];
int blc_r[ABLCV32_MAX_ISO_LEVEL];
int blc_gr[ABLCV32_MAX_ISO_LEVEL];
int blc_gb[ABLCV32_MAX_ISO_LEVEL];
int blc_b[ABLCV32_MAX_ISO_LEVEL];
} AblcParams_V32_t;
typedef struct AblcOBParams_V32_s {
bool enable;
float iso[ABLCV32_MAX_ISO_LEVEL];
int ob_offset[ABLCV32_MAX_ISO_LEVEL];
float ob_predgain[ABLCV32_MAX_ISO_LEVEL];
} AblcOBParams_V32_t;
typedef struct AblcSelect_V32_s {
bool enable;
int blc_r;
int blc_gr;
int blc_gb;
int blc_b;
} AblcSelect_V32_t;
typedef struct AblcOBSelect_V32_s {
bool enable;
int ob_offset;
float ob_predgain;
} AblcOBSelect_V32_t;
typedef struct RK_Blc_Params_V32_s
{
AblcParams_V32_t stBlc0Params;
AblcParams_V32_t stBlc1Params;
AblcOBParams_V32_t stBlcOBParams;
AblcSelect_V32_t stBlc0Select;
AblcSelect_V32_t stBlc1Select;
AblcOBSelect_V32_t stBlcOBSelect;
} RK_Blc_Params_V32_t;
typedef struct NR_BLC_Context_s {
bool bayernr_params_init_flag;
bool bayertnr_params_init_flag;
bool blc_params_init_flag;
RK_Bayer2dnr_Params_V23_t bayernr_params;
RK_Bayertnr_Params_V23_t bayertnr_params;
RK_Blc_Params_V32_t blc_params;
} NR_BLC_Context_t;
void set_isp_params_for_kernel(struct shared_data *gShare, CamCalibDbV2Context_t* g_main_calib, int is_ie_effect, uint8_t iq_bin_mode);
void parse_ae_params(CamCalibDbV2Context_t *parse_iq_param, struct fastae_init_info *parse_ae_init, uint8_t iq_bin_mode);
void set_baynr_params_for_rtt(struct isp_baynr_cfg* pbaynr);
void set_bay3d_params_for_rtt(struct isp_bay3d_cfg* pbay3d, uint32_t w, uint32_t h);
void get_tnr_sigma(CalibDbV2_BayerTnrV23_Calib_t* pCalibdb, int calib_idx, int iso, int meanluma, struct fastae_md_param* md_param);
#endif /*__RKAIQ_PARSE_IQ_H__*/