<commit_before>﻿#define GAMMA 2.2

vec4 toLinear(vec4 colour)
{
	return vec4(pow(colour.rgb, vec3(GAMMA)), colour.a);
}

vec4 toSRGB(vec4 colour)
{
	return vec4(pow(colour.rgb, vec3(1.0 / GAMMA)), colour.a);
}<commit_msg>Convert to sRGB based on the appropriate formulas instead of an approximiate 2.2 gamma correction.<commit_after>﻿#define GAMMA 2.4

float toLinear(float color)
{
	return color <= 0.04045 ? (color / 12.92) : pow((color + 0.055) / 1.055, GAMMA);
}

vec4 toLinear(vec4 colour)
{
	return vec4(toLinear(colour.r), toLinear(colour.g), toLinear(colour.b), colour.a);
}

float toSRGB(float color)
{
	return color < 0.0031308 ? (12.92 * color) : (1.055 * pow(color, 1.0 / GAMMA) - 0.055);
}

vec4 toSRGB(vec4 colour)
{
	return vec4(toSRGB(colour.r), toSRGB(colour.g), toSRGB(colour.b), colour.a);

	// The following implementation using mix and step may be faster, but stackoverflow indicates it is in fact a lot slower on some GPUs.
	//return vec4(mix(colour.rgb * 12.92, 1.055 * pow(colour.rgb, vec3(1.0 / GAMMA)) - vec3(0.055), step(0.0031308, colour.rgb)), colour.a);
}
{'fraction_non_alphanumeric': 0.1520572450805009, 'fraction_numerical': 0.0778175313059034, 'mean_word_length': 3.7617021276595746, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2482342', 'n_tokens_mistral': 488, 'n_tokens_neox': 435, 'n_words': 110}