Skip to content

Commit 9c3aa2e

Browse files
ZwX1616Comma Device
andauthored
camerad: add os04+4.6mm lsc profile (#34280)
* draft * ifdef in cl --------- Co-authored-by: Comma Device <[email protected]>
1 parent 7ffad19 commit 9c3aa2e

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

system/camerad/cameras/process_raw.cl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
#endif
2020

2121
float get_vignetting_s(float r) {
22+
#if defined(VIGNETTE_PROFILE_4DT6MM)
23+
if (r < 100000) {
24+
return 1.0f + 0.0000013f*r;
25+
} else if (r < 250000) {
26+
return 1.02f + 0.0000011f*r;
27+
} else if (r < 400000) {
28+
return 0.92f + 0.0000015f*r;
29+
} else {
30+
return 0.44f + 0.0000027f*r;
31+
}
32+
#elif defined(VIGNETTE_PROFILE_8DT0MM)
2233
if (r < 62500) {
2334
return (1.0f + 0.0000008f*r);
2435
} else if (r < 490000) {
@@ -28,6 +39,9 @@ float get_vignetting_s(float r) {
2839
} else {
2940
return (0.53503625f + 0.0000000000022f*r*r);
3041
}
42+
#else
43+
return 1.0f;
44+
#endif
3145
}
3246

3347
int4 parse_12bit(uchar8 pvs) {
@@ -65,7 +79,7 @@ __kernel void process_raw(const __global uchar * in, __global uchar * out, int e
6579
#if VIGNETTING
6680
int gx = (gid_x*2 - RGB_WIDTH/2);
6781
int gy = (gid_y*2 - RGB_HEIGHT/2);
68-
const float vignette_factor = get_vignetting_s((gx*gx + gy*gy) / VIGNETTE_RSZ);
82+
const float vignette_factor = get_vignetting_s(gx*gx + gy*gy);
6983
#else
7084
const float vignette_factor = 1.0;
7185
#endif

system/camerad/sensors/ar0231_cl.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#if SENSOR_ID == 1
22

3+
#define VIGNETTE_PROFILE_8DT0MM
4+
35
#define BIT_DEPTH 12
46
#define PV_MAX 4096
57
#define BLACK_LVL 168
6-
#define VIGNETTE_RSZ 1.0f
78

89
float4 normalize_pv(int4 parsed, float vignette_factor) {
910
float4 pv = (convert_float4(parsed) - BLACK_LVL) / (PV_MAX - BLACK_LVL);
@@ -30,4 +31,4 @@ float3 apply_gamma(float3 rgb, int expo_time) {
3031
((rk * (rgb-mp) * (gamma_k*mp+gamma_b) * (1+1/(rk*mp)) / (1-rk*(rgb-mp))) + gamma_k*mp + gamma_b);
3132
}
3233

33-
#endif
34+
#endif

system/camerad/sensors/os04c10_cl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#if SENSOR_ID == 3
22

33
#define BGGR
4+
#define VIGNETTE_PROFILE_4DT6MM
45

56
#define BIT_DEPTH 12
67
#define PV_MAX10 1023
78
#define PV_MAX12 4095
89
#define PV_MAX16 65536 // gamma curve is calibrated to 16bit
910
#define BLACK_LVL 48
10-
#define VIGNETTE_RSZ 2.2545f
1111

1212
float combine_dual_pvs(float lv, float sv, int expo_time) {
1313
float svc = fmax(sv * expo_time, (float)(64 * (PV_MAX10 - BLACK_LVL)));

system/camerad/sensors/ox03c10_cl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#if SENSOR_ID == 2
22

3+
#define VIGNETTE_PROFILE_8DT0MM
4+
35
#define BIT_DEPTH 12
46
#define BLACK_LVL 64
5-
#define VIGNETTE_RSZ 1.0f
67

78
float ox_lut_func(int x) {
89
if (x < 512) {

0 commit comments

Comments
 (0)