X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fgamma%2Fgamma.C;h=a81c5e85e6c380c39e272cee1f9f7d3cb9a8c542;hb=b2eb290b3f6e5c233393017aa152e67c76243130;hp=f0fd559d11391ac427e69f501e9e7ef91df2bec2;hpb=21c2e6b36d6a96c2f662a89459d607b5a387f4eb;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/plugins/gamma/gamma.C b/cinelerra-5.1/plugins/gamma/gamma.C index f0fd559d..a81c5e85 100644 --- a/cinelerra-5.1/plugins/gamma/gamma.C +++ b/cinelerra-5.1/plugins/gamma/gamma.C @@ -25,7 +25,7 @@ #include "gamma.h" #include "bchash.h" #include "language.h" -#include "cicolors.h" +#include "bccolors.h" #include "../interpolate/aggregated.h" #include "playback3d.h" #include "workarounds.h" @@ -177,7 +177,7 @@ void GammaUnit::process_package(LoadPackage *package) y /= 0xff; u = (float)((u - 0x80) / 0xff); v = (float)((v - 0x80) / 0xff); - YUV::yuv_to_rgb_f(r, g, b, y, u, v); + YUV::yuv.yuv_to_rgb_f(r, g, b, y, u, v); HISTOGRAM_TAIL(3) break; case BC_YUVA8888: @@ -188,7 +188,7 @@ void GammaUnit::process_package(LoadPackage *package) y /= 0xff; u = (float)((u - 0x80) / 0xff); v = (float)((v - 0x80) / 0xff); - YUV::yuv_to_rgb_f(r, g, b, y, u, v); + YUV::yuv.yuv_to_rgb_f(r, g, b, y, u, v); HISTOGRAM_TAIL(4) break; } @@ -275,9 +275,9 @@ void GammaUnit::process_package(LoadPackage *package) y /= 0xff; u = (float)((u - 0x80) / 0xff); v = (float)((v - 0x80) / 0xff); - YUV::yuv_to_rgb_f(r, g, b, y, u, v); + YUV::yuv.yuv_to_rgb_f(r, g, b, y, u, v); GAMMA_MID - YUV::rgb_to_yuv_f(r, g, b, y, u, v); + YUV::yuv.rgb_to_yuv_f(r, g, b, y, u, v); y *= 0xff; u = u * 0xff + 0x80; v = v * 0xff + 0x80; @@ -294,9 +294,9 @@ void GammaUnit::process_package(LoadPackage *package) y /= 0xff; u = (float)((u - 0x80) / 0xff); v = (float)((v - 0x80) / 0xff); - YUV::yuv_to_rgb_f(r, g, b, y, u, v); + YUV::yuv.yuv_to_rgb_f(r, g, b, y, u, v); GAMMA_MID - YUV::rgb_to_yuv_f(r, g, b, y, u, v); + YUV::yuv.rgb_to_yuv_f(r, g, b, y, u, v); y *= 0xff; u = u * 0xff + 0x80; v = v * 0xff + 0x80; @@ -398,7 +398,7 @@ GammaMain::~GammaMain() delete engine; } -const char* GammaMain::plugin_title() { return _("Gamma"); } +const char* GammaMain::plugin_title() { return N_("Gamma"); } int GammaMain::is_realtime() { return 1; } @@ -526,7 +526,7 @@ void GammaMain::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("GAMMA"); output.tag.set_property("MAX", config.max); output.tag.set_property("GAMMA", config.gamma); @@ -543,7 +543,7 @@ void GammaMain::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; @@ -573,43 +573,30 @@ int GammaMain::handle_opengl() get_output()->to_texture(); get_output()->enable_opengl(); + const char *shader_stack[16]; + memset(shader_stack,0, sizeof(shader_stack)); + int current_shader = 0; - const char *shader_stack[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - 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; // Aggregate with interpolate - int aggregate = 0; - if(prev_effect_is(_("Interpolate Pixels"))) - { - aggregate = 1; - INTERPOLATE_COMPILE(shader_stack, current_shader) - } + int aggregate = prev_effect_is(_("Interpolate Pixels")) ? 1 : 0; + if( aggregate ) + INTERPOLATE_COMPILE(shader_stack, current_shader); GAMMA_COMPILE(shader_stack, current_shader, aggregate); - unsigned int 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) - { + shader_stack[current_shader] = 0; + unsigned int shader = VFrame::make_shader(shader_stack); + if( shader > 0 ) { glUseProgram(shader); glUniform1i(glGetUniformLocation(shader, "tex"), 0); - if(aggregate) - { - INTERPOLATE_UNIFORMS(shader) - } - GAMMA_UNIFORMS(shader) + INTERPOLATE_UNIFORMS(shader); + GAMMA_UNIFORMS(shader); + if( need_color_matrix ) BC_GL_COLORS(shader); } get_output()->init_screen();