X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fcolorbalance%2Fcolorbalance.C;h=7b8f0cffd01161201786b006221c299cad595e19;hb=702161ddaf384a773831f1643fca0a54133625b2;hp=31197408f29b76ac1d1450b972bbd66598308c95;hpb=21c2e6b36d6a96c2f662a89459d607b5a387f4eb;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/plugins/colorbalance/colorbalance.C b/cinelerra-5.1/plugins/colorbalance/colorbalance.C index 31197408..7b8f0cff 100644 --- a/cinelerra-5.1/plugins/colorbalance/colorbalance.C +++ b/cinelerra-5.1/plugins/colorbalance/colorbalance.C @@ -19,6 +19,7 @@ * */ +#include "bccolors.h" #include "filexml.h" #include "clip.h" #include "colorbalance.h" @@ -259,7 +260,7 @@ printf("PROCESS_F %f\n", cyan_f); \ switch(input->get_color_model()) { case BC_RGB888: - PROCESS(yuv.yuv_to_rgb_8, yuv.rgb_to_yuv_8, + PROCESS(YUV::yuv.yuv_to_rgb_8, YUV::yuv.rgb_to_yuv_8, r_lookup_8, g_lookup_8, b_lookup_8, unsigned char, 0xff, 3, 0); break; @@ -269,7 +270,7 @@ printf("PROCESS_F %f\n", cyan_f); \ break; case BC_YUV888: - PROCESS(yuv.yuv_to_rgb_8, yuv.rgb_to_yuv_8, + PROCESS(YUV::yuv.yuv_to_rgb_8, YUV::yuv.rgb_to_yuv_8, r_lookup_8, g_lookup_8, b_lookup_8, unsigned char, 0xff, 3, 1); break; @@ -279,25 +280,25 @@ printf("PROCESS_F %f\n", cyan_f); \ break; case BC_RGBA8888: - PROCESS(yuv.yuv_to_rgb_8, yuv.rgb_to_yuv_8, + PROCESS(YUV::yuv.yuv_to_rgb_8, YUV::yuv.rgb_to_yuv_8, r_lookup_8, g_lookup_8, b_lookup_8, unsigned char, 0xff, 4, 0); break; case BC_YUVA8888: - PROCESS(yuv.yuv_to_rgb_8, yuv.rgb_to_yuv_8, + PROCESS(YUV::yuv.yuv_to_rgb_8, YUV::yuv.rgb_to_yuv_8, r_lookup_8, g_lookup_8, b_lookup_8, unsigned char, 0xff, 4, 1); break; case BC_YUV161616: - PROCESS(yuv.yuv_to_rgb_16, yuv.rgb_to_yuv_16, + PROCESS(YUV::yuv.yuv_to_rgb_16, YUV::yuv.rgb_to_yuv_16, r_lookup_16, g_lookup_16, b_lookup_16, u_int16_t, 0xffff, 3, 1); break; case BC_YUVA16161616: - PROCESS(yuv.yuv_to_rgb_16, yuv.rgb_to_yuv_16, + PROCESS(YUV::yuv.yuv_to_rgb_16, YUV::yuv.rgb_to_yuv_16, r_lookup_16, g_lookup_16, b_lookup_16, u_int16_t, 0xffff, 4, 1); break; @@ -335,7 +336,7 @@ ColorBalanceMain::~ColorBalanceMain() } } -const char* ColorBalanceMain::plugin_title() { return _("Color Balance"); } +const char* ColorBalanceMain::plugin_title() { return N_("Color Balance"); } int ColorBalanceMain::is_realtime() { return 1; } @@ -402,27 +403,23 @@ int ColorBalanceMain::test_boundary(float &value) int ColorBalanceMain::synchronize_params(ColorBalanceSlider *slider, float difference) { - if(thread && config.lock_params) - { - if(slider != ((ColorBalanceWindow*)thread->window)->cyan) - { - config.cyan += difference; - test_boundary(config.cyan); - ((ColorBalanceWindow*)thread->window)->cyan->update((int64_t)config.cyan); - } - if(slider != ((ColorBalanceWindow*)thread->window)->magenta) - { - config.magenta += difference; - test_boundary(config.magenta); - ((ColorBalanceWindow*)thread->window)->magenta->update((int64_t)config.magenta); - } - if(slider != ((ColorBalanceWindow*)thread->window)->yellow) - { - config.yellow += difference; - test_boundary(config.yellow); - ((ColorBalanceWindow*)thread->window)->yellow->update((int64_t)config.yellow); - } - } + if(thread && config.lock_params) { + if(slider != ((ColorBalanceWindow*)thread->window)->cyan) { + config.cyan += difference; + test_boundary(config.cyan); + ((ColorBalanceWindow*)thread->window)->cyan->update((int64_t)config.cyan); + } + if(slider != ((ColorBalanceWindow*)thread->window)->magenta) { + config.magenta += difference; + test_boundary(config.magenta); + ((ColorBalanceWindow*)thread->window)->magenta->update((int64_t)config.magenta); + } + if(slider != ((ColorBalanceWindow*)thread->window)->yellow) { + config.yellow += difference; + test_boundary(config.yellow); + ((ColorBalanceWindow*)thread->window)->yellow->update((int64_t)config.yellow); + } + } return 0; } @@ -536,7 +533,7 @@ void ColorBalanceMain::save_data(KeyFrame *keyframe) FileXML output; // cause data to be stored directly in text - output.set_shared_output(keyframe->get_data(), MESSAGESIZE); + output.set_shared_output(keyframe->xbuf); output.tag.set_title("COLORBALANCE"); output.tag.set_property("CYAN", config.cyan); output.tag.set_property("MAGENTA", config.magenta); @@ -554,7 +551,7 @@ void ColorBalanceMain::read_data(KeyFrame *keyframe) { FileXML input; - input.set_shared_input(keyframe->get_data(), strlen(keyframe->get_data())); + input.set_shared_input(keyframe->xbuf); int result = 0; @@ -604,9 +601,14 @@ int ColorBalanceMain::handle_opengl() get_output()->to_texture(); get_output()->enable_opengl(); - unsigned int shader = 0; - const char *shader_stack[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - int current_shader = 0; + const char *shader_stack[16]; + memset(shader_stack,0, sizeof(shader_stack)); + int current_shader = 0; + + int need_color_matrix = BC_CModels::is_yuv(get_output()->get_color_model()) ? 1 : 0; + if( need_color_matrix ) + shader_stack[current_shader++] = bc_gl_colors; + int aggregate_interpolate = 0; int aggregate_gamma = 0; @@ -615,28 +617,18 @@ int ColorBalanceMain::handle_opengl() //printf("ColorBalanceMain::handle_opengl %d %d\n", aggregate_interpolate, aggregate_gamma); if(aggregate_interpolate) - INTERPOLATE_COMPILE(shader_stack, current_shader) + INTERPOLATE_COMPILE(shader_stack, current_shader); if(aggregate_gamma) - GAMMA_COMPILE(shader_stack, current_shader, aggregate_interpolate) - - COLORBALANCE_COMPILE(shader_stack, - current_shader, - aggregate_gamma || aggregate_interpolate) - - shader = VFrame::make_shader(0, - shader_stack[0], - shader_stack[1], - shader_stack[2], - shader_stack[3], - shader_stack[4], - shader_stack[5], - shader_stack[6], - shader_stack[7], - 0); - - if(shader > 0) - { + GAMMA_COMPILE(shader_stack, current_shader, + aggregate_interpolate); + + COLORBALANCE_COMPILE(shader_stack, current_shader, + aggregate_gamma || aggregate_interpolate); + + shader_stack[current_shader] = 0; + unsigned int shader = VFrame::make_shader(shader_stack); + if( shader > 0 ) { glUseProgram(shader); glUniform1i(glGetUniformLocation(shader, "tex"), 0); @@ -644,7 +636,7 @@ int ColorBalanceMain::handle_opengl() if(aggregate_gamma) GAMMA_UNIFORMS(shader); COLORBALANCE_UNIFORMS(shader); - + if( need_color_matrix ) BC_GL_COLORS(shader); } get_output()->init_screen();