mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-19 08:53:54 +08:00
camerad: add os04+4.6mm lsc profile (#34280)
* draft * ifdef in cl --------- Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -19,6 +19,17 @@
|
||||
#endif
|
||||
|
||||
float get_vignetting_s(float r) {
|
||||
#if defined(VIGNETTE_PROFILE_4DT6MM)
|
||||
if (r < 100000) {
|
||||
return 1.0f + 0.0000013f*r;
|
||||
} else if (r < 250000) {
|
||||
return 1.02f + 0.0000011f*r;
|
||||
} else if (r < 400000) {
|
||||
return 0.92f + 0.0000015f*r;
|
||||
} else {
|
||||
return 0.44f + 0.0000027f*r;
|
||||
}
|
||||
#elif defined(VIGNETTE_PROFILE_8DT0MM)
|
||||
if (r < 62500) {
|
||||
return (1.0f + 0.0000008f*r);
|
||||
} else if (r < 490000) {
|
||||
@@ -28,6 +39,9 @@ float get_vignetting_s(float r) {
|
||||
} else {
|
||||
return (0.53503625f + 0.0000000000022f*r*r);
|
||||
}
|
||||
#else
|
||||
return 1.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
int4 parse_12bit(uchar8 pvs) {
|
||||
@@ -65,7 +79,7 @@ __kernel void process_raw(const __global uchar * in, __global uchar * out, int e
|
||||
#if VIGNETTING
|
||||
int gx = (gid_x*2 - RGB_WIDTH/2);
|
||||
int gy = (gid_y*2 - RGB_HEIGHT/2);
|
||||
const float vignette_factor = get_vignetting_s((gx*gx + gy*gy) / VIGNETTE_RSZ);
|
||||
const float vignette_factor = get_vignetting_s(gx*gx + gy*gy);
|
||||
#else
|
||||
const float vignette_factor = 1.0;
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#if SENSOR_ID == 1
|
||||
|
||||
#define VIGNETTE_PROFILE_8DT0MM
|
||||
|
||||
#define BIT_DEPTH 12
|
||||
#define PV_MAX 4096
|
||||
#define BLACK_LVL 168
|
||||
#define VIGNETTE_RSZ 1.0f
|
||||
|
||||
float4 normalize_pv(int4 parsed, float vignette_factor) {
|
||||
float4 pv = (convert_float4(parsed) - BLACK_LVL) / (PV_MAX - BLACK_LVL);
|
||||
@@ -30,4 +31,4 @@ float3 apply_gamma(float3 rgb, int expo_time) {
|
||||
((rk * (rgb-mp) * (gamma_k*mp+gamma_b) * (1+1/(rk*mp)) / (1-rk*(rgb-mp))) + gamma_k*mp + gamma_b);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#if SENSOR_ID == 3
|
||||
|
||||
#define BGGR
|
||||
#define VIGNETTE_PROFILE_4DT6MM
|
||||
|
||||
#define BIT_DEPTH 12
|
||||
#define PV_MAX10 1023
|
||||
#define PV_MAX12 4095
|
||||
#define PV_MAX16 65536 // gamma curve is calibrated to 16bit
|
||||
#define BLACK_LVL 48
|
||||
#define VIGNETTE_RSZ 2.2545f
|
||||
|
||||
float combine_dual_pvs(float lv, float sv, int expo_time) {
|
||||
float svc = fmax(sv * expo_time, (float)(64 * (PV_MAX10 - BLACK_LVL)));
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#if SENSOR_ID == 2
|
||||
|
||||
#define VIGNETTE_PROFILE_8DT0MM
|
||||
|
||||
#define BIT_DEPTH 12
|
||||
#define BLACK_LVL 64
|
||||
#define VIGNETTE_RSZ 1.0f
|
||||
|
||||
float ox_lut_func(int x) {
|
||||
if (x < 512) {
|
||||
|
||||
Reference in New Issue
Block a user