duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

simple-brightness.glsl (815B)


      1 /*
      2 [configuration]
      3 
      4 [OptionRangeFloat]
      5 GUIName = Brightness Scale
      6 OptionName = BRIGHTNESS_SCALE
      7 MinValue = 0.1
      8 MaxValue = 5.0
      9 StepAmount = 0.1
     10 DefaultValue = 1.0
     11 
     12 [/configuration]
     13 */
     14 
     15 void main()
     16 {
     17   float4 color = Sample();
     18   float brightness_scale = GetOption(BRIGHTNESS_SCALE);
     19 
     20   // rgb->yuv
     21   float3 yuv;
     22   yuv.r = dot(color.rgb, float3(0.299f, 0.587f, 0.114f));
     23   yuv.g = dot(color.rgb, float3(-0.14713f, -0.28886f, 0.436f));
     24   yuv.b = dot(color.rgb, float3(0.615f, -0.51499f, -0.10001f));
     25 
     26   // apply brightness to y
     27   yuv.r = saturate(yuv.r * brightness_scale);
     28 
     29   // yuv->rgb
     30   color.r = dot(yuv, float3(1.0f, 0.0f, 1.13983f));
     31   color.g = dot(yuv, float3(1.0f, -0.39465f, -0.58060f));
     32   color.b = dot(yuv, float3(1.0f, 2.03211f, 0.0f));
     33   color.rgb = saturate(color.rgb);
     34 
     35   SetOutput(saturate(color));
     36 }