Merge CV, ver=5.1; ops/methods from HV, and interface from CV where possible
[goodguy/history.git] / cinelerra-5.1 / cinelerra / overlayframe.h.int
diff --git a/cinelerra-5.1/cinelerra/overlayframe.h.int b/cinelerra-5.1/cinelerra/overlayframe.h.int
new file mode 100644 (file)
index 0000000..a851140
--- /dev/null
@@ -0,0 +1,352 @@
+#ifndef OVERLAYFRAME_H
+#define OVERLAYFRAME_H
+
+#include "loadbalance.h"
+#include "overlayframe.inc"
+#include "vframe.inc"
+
+
+
+// Translation
+
+typedef struct
+{
+       int in_x1;
+       float in_fraction1;
+       int in_x2;       // Might be same as in_x1 for boundary
+       float in_fraction2;
+       float output_fraction;
+} transfer_table;
+
+
+class ScaleEngine;
+
+class ScalePackage : public LoadPackage
+{
+public:
+       ScalePackage();
+
+       int out_row1, out_row2;
+};
+
+
+class ScaleUnit : public LoadClient
+{
+public:
+       ScaleUnit(ScaleEngine *server, OverlayFrame *overlay);
+       ~ScaleUnit();
+       
+       int cubic_bspline(float x);
+       void tabulate_bspline(int* &table, 
+               float scale,
+               int pixels,
+               float coefficient);
+       void tabulate_blinear(int* &table_int,
+               int* &table_frac,
+               float scale,
+               int pixel1,
+               int pixel2);
+
+       void process_package(LoadPackage *package);
+       
+       OverlayFrame *overlay;
+};
+
+class ScaleEngine : public LoadServer
+{
+public:
+       ScaleEngine(OverlayFrame *overlay, int cpus);
+       ~ScaleEngine();
+       
+       void init_packages();
+       LoadClient* new_client();
+       LoadPackage* new_package();
+       
+       OverlayFrame *overlay;
+};
+
+
+
+
+
+
+
+class TranslateEngine;
+
+class TranslatePackage : public LoadPackage
+{
+public:
+       TranslatePackage();
+
+       int out_row1, out_row2;
+};
+
+
+class TranslateUnit : public LoadClient
+{
+public:
+       TranslateUnit(TranslateEngine *server, OverlayFrame *overlay);
+       ~TranslateUnit();
+
+       void process_package(LoadPackage *package);
+       void translation_array(transfer_table* &table, 
+               float out_x1, 
+               float out_x2,
+               float in_x1,
+               float in_x2,
+               int in_total, 
+               int out_total, 
+               int &out_x1_int,
+               int &out_x2_int);
+       void translate(VFrame *output, 
+                       VFrame *input, 
+                       float in_x1,
+                       float in_y1,
+                       float in_x2,
+                       float in_y2,
+                       float out_x1,
+                       float out_y1,
+                       float out_x2,
+                       float out_y2,
+                       float alpha,
+                       int mode,
+                       int row1,
+                       int row2);
+
+       OverlayFrame *overlay;
+};
+
+class TranslateEngine : public LoadServer
+{
+public:
+       TranslateEngine(OverlayFrame *overlay, int cpus);
+       ~TranslateEngine();
+       
+       void init_packages();
+       LoadClient* new_client();
+       LoadPackage* new_package();
+       
+       OverlayFrame *overlay;
+};
+
+
+
+
+
+
+
+
+
+class ScaleTranslateEngine;
+
+class ScaleTranslatePackage : public LoadPackage
+{
+public:
+       ScaleTranslatePackage();
+
+       int out_row1, out_row2;
+};
+
+
+class ScaleTranslateUnit : public LoadClient
+{
+public:
+       ScaleTranslateUnit(ScaleTranslateEngine *server, OverlayFrame *overlay);
+       ~ScaleTranslateUnit();
+
+       void process_package(LoadPackage *package);
+       void scale_array(int* &table, 
+               int out_x1, 
+               int out_x2,
+               int in_x1,
+               int in_x2,
+               int is_x);
+       
+       OverlayFrame *overlay;
+       ScaleTranslateEngine *scale_translate;
+};
+
+class ScaleTranslateEngine : public LoadServer
+{
+public:
+       ScaleTranslateEngine(OverlayFrame *overlay, int cpus);
+       ~ScaleTranslateEngine();
+       
+       void init_packages();
+       LoadClient* new_client();
+       LoadPackage* new_package();
+       
+       OverlayFrame *overlay;
+       
+       
+// Arguments
+       VFrame *output;
+       VFrame *input;
+       int in_x1;
+       int in_y1;
+       int in_x2;
+       int in_y2;
+       int out_x1;
+       int out_y1;
+       int out_x2;
+       int out_y2;
+       float alpha;
+       int mode;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+class BlendEngine;
+
+class BlendPackage : public LoadPackage
+{
+public:
+       BlendPackage();
+
+       int out_row1, out_row2;
+};
+
+
+class BlendUnit : public LoadClient
+{
+public:
+       BlendUnit(BlendEngine *server, OverlayFrame *overlay);
+       ~BlendUnit();
+
+       void process_package(LoadPackage *package);
+       void translation_array(transfer_table* &table, 
+               float out_x1, 
+               float out_x2,
+               float in_x1,
+               float in_x2,
+               int in_total, 
+               int out_total, 
+               int &out_x1_int,
+               int &out_x2_int);
+       void translate(VFrame *output, 
+                       VFrame *input, 
+                       float in_x1,
+                       float in_y1,
+                       float in_x2,
+                       float in_y2,
+                       float out_x1,
+                       float out_y1,
+                       float out_x2,
+                       float out_y2,
+                       float alpha,
+                       int mode,
+                       int row1,
+                       int row2);
+
+       OverlayFrame *overlay;
+       BlendEngine *blend_engine;
+};
+
+class BlendEngine : public LoadServer
+{
+public:
+       BlendEngine(OverlayFrame *overlay, int cpus);
+       ~BlendEngine();
+       
+       void init_packages();
+       LoadClient* new_client();
+       LoadPackage* new_package();
+       
+       OverlayFrame *overlay;
+       
+       
+// Arguments
+       VFrame *output;
+       VFrame *input;
+       float alpha;
+       int mode;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+class OverlayFrame
+{
+public:
+       OverlayFrame(int cpus = 1);
+       virtual ~OverlayFrame();
+
+// Alpha is from 0 - 1
+       int overlay(VFrame *output, 
+               VFrame *input, 
+               float in_x1, 
+               float in_y1, 
+               float in_x2, 
+               float in_y2, 
+               float out_x1, 
+               float out_y1, 
+               float out_x2, 
+               float out_y2, 
+               float alpha, 
+               int mode,
+               int interpolation_type);
+
+       int overlay(VFrame *output, unsigned char *input,
+               float in_x1, float in_y1, float in_x2, float in_y2,
+               float out_x1, float out_y1, float out_x2, float out_y2, 
+               int alpha, int in_w, int in_h);
+       int use_alpha, use_float, mode, interpolate;
+       int color_model;
+
+       BlendEngine *blend_engine;
+       ScaleEngine *scale_engine;
+       TranslateEngine *translate_engine;
+       ScaleTranslateEngine *scaletranslate_engine;
+
+
+       VFrame *temp_frame;
+       int cpus;
+
+// TODO: These should all be in their respective Engine
+// Global parameters for scaling units
+       VFrame *scale_output;
+       VFrame *scale_input;
+       float w_scale;
+       float h_scale;
+       int in_x1_int;
+       int in_y1_int;
+       int out_w_int;
+       int out_h_int;
+       int interpolation_type;
+// Global parameters for translate units
+       VFrame *translate_output;
+       VFrame *translate_input;
+       float translate_in_x1;
+       float translate_in_y1;
+       float translate_in_x2;
+       float translate_in_y2;
+       float translate_out_x1;
+       float translate_out_y1;
+       float translate_out_x2;
+       float translate_out_y2;
+       float translate_alpha;
+       int translate_mode;
+};
+
+#endif