00001 #ifndef AFFINE_H
00002 #define AFFINE_H
00003
00004
00005 #include "affine.inc"
00006 #include "loadbalance.h"
00007 #include "vframe.inc"
00008
00009
00010
00011 #define AFFINE_OVERSAMPLE 2
00012
00013 class AffineMatrix
00014 {
00015 public:
00016 AffineMatrix();
00017 void identity();
00018 void translate(double x, double y);
00019 void scale(double x, double y);
00020
00021 void multiply(AffineMatrix *dst);
00022 void copy_from(AffineMatrix *src);
00023 void invert(AffineMatrix *dst);
00024 void transform_point(float x, float y, float *newx, float *newy);
00025 double determinant();
00026 void dump();
00027 double values[3][3];
00028 };
00029
00030 class AffinePackage : public LoadPackage
00031 {
00032 public:
00033 AffinePackage();
00034 int y1, y2;
00035 };
00036
00037 class AffineUnit : public LoadClient
00038 {
00039 public:
00040 AffineUnit(AffineEngine *server);
00041 void process_package(LoadPackage *package);
00042 void calculate_matrix(
00043 double in_x1,
00044 double in_y1,
00045 double in_x2,
00046 double in_y2,
00047 double out_x1,
00048 double out_y1,
00049 double out_x2,
00050 double out_y2,
00051 double out_x3,
00052 double out_y3,
00053 double out_x4,
00054 double out_y4,
00055 AffineMatrix *result);
00056 float transform_cubic(float dx,
00057 float jm1,
00058 float j,
00059 float jp1,
00060 float jp2);
00061 AffineEngine *server;
00062 };
00063
00064 class AffineEngine : public LoadServer
00065 {
00066 public:
00067 AffineEngine(int total_clients,
00068 int total_packages);
00069
00070
00071
00072
00073 void process(VFrame *output,
00074 VFrame *input,
00075 VFrame *temp,
00076 int mode,
00077 float x1,
00078 float y1,
00079 float x2,
00080 float y2,
00081 float x3,
00082 float y3,
00083 float x4,
00084 float y4,
00085 int forward);
00086
00087
00088 void rotate(VFrame *output,
00089 VFrame *input,
00090 float angle);
00091
00092
00093
00094 void set_viewport(int x, int y, int w, int h);
00095
00096 void set_pivot(int x, int y);
00097 void unset_pivot();
00098 void unset_viewport();
00099
00100 void set_opengl(int value);
00101 void init_packages();
00102 LoadClient* new_client();
00103 LoadPackage* new_package();
00104 VFrame *input, *output, *temp;
00105 int mode;
00106 enum
00107 {
00108 PERSPECTIVE,
00109 SHEER,
00110 STRETCH,
00111 ROTATE
00112 };
00113 float x1, y1, x2, y2, x3, y3, x4, y4;
00114 int x, y, w, h;
00115 int pivot_x, pivot_y;
00116 int user_pivot;
00117 int user_viewport;
00118 int forward;
00119 int use_opengl;
00120 };
00121
00122
00123
00124 #endif