add proxy quick switch, folder lock, shortcuts update, bsd GL tweak
[goodguy/history.git] / cinelerra-5.1 / plugins / C41 / c41.C
index 46276f17bb9db7bbb66de2344232e859ddb4830a..f4f372b187051f0cb9af78a886fffc6ca81373e5 100644 (file)
@@ -18,7 +18,7 @@
  *
  */
 #include "c41.h"
-#include "cicolors.h"
+#include "bccolors.h"
 #include "clip.h"
 #include "edlsession.h"
 #include "filexml.h"
@@ -165,7 +165,7 @@ int C41Button::handle_event()
 
 
 C41BoxButton::C41BoxButton(C41Effect *plugin, C41Window *window, int x, int y)
- : BC_GenericButton(x, y, _("Apply box"))
+ : BC_GenericButton(x, y, _("Apply default box"))
 {
        this->plugin = plugin;
        this->window = window;
@@ -214,7 +214,7 @@ int C41Slider::update(int v)
        return 1;
 }
 
-const char* C41Effect::plugin_title() { return _("C41"); }
+const char* C41Effect::plugin_title() { return N_("C41"); }
 int C41Effect::is_realtime() { return 1; }
 int C41Effect::is_synthesis() { return 1; }
 
@@ -267,11 +267,11 @@ C41Window::C41Window(C41Effect *plugin)
        add_subwindow(gamma_b = new BC_Title(x + 80, y, "0.0000"));
        y += 30;
 
-       add_subwindow(new BC_Title(x, y, _("Coef 1:")));
+       add_subwindow(new BC_Title(x, y, _("Contrast:")));
        add_subwindow(coef1 = new BC_Title(x + 80, y, "0.0000"));
        y += 30;
 
-       add_subwindow(new BC_Title(x, y, _("Coef 2:")));
+       add_subwindow(new BC_Title(x, y, _("Brightness:")));
        add_subwindow(coef2 = new BC_Title(x + 80, y, "0.0000"));
        y += 30;
 
@@ -334,12 +334,12 @@ C41Window::C41Window(C41Effect *plugin)
                 &plugin->config.fix_gamma_b, x + 80, y));
        y += 30;
 
-       add_subwindow(new BC_Title(x, y, _("Coef 1:")));
+       add_subwindow(new BC_Title(x, y, _("Contrast:")));
        add_subwindow(fix_coef1 = new C41TextBox(plugin,
                 &plugin->config.fix_coef1, x + 80, y));
        y += 30;
 
-       add_subwindow(new BC_Title(x, y, _("Coef 2:")));
+       add_subwindow(new BC_Title(x, y, _("Brightness:")));
        add_subwindow(fix_coef2 = new C41TextBox(plugin,
                 &plugin->config.fix_coef2, x + 80, y));
        y += 30;
@@ -430,6 +430,11 @@ C41Effect::C41Effect(PluginServer *server)
        tmp_frame = 0;
        blurry_frame = 0;
        memset(&values, 0, sizeof(values));
+       shave_min_row = shave_max_row = 0;
+       shave_min_col = shave_max_col = 0;
+       min_col = max_col = 0;
+       min_row = max_row = 0;
+       pix_max = 0;  pix_len = 0;
 }
 
 C41Effect::~C41Effect()
@@ -752,7 +757,7 @@ int C41Effect::process_realtime(VFrame *input, VFrame *output)
 
                for( int i = min_row; i < max_row; i++ ) {
                        float *row = (float*)frame->get_rows()[i];
-                       row += 3 * shave_min_col;
+                       row += 3 * min_col;
                        for( int j = min_col; j < max_col; j++, row += 3 ) {
                                if( row[0] < minima_r ) minima_r = row[0];
                                if( row[0] > maxima_r ) maxima_r = row[0];
@@ -793,40 +798,44 @@ int C41Effect::process_realtime(VFrame *input, VFrame *output)
        }
 
        if( config.show_box ) {
-               float **rows = (float **)frame->get_rows();
-               if( min_row < max_row - 1 ) {
-                       float *row1 = (float *)rows[min_row];
-                       float *row2 = (float *)rows[max_row - 1];
-
-                       for( int i = 0; i < frame_w; i++ ) {
-                               for( int j = 0; j < 3; j++ ) {
-                                       row1[j] = pix_max - row1[j];
-                                       row2[j] = pix_max - row2[j];
-                               }
-                               if( has_alpha ) {
-                                       row1[3] = pix_max;
-                                       row2[3] = pix_max;
+               EDLSession *session = get_edlsession();
+               int line_w = bmax(session->output_w,session->output_h) / 600 + 1;
+               for( int k=0; k<line_w; ++k ) {
+                       float **rows = (float **)frame->get_rows();
+                       if( min_row < max_row - 1 ) {
+                               float *row1 = (float *)rows[min_row+k];
+                               float *row2 = (float *)rows[max_row-k - 1];
+
+                               for( int i = 0; i < frame_w; i++ ) {
+                                       for( int j = 0; j < 3; j++ ) {
+                                               row1[j] = pix_max - row1[j];
+                                               row2[j] = pix_max - row2[j];
+                                       }
+                                       if( has_alpha ) {
+                                               row1[3] = pix_max;
+                                               row2[3] = pix_max;
+                                       }
+                                       row1 += pix_len;
+                                       row2 += pix_len;
                                }
-                               row1 += pix_len;
-                               row2 += pix_len;
                        }
-               }
 
-               if( min_col < max_col - 1 ) {
-                       int pix1 = pix_len * min_col;
-                       int pix2 = pix_len * (max_col - 1);
-
-                       for( int i = 0; i < frame_h; i++ ) {
-                               float *row1 = rows[i] + pix1;
-                               float *row2 = rows[i] + pix2;
-
-                               for( int j = 0; j < 3; j++ ) {
-                                       row1[j] = pix_max - row1[j];
-                                       row2[j] = pix_max - row2[j];
-                               }
-                               if( has_alpha ) {
-                                       row1[3] = pix_max;
-                                       row2[3] = pix_max;
+                       if( min_col < max_col - 1 ) {
+                               int pix1 = pix_len * (min_col+k);
+                               int pix2 = pix_len * (max_col-k - 1);
+
+                               for( int i = 0; i < frame_h; i++ ) {
+                                       float *row1 = rows[i] + pix1;
+                                       float *row2 = rows[i] + pix2;
+
+                                       for( int j = 0; j < 3; j++ ) {
+                                               row1[j] = pix_max - row1[j];
+                                               row2[j] = pix_max - row2[j];
+                                       }
+                                       if( has_alpha ) {
+                                               row1[3] = pix_max;
+                                               row2[3] = pix_max;
+                                       }
                                }
                        }
                }