|
|
@ -2,8 +2,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
#define BGGR |
|
|
|
#define BGGR |
|
|
|
|
|
|
|
|
|
|
|
#define BIT_DEPTH 10 |
|
|
|
#define BIT_DEPTH 12 |
|
|
|
#define PV_MAX10 1023 |
|
|
|
#define PV_MAX10 1023 |
|
|
|
|
|
|
|
#define PV_MAX12 4096 |
|
|
|
#define PV_MAX16 65536 // gamma curve is calibrated to 16bit
|
|
|
|
#define PV_MAX16 65536 // gamma curve is calibrated to 16bit
|
|
|
|
#define BLACK_LVL 64 |
|
|
|
#define BLACK_LVL 64 |
|
|
|
#define VIGNETTE_RSZ 2.2545f |
|
|
|
#define VIGNETTE_RSZ 2.2545f |
|
|
@ -38,6 +39,11 @@ float4 normalize_pv_hdr(int4 parsed, int4 short_parsed, float vignette_factor, i |
|
|
|
return clamp(pv*vignette_factor, 0.0, 1.0); |
|
|
|
return clamp(pv*vignette_factor, 0.0, 1.0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float4 normalize_pv(int4 parsed, float vignette_factor) { |
|
|
|
|
|
|
|
float4 pv = (convert_float4(parsed) - BLACK_LVL) / (PV_MAX12 - BLACK_LVL); |
|
|
|
|
|
|
|
return clamp(pv*vignette_factor, 0.0, 1.0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float3 color_correct(float3 rgb) { |
|
|
|
float3 color_correct(float3 rgb) { |
|
|
|
float3 corrected = rgb.x * (float3)(1.55361989, -0.268894615, -0.000593219); |
|
|
|
float3 corrected = rgb.x * (float3)(1.55361989, -0.268894615, -0.000593219); |
|
|
|
corrected += rgb.y * (float3)(-0.421217301, 1.51883144, -0.69760146); |
|
|
|
corrected += rgb.y * (float3)(-0.421217301, 1.51883144, -0.69760146); |
|
|
@ -46,10 +52,11 @@ float3 color_correct(float3 rgb) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float3 apply_gamma(float3 rgb, int expo_time) { |
|
|
|
float3 apply_gamma(float3 rgb, int expo_time) { |
|
|
|
float s = log2((float)expo_time); |
|
|
|
return powr(rgb, 0.7); |
|
|
|
|
|
|
|
/*float s = log2((float)expo_time);
|
|
|
|
if (s < 6) {s = fmin(12.0 - s, 9.0);} |
|
|
|
if (s < 6) {s = fmin(12.0 - s, 9.0);} |
|
|
|
// log function adaptive to number of bits
|
|
|
|
// log function adaptive to number of bits
|
|
|
|
return clamp(log(1 + rgb*(PV_MAX16 - BLACK_LVL)) * (0.48*s*s - 12.92*s + 115.0) - (1.08*s*s - 29.2*s + 260.0), 0.0, 255.0) / 255.0; |
|
|
|
return clamp(log(1 + rgb*(PV_MAX16 - BLACK_LVL)) * (0.48*s*s - 12.92*s + 115.0) - (1.08*s*s - 29.2*s + 260.0), 0.0, 255.0) / 255.0;*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|