X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fcolorbalance%2Faggregated.h;h=6c8d78f4110a1e045f8e8b8f8bfae33bb9c3dd2e;hb=83c3c4b8005ee632f93844f2a81c9bbded1b69ad;hp=b036f2c89c146a5b7767cedad4d9f2479eaf00f2;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/plugins/colorbalance/aggregated.h b/cinelerra-5.1/plugins/colorbalance/aggregated.h index b036f2c8..6c8d78f4 100644 --- a/cinelerra-5.1/plugins/colorbalance/aggregated.h +++ b/cinelerra-5.1/plugins/colorbalance/aggregated.h @@ -2,21 +2,21 @@ /* * CINELERRA * Copyright (C) 2008 Adam Williams - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * */ #ifndef COLORBALANCE_AGGREGATED @@ -36,7 +36,7 @@ static const char *colorbalance_get_pixel2 = "}\n"; -static const char *colorbalance_rgb_shader = +static const char *colorbalance_rgb_shader = "uniform vec3 colorbalance_scale;\n" "void main()\n" "{\n" @@ -44,50 +44,43 @@ static const char *colorbalance_rgb_shader = " gl_FragColor.rgb *= colorbalance_scale;\n" "}\n"; -static const char *colorbalance_yuv_shader = +static const char *colorbalance_yuv_shader = "uniform vec3 colorbalance_scale;\n" "void main()\n" "{\n" " gl_FragColor = colorbalance_get_pixel();\n" - YUV_TO_RGB_FRAG("gl_FragColor") + YUV_TO_RGB_FRAG("gl_FragColor") " gl_FragColor.rgb *= colorbalance_scale;\n" - RGB_TO_YUV_FRAG("gl_FragColor") + RGB_TO_YUV_FRAG("gl_FragColor") "}\n"; -static const char *colorbalance_yuv_preserve_shader = +static const char *colorbalance_yuv_preserve_shader = "uniform vec3 colorbalance_scale;\n" "void main()\n" "{\n" " gl_FragColor = colorbalance_get_pixel();\n" " float y = gl_FragColor.r;\n" - YUV_TO_RGB_FRAG("gl_FragColor") + YUV_TO_RGB_FRAG("gl_FragColor") " gl_FragColor.rgb *= colorbalance_scale.rgb;\n" - RGB_TO_YUV_FRAG("gl_FragColor") + RGB_TO_YUV_FRAG("gl_FragColor") " gl_FragColor.r = y;\n" "}\n"; -#define COLORBALANCE_COMPILE(shader_stack, current_shader, aggregate_prev) \ -{ \ - if(aggregate_prev) \ - shader_stack[current_shader++] = colorbalance_get_pixel1; \ - else \ - shader_stack[current_shader++] = colorbalance_get_pixel2; \ - if(BC_CModels::is_yuv(get_output()->get_color_model())) \ - {\ - if(get_output()->get_params()->get("COLORBALANCE_PRESERVE", (int)0)) \ - shader_stack[current_shader++] = colorbalance_yuv_preserve_shader; \ - else \ - shader_stack[current_shader++] = colorbalance_yuv_shader; \ - } \ - else \ - shader_stack[current_shader++] = colorbalance_rgb_shader; \ -} +#define COLORBALANCE_COMPILE(shader_stack, current_shader, aggregate_prev) do { \ + shader_stack[current_shader++] = \ + aggregate_prev ? colorbalance_get_pixel1 : colorbalance_get_pixel2; \ + shader_stack[current_shader++] = \ + !BC_CModels::is_yuv(get_output()->get_color_model()) ? colorbalance_rgb_shader : \ + get_output()->get_params()->get("COLORBALANCE_PRESERVE", (int)0) ? \ + colorbalance_yuv_preserve_shader : colorbalance_yuv_shader ; \ +} while(0) -#define COLORBALANCE_UNIFORMS(shader) \ +#define COLORBALANCE_UNIFORMS(shader) do { \ glUniform3f(glGetUniformLocation(shader, "colorbalance_scale"), \ get_output()->get_params()->get("COLORBALANCE_CYAN", (float)1), \ get_output()->get_params()->get("COLORBALANCE_MAGENTA", (float)1), \ - get_output()->get_params()->get("COLORBALANCE_YELLOW", (float)1)); + get_output()->get_params()->get("COLORBALANCE_YELLOW", (float)1)); \ +} while(0) #endif