00001 #ifndef COLORBALANCE_H
00002 #define COLORBALANCE_H
00003
00004 class ColorBalanceMain;
00005
00006 #include "colorbalancewindow.h"
00007 #include "condition.h"
00008 #include "plugincolors.h"
00009 #include "guicast.h"
00010 #include "pluginvclient.h"
00011 #include "thread.h"
00012
00013 #define SHADOWS 0
00014 #define MIDTONES 1
00015 #define HIGHLIGHTS 2
00016
00017 class ColorBalanceConfig
00018 {
00019 public:
00020 ColorBalanceConfig();
00021
00022 int equivalent(ColorBalanceConfig &that);
00023 void copy_from(ColorBalanceConfig &that);
00024 void interpolate(ColorBalanceConfig &prev,
00025 ColorBalanceConfig &next,
00026 int64_t prev_frame,
00027 int64_t next_frame,
00028 int64_t current_frame);
00029
00030
00031 float cyan;
00032 float magenta;
00033 float yellow;
00034 int preserve;
00035 int lock_params;
00036 };
00037
00038 class ColorBalanceEngine : public Thread
00039 {
00040 public:
00041 ColorBalanceEngine(ColorBalanceMain *plugin);
00042 ~ColorBalanceEngine();
00043
00044 int start_process_frame(VFrame *output, VFrame *input, int row_start, int row_end);
00045 int wait_process_frame();
00046 void run();
00047
00048 ColorBalanceMain *plugin;
00049 int row_start, row_end;
00050 int last_frame;
00051 Condition input_lock, output_lock;
00052 VFrame *input, *output;
00053 YUV yuv;
00054 float cyan_f, magenta_f, yellow_f;
00055 };
00056
00057 class ColorBalanceMain : public PluginVClient
00058 {
00059 public:
00060 ColorBalanceMain(PluginServer *server);
00061 ~ColorBalanceMain();
00062
00063
00064 int process_buffer(VFrame *frame,
00065 int64_t start_position,
00066 double frame_rate);
00067 int is_realtime();
00068 char* plugin_title();
00069 int show_gui();
00070 void update_gui();
00071 void raise_window();
00072 int set_string();
00073 int load_configuration();
00074 void save_data(KeyFrame *keyframe);
00075 void read_data(KeyFrame *keyframe);
00076 int load_defaults();
00077 int save_defaults();
00078 VFrame* new_picon();
00079 int handle_opengl();
00080
00081 void get_aggregation(int *aggregate_interpolate,
00082 int *aggregate_gamma);
00083
00084
00085 int64_t calculate_slider(float in);
00086 float calculate_transfer(float in);
00087
00088
00089 int reconfigure();
00090 int synchronize_params(ColorBalanceSlider *slider, float difference);
00091 int test_boundary(float &value);
00092
00093 ColorBalanceConfig config;
00094
00095 ColorBalanceThread *thread;
00096 ColorBalanceEngine **engine;
00097 int total_engines;
00098
00099
00100 BC_Hash *defaults;
00101 int r_lookup_8[0x100];
00102 int g_lookup_8[0x100];
00103 int b_lookup_8[0x100];
00104 int r_lookup_16[0x10000];
00105 int g_lookup_16[0x10000];
00106 int b_lookup_16[0x10000];
00107 int redo_buffers;
00108 int need_reconfigure;
00109 };
00110
00111
00112
00113 #endif