Loading...
Searching...
No Matches
CaptureAdjustGLSL.hpp File Reference

The sensor corrections, as shader source shared by every demosaicer. More...

Detailed Description

The sensor corrections, as shader source shared by every demosaicer.

One copy of the maths, because two demosaicers exist for the same frames – a sampler2D one for host-staged uploads and a samplerExternalOES one for Tegra's imported dma-bufs – and a correction that differed between them would show up as the picture changing when the capture rung changed, which reads as a capture bug rather than a shader one.

Order matters and is not arbitrary:

  1. subtract the black level, then renormalise, so the range that survives still spans 0..1 rather than being compressed toward black;
  2. white balance, which is only meaningful once the pedestal is gone – applying gain to an offset scales the offset too;
  3. exposure, a plain linear multiplier;
  4. saturation, in linear light where a luma-weighted mix is meaningful;
  5. the transfer curve, last, because everything above assumes linear samples and a curve applied earlier would bend all of it.

Go to the source code of this file.

Namespaces

namespace  score
 Base toolkit upon which the software is built.
 
namespace  score::gfx
 Graphics rendering pipeline for ossia score.
 

Macros

#define SCORE_GFX_CAPTURE_UNIFORMS
 
#define SCORE_GFX_CAPTURE_ADJUST_FN
 

Macro Definition Documentation

◆ SCORE_GFX_CAPTURE_ADJUST_FN

#define SCORE_GFX_CAPTURE_ADJUST_FN
Value:
"vec3 adjustCapture(vec3 c)\n" \
"{\n" \
" vec3 bl = mat.blackLevel.rgb;\n" \
" c = (c - bl) / max(vec3(1.0 / 65535.0), vec3(1.0) - bl);\n" \
" c *= mat.whiteBalance.rgb;\n" \
" c *= mat.params.x;\n" \
" c = max(c, vec3(0.0));\n" \
" float l = dot(c, vec3(0.2126, 0.7152, 0.0722));\n" \
" c = mix(vec3(l), c, mat.params.z);\n" \
" c = max(c, vec3(0.0));\n" \
" c = pow(c, vec3(1.0 / max(mat.params.y, 1.0 / 65535.0)));\n" \
" return clamp(c, 0.0, 1.0);\n" \
"}\n"

adjustCapture(vec3) – applies the corrections to linear demosaiced RGB.

Every step is the identity at its default, so a pipeline that sets nothing passes the colour through unchanged.

◆ SCORE_GFX_CAPTURE_UNIFORMS

#define SCORE_GFX_CAPTURE_UNIFORMS
Value:
"layout(std140, binding = 0) uniform renderer_t {\n" \
" mat4 clipSpaceCorrMatrix;\n" \
" vec2 renderSize;\n" \
"} renderer;\n" \
"\n" \
"layout(std140, binding = 2) uniform material_t {\n" \
" vec2 scale;\n" \
" vec2 texSz;\n" \
" vec4 blackLevel;\n" \
" vec4 whiteBalance;\n" \
" vec4 params;\n" \
"} mat;\n"

The material block for the capture path: the shared geometry fields, plus the corrections. Matches CaptureMaterialUBO field for field.