Skip to content

Commit

Permalink
camerad: add os04+4.6mm lsc profile (#34280)
Browse files Browse the repository at this point in the history
* draft

* ifdef in cl

---------

Co-authored-by: Comma Device <[email protected]>
  • Loading branch information
ZwX1616 and Comma Device authored Dec 18, 2024
1 parent 7ffad19 commit 9c3aa2e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
16 changes: 15 additions & 1 deletion system/camerad/cameras/process_raw.cl
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions system/camerad/sensors/ar0231_cl.h
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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
2 changes: 1 addition & 1 deletion system/camerad/sensors/os04c10_cl.h
Original file line number Diff line number Diff line change
@@ -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)));
Expand Down
3 changes: 2 additions & 1 deletion system/camerad/sensors/ox03c10_cl.h
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down

0 comments on commit 9c3aa2e

Please sign in to comment.