From fdcec3ac46db490670f028197af2a41ba7a4cd97 Mon Sep 17 00:00:00 2001 From: Comma Device Date: Wed, 29 Mar 2023 21:46:27 -0700 Subject: [PATCH 1/7] 0.7 --- system/camerad/cameras/real_debayer.cl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system/camerad/cameras/real_debayer.cl b/system/camerad/cameras/real_debayer.cl index cff5ae455b..9988a3509b 100644 --- a/system/camerad/cameras/real_debayer.cl +++ b/system/camerad/cameras/real_debayer.cl @@ -25,9 +25,15 @@ float3 color_correct(float3 rgb) { const float rk = 9 - 100*mp; // poly approximation for s curve + #if IS_OX + return (x > mp) ? + powr(((rk * (x-mp) * (1-(gamma_k*mp+gamma_b)) * (1+1/(rk*(1-mp))) / (1+rk*(x-mp))) + gamma_k*mp + gamma_b), 0.7) : + powr(((rk * (x-mp) * (gamma_k*mp+gamma_b) * (1+1/(rk*mp)) / (1-rk*(x-mp))) + gamma_k*mp + gamma_b), 0.7); + #else return (x > mp) ? ((rk * (x-mp) * (1-(gamma_k*mp+gamma_b)) * (1+1/(rk*(1-mp))) / (1+rk*(x-mp))) + gamma_k*mp + gamma_b) : ((rk * (x-mp) * (gamma_k*mp+gamma_b) * (1+1/(rk*mp)) / (1-rk*(x-mp))) + gamma_k*mp + gamma_b); + #endif } float get_vignetting_s(float r) { From f1371ebcee976b9825e87009941d1966d596b107 Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Thu, 30 Mar 2023 13:16:03 -0700 Subject: [PATCH 2/7] magic --- system/camerad/cameras/real_debayer.cl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/system/camerad/cameras/real_debayer.cl b/system/camerad/cameras/real_debayer.cl index 9988a3509b..6cb10ceabe 100644 --- a/system/camerad/cameras/real_debayer.cl +++ b/system/camerad/cameras/real_debayer.cl @@ -18,6 +18,9 @@ float3 color_correct(float3 rgb) { x += rgb.z * (float3)(-0.25277411, -0.05627105, 1.45875782); #endif + #if IS_OX + return (0.29672272*erf(x*52.69802759)-0.69221516*exp(-8.72601052*x)+0.15238458*x+0.72277452)*0.876262834-0.026778035; + #else // tone mapping params const float gamma_k = 0.75; const float gamma_b = 0.125; @@ -25,11 +28,6 @@ float3 color_correct(float3 rgb) { const float rk = 9 - 100*mp; // poly approximation for s curve - #if IS_OX - return (x > mp) ? - powr(((rk * (x-mp) * (1-(gamma_k*mp+gamma_b)) * (1+1/(rk*(1-mp))) / (1+rk*(x-mp))) + gamma_k*mp + gamma_b), 0.7) : - powr(((rk * (x-mp) * (gamma_k*mp+gamma_b) * (1+1/(rk*mp)) / (1-rk*(x-mp))) + gamma_k*mp + gamma_b), 0.7); - #else return (x > mp) ? ((rk * (x-mp) * (1-(gamma_k*mp+gamma_b)) * (1+1/(rk*(1-mp))) / (1+rk*(x-mp))) + gamma_k*mp + gamma_b) : ((rk * (x-mp) * (gamma_k*mp+gamma_b) * (1+1/(rk*mp)) / (1-rk*(x-mp))) + gamma_k*mp + gamma_b); From 822f5d1b964c3c0829af97b79e49e8e82afb9d7d Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Thu, 30 Mar 2023 13:37:30 -0700 Subject: [PATCH 3/7] faster magic --- system/camerad/cameras/real_debayer.cl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/camerad/cameras/real_debayer.cl b/system/camerad/cameras/real_debayer.cl index 6cb10ceabe..372800c487 100644 --- a/system/camerad/cameras/real_debayer.cl +++ b/system/camerad/cameras/real_debayer.cl @@ -19,7 +19,7 @@ float3 color_correct(float3 rgb) { #endif #if IS_OX - return (0.29672272*erf(x*52.69802759)-0.69221516*exp(-8.72601052*x)+0.15238458*x+0.72277452)*0.876262834-0.026778035; + return (1.68963455*exp(-1.18227337*x)-1.72323481+3.00240797*powr(x,0.5)-0.7952626*x+0.0336002687)*0.965697808; #else // tone mapping params const float gamma_k = 0.75; From dc7dddba350aa0d3c43e068f2c09dc285239a7d3 Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Thu, 30 Mar 2023 14:10:50 -0700 Subject: [PATCH 4/7] more simple --- system/camerad/cameras/real_debayer.cl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/camerad/cameras/real_debayer.cl b/system/camerad/cameras/real_debayer.cl index 372800c487..b37a48f998 100644 --- a/system/camerad/cameras/real_debayer.cl +++ b/system/camerad/cameras/real_debayer.cl @@ -19,7 +19,7 @@ float3 color_correct(float3 rgb) { #endif #if IS_OX - return (1.68963455*exp(-1.18227337*x)-1.72323481+3.00240797*powr(x,0.5)-0.7952626*x+0.0336002687)*0.965697808; + return 1.631676381*exp(-1.18227337*x)+2.899418795*powr(x,0.5)-0.76798335*x-1.631676373; #else // tone mapping params const float gamma_k = 0.75; From 5eed3a6ae15e4623cc1417d0639f4a368ca7b86a Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Thu, 30 Mar 2023 14:12:32 -0700 Subject: [PATCH 5/7] up --- system/camerad/cameras/camera_qcom2.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/camerad/cameras/camera_qcom2.cc b/system/camerad/cameras/camera_qcom2.cc index 94116b11cd..e186e59ecc 100644 --- a/system/camerad/cameras/camera_qcom2.cc +++ b/system/camerad/cameras/camera_qcom2.cc @@ -71,7 +71,7 @@ const int DC_GAIN_MIN_WEIGHT_OX03C10 = 1; // always on is fine const int DC_GAIN_MAX_WEIGHT_OX03C10 = 1; const float TARGET_GREY_FACTOR_AR0231 = 1.0; -const float TARGET_GREY_FACTOR_OX03C10 = 0.02; +const float TARGET_GREY_FACTOR_OX03C10 = 0.01; const float sensor_analog_gains_AR0231[] = { 1.0/8.0, 2.0/8.0, 2.0/7.0, 3.0/7.0, // 0, 1, 2, 3 From 670899062cd0b572d88ab9bc5c0e7ef61358f25b Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Sun, 2 Apr 2023 21:10:46 -0700 Subject: [PATCH 7/7] more mid bits --- system/camerad/cameras/real_debayer.cl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/camerad/cameras/real_debayer.cl b/system/camerad/cameras/real_debayer.cl index b37a48f998..e15a873d6d 100644 --- a/system/camerad/cameras/real_debayer.cl +++ b/system/camerad/cameras/real_debayer.cl @@ -19,7 +19,7 @@ float3 color_correct(float3 rgb) { #endif #if IS_OX - return 1.631676381*exp(-1.18227337*x)+2.899418795*powr(x,0.5)-0.76798335*x-1.631676373; + return -0.507089*exp(-12.54124638*x)+0.9655*powr(x,0.5)-0.472597*x+0.507089; #else // tone mapping params const float gamma_k = 0.75;