00001 #ifndef OVERLAYFRAME_H
00002 #define OVERLAYFRAME_H
00003
00004 #include "loadbalance.h"
00005 #include "overlayframe.inc"
00006 #include "vframe.inc"
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 typedef struct
00040 {
00041 int in_x1;
00042 int in_fraction1;
00043 int in_x2;
00044 int in_fraction2;
00045 int output_fraction;
00046 } transfer_table_i;
00047
00048 typedef struct
00049 {
00050 int in_x1;
00051 float in_fraction1;
00052 int in_x2;
00053 float in_fraction2;
00054 float output_fraction;
00055 } transfer_table_f;
00056
00057 typedef struct
00058 {
00059 int input_pixel1;
00060 int input_pixel2;
00061 float input_fraction1;
00062 float input_fraction2;
00063 float input_fraction3;
00064 float total_fraction;
00065 } bilinear_table_t;
00066
00067 class ScaleEngine;
00068
00069 class ScalePackage : public LoadPackage
00070 {
00071 public:
00072 ScalePackage();
00073
00074 int out_row1, out_row2;
00075 };
00076
00077 class ScaleUnit : public LoadClient
00078 {
00079 public:
00080 ScaleUnit(ScaleEngine *server, OverlayFrame *overlay);
00081 ~ScaleUnit();
00082
00083 float cubic_bspline(float x);
00084
00085 void tabulate_bcubic_f(float* &coef_table,
00086 int* &coord_table,
00087 float scale,
00088 float start,
00089 int pixels,
00090 int total_pixels,
00091 float coefficient);
00092 void tabulate_blinear_f(int* &table_int1,
00093 int* &table_int2,
00094 float* &table_frac,
00095 float* &table_antifrac,
00096 float scale,
00097 int pixel1,
00098 int pixel2,
00099 float start,
00100 int total_pixels);
00101
00102 void tabulate_bcubic_i(int* &coef_table,
00103 int* &coord_table,
00104 float scale,
00105 int start,
00106 int pixels,
00107 int total_pixels,
00108 float coefficient);
00109 void tabulate_blinear_i(int* &table_int1,
00110 int* &table_int2,
00111 int* &table_frac,
00112 int* &table_antifrac,
00113 float scale,
00114 int pixel1,
00115 int pixel2,
00116 float start,
00117 int total_pixels);
00118 void tabulate_reduction(bilinear_table_t* &table,
00119 float scale,
00120 int pixel1,
00121 int out_total,
00122 int in_total);
00123 void tabulate_enlarge(bilinear_table_t* &table,
00124 float scale,
00125 float pixel1,
00126 int out_total,
00127 int in_total);
00128 void dump_bilinear(bilinear_table_t *table, int total);
00129
00130 void process_package(LoadPackage *package);
00131
00132 OverlayFrame *overlay;
00133 ScaleEngine *engine;
00134 };
00135
00136 class ScaleEngine : public LoadServer
00137 {
00138 public:
00139 ScaleEngine(OverlayFrame *overlay, int cpus);
00140 ~ScaleEngine();
00141
00142 void init_packages();
00143 LoadClient* new_client();
00144 LoadPackage* new_package();
00145
00146 OverlayFrame *overlay;
00147
00148 VFrame *scale_output;
00149 VFrame *scale_input;
00150 float w_scale;
00151 float h_scale;
00152 float in_x1_float;
00153 float in_y1_float;
00154 int out_w_int;
00155 int out_h_int;
00156 int interpolation_type;
00157 };
00158
00159
00160
00161
00162
00163
00164
00165 class TranslateEngine;
00166
00167 class TranslatePackage : public LoadPackage
00168 {
00169 public:
00170 TranslatePackage();
00171
00172 int out_row1, out_row2;
00173 };
00174
00175
00176 class TranslateUnit : public LoadClient
00177 {
00178 public:
00179 TranslateUnit(TranslateEngine *server, OverlayFrame *overlay);
00180 ~TranslateUnit();
00181
00182 void process_package(LoadPackage *package);
00183 static void translation_array_f(transfer_table_f* &table,
00184 float out_x1,
00185 float out_x2,
00186 float in_x1,
00187 float in_x2,
00188 int in_total,
00189 int out_total,
00190 int &out_x1_int,
00191 int &out_x2_int);
00192 void translation_array_i(transfer_table_i* &table,
00193 float out_x1,
00194 float out_x2,
00195 float in_x1,
00196 float in_x2,
00197 int in_total,
00198 int out_total,
00199 int &out_x1_int,
00200 int &out_x2_int);
00201 void translate(VFrame *output,
00202 VFrame *input,
00203 float in_x1,
00204 float in_y1,
00205 float in_x2,
00206 float in_y2,
00207 float out_x1,
00208 float out_y1,
00209 float out_x2,
00210 float out_y2,
00211 float alpha,
00212 int mode,
00213 int row1,
00214 int row2);
00215
00216 OverlayFrame *overlay;
00217 TranslateEngine *engine;
00218 };
00219
00220 class TranslateEngine : public LoadServer
00221 {
00222 public:
00223 TranslateEngine(OverlayFrame *overlay, int cpus);
00224 ~TranslateEngine();
00225
00226 void init_packages();
00227 LoadClient* new_client();
00228 LoadPackage* new_package();
00229
00230 OverlayFrame *overlay;
00231
00232 VFrame *translate_output;
00233 VFrame *translate_input;
00234 float translate_in_x1;
00235 float translate_in_y1;
00236 float translate_in_x2;
00237 float translate_in_y2;
00238 float translate_out_x1;
00239 float translate_out_y1;
00240 float translate_out_x2;
00241 float translate_out_y2;
00242 float translate_alpha;
00243 int translate_mode;
00244 };
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254 class ScaleTranslateEngine;
00255
00256 class ScaleTranslatePackage : public LoadPackage
00257 {
00258 public:
00259 ScaleTranslatePackage();
00260
00261 int out_row1, out_row2;
00262 };
00263
00264
00265 class ScaleTranslateUnit : public LoadClient
00266 {
00267 public:
00268 ScaleTranslateUnit(ScaleTranslateEngine *server, OverlayFrame *overlay);
00269 ~ScaleTranslateUnit();
00270
00271 void process_package(LoadPackage *package);
00272 void scale_array_f(int* &table,
00273 int out_x1,
00274 int out_x2,
00275 float in_x1,
00276 float in_x2);
00277
00278 OverlayFrame *overlay;
00279 ScaleTranslateEngine *scale_translate;
00280 };
00281
00282 class ScaleTranslateEngine : public LoadServer
00283 {
00284 public:
00285 ScaleTranslateEngine(OverlayFrame *overlay, int cpus);
00286 ~ScaleTranslateEngine();
00287
00288 void init_packages();
00289 LoadClient* new_client();
00290 LoadPackage* new_package();
00291
00292 OverlayFrame *overlay;
00293
00294
00295
00296 VFrame *output;
00297 VFrame *input;
00298 float in_x1;
00299 float in_y1;
00300 float in_x2;
00301 float in_y2;
00302 int out_x1;
00303 int out_y1;
00304 int out_x2;
00305 int out_y2;
00306 float alpha;
00307 int mode;
00308 };
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324 class BlendEngine;
00325
00326 class BlendPackage : public LoadPackage
00327 {
00328 public:
00329 BlendPackage();
00330
00331 int out_row1, out_row2;
00332 };
00333
00334
00335 class BlendUnit : public LoadClient
00336 {
00337 public:
00338 BlendUnit(BlendEngine *server, OverlayFrame *overlay);
00339 ~BlendUnit();
00340
00341 void process_package(LoadPackage *package);
00342 void translation_array_f(transfer_table_f* &table,
00343 float out_x1,
00344 float out_x2,
00345 float in_x1,
00346 float in_x2,
00347 int in_total,
00348 int out_total,
00349 int &out_x1_int,
00350 int &out_x2_int);
00351 void translate(VFrame *output,
00352 VFrame *input,
00353 float in_x1,
00354 float in_y1,
00355 float in_x2,
00356 float in_y2,
00357 float out_x1,
00358 float out_y1,
00359 float out_x2,
00360 float out_y2,
00361 float alpha,
00362 int mode,
00363 int row1,
00364 int row2);
00365
00366 OverlayFrame *overlay;
00367 BlendEngine *blend_engine;
00368 };
00369
00370 class BlendEngine : public LoadServer
00371 {
00372 public:
00373 BlendEngine(OverlayFrame *overlay, int cpus);
00374 ~BlendEngine();
00375
00376 void init_packages();
00377 LoadClient* new_client();
00378 LoadPackage* new_package();
00379
00380 OverlayFrame *overlay;
00381
00382
00383
00384 VFrame *output;
00385 VFrame *input;
00386 float alpha;
00387 int mode;
00388 };
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402 class OverlayFrame
00403 {
00404 public:
00405 OverlayFrame(int cpus = 1);
00406 virtual ~OverlayFrame();
00407
00408
00409 int overlay(VFrame *output,
00410 VFrame *input,
00411 float in_x1,
00412 float in_y1,
00413 float in_x2,
00414 float in_y2,
00415 float out_x1,
00416 float out_y1,
00417 float out_x2,
00418 float out_y2,
00419 float alpha,
00420 int mode,
00421 int interpolation_type);
00422 int use_alpha, use_float, mode, interpolate;
00423 int color_model;
00424
00425 BlendEngine *blend_engine;
00426 ScaleEngine *scale_engine;
00427 TranslateEngine *translate_engine;
00428 ScaleTranslateEngine *scaletranslate_engine;
00429
00430
00431 VFrame *temp_frame;
00432 int cpus;
00433
00434 };
00435
00436 #endif