<commit_before>//  Natron
//
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
*Created by <NAME> on 6/1/2012.
*contact: immarespond at gmail dot com
*
*/





const char* fragRGB =
"uniform sampler2D Tex;\n"
"uniform float gain;\n"
"uniform float offset;\n"
"uniform int lut;\n"
"\n"
"float linear_to_srgb(float c) {\n"
"    return (c<=0.0031308) ? (12.92*c) : (((1.0+0.055)*pow(c,1.0/2.4))-0.055);\n"
"}\n"
"float linear_to_rec709(float c) {"
"    return (c<0.018) ? (4.500*c) : (1.099*pow(c,0.45) - 0.099);\n"
"}\n"
"void main(){\n"
"    \n"
"    vec4 color_tmp = texture2D(Tex,gl_TexCoord[0].st);\n"
"    \n"
"    color_tmp.rgb = color_tmp.rgb ;\n"
"   if(lut == 0){ // srgb\n"
// << TO SRGB
"       color_tmp.r = linear_to_srgb(color_tmp.r);"
"       color_tmp.g = linear_to_srgb(color_tmp.g);"
"       color_tmp.b = linear_to_srgb(color_tmp.b);"
// << END TO SRGB
"   }\n"
"   else if( lut == 2){ // Rec 709\n" // << TO REC 709
"       color_tmp.r = linear_to_rec709(color_tmp.r);"
"       color_tmp.g = linear_to_rec709(color_tmp.g);"
"       color_tmp.b = linear_to_rec709(color_tmp.b);"
"\n"
"   }\n"   // << END TO REC 709
"   color_tmp.rgb = (color_tmp.rgb * gain) + offset;\n"
"	gl_FragColor = color_tmp;\n"
"}\n"
;

const char* vertRGB =

"void main()\n"
"{\n"
"\n"
"   gl_TexCoord[0] = gl_MultiTexCoord0;\n"
"	gl_Position = ftransform();\n"
"}\n"
"\n"
;

/*There's a black texture used for when the user disconnect the viewer
 It's not just a shader,because we still need coordinates feedback.
 */
const char* blackFrag =
"uniform sampler2D Tex;\n"
"void main()\n"
"{\n"
"    gl_FragColor = texture2D(Tex,gl_TexCoord[0].st);\n"
"}\n";
<commit_msg>fragRGB: gain and offset have to be applied on linear intensity, of course<commit_after>//  Natron
//
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
*Created by <NAME> on 6/1/2012.
*contact: immarespond at gmail dot com
*
*/





const char* fragRGB =
"uniform sampler2D Tex;\n"
"uniform float gain;\n"
"uniform float offset;\n"
"uniform int lut;\n"
"\n"
"float linear_to_srgb(float c) {\n"
"    return (c<=0.0031308) ? (12.92*c) : (((1.0+0.055)*pow(c,1.0/2.4))-0.055);\n"
"}\n"
"float linear_to_rec709(float c) {"
"    return (c<0.018) ? (4.500*c) : (1.099*pow(c,0.45) - 0.099);\n"
"}\n"
"void main(){\n"
"    vec4 color_tmp = texture2D(Tex,gl_TexCoord[0].st);\n"
"    color_tmp.rgb = (color_tmp.rgb * gain) + offset;\n"
"    if(lut == 0){ // srgb\n"
// << TO SRGB
"       color_tmp.r = linear_to_srgb(color_tmp.r);"
"       color_tmp.g = linear_to_srgb(color_tmp.g);"
"       color_tmp.b = linear_to_srgb(color_tmp.b);"
// << END TO SRGB
"   }\n"
"   else if( lut == 2){ // Rec 709\n" // << TO REC 709
"       color_tmp.r = linear_to_rec709(color_tmp.r);"
"       color_tmp.g = linear_to_rec709(color_tmp.g);"
"       color_tmp.b = linear_to_rec709(color_tmp.b);"
"   }\n"   // << END TO REC 709
"	gl_FragColor = color_tmp;\n"
"}\n"
;

const char* vertRGB =
"void main()\n"
"{\n"
"   gl_TexCoord[0] = gl_MultiTexCoord0;"
"	gl_Position = ftransform();\n"
"}\n"
"\n"
;

/*There's a black texture used for when the user disconnect the viewer
 It's not just a shader,because we still need coordinates feedback.
 */
const char* blackFrag =
"uniform sampler2D Tex;\n"
"void main()\n"
"{\n"
"    gl_FragColor = texture2D(Tex,gl_TexCoord[0].st);\n"
"}\n";

{'fraction_non_alphanumeric': 0.19228650137741046, 'fraction_numerical': 0.047933884297520664, 'mean_word_length': 3.2122969837587005, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 5, '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': '5237241', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1520, 'n_words': 367}