1 #include "overlayframe.h"
2 #include "overlaydirect.h"
4 /* Direct translate / blend **********************************************/
6 DirectPackage::DirectPackage()
10 DirectUnit::DirectUnit(DirectEngine *server)
13 this->engine = server;
16 DirectUnit::~DirectUnit()
20 void DirectUnit::process_package(LoadPackage *package)
22 pkg = (DirectPackage*)package;
23 output = engine->output;
24 input = engine->input;
26 fade = BC_CModels::has_alpha(input->get_color_model()) &&
27 mode == TRANSFER_REPLACE ? 1.f : engine->alpha;
30 ow = engine->out_x2 - ox;
31 iy = engine->in_y1 - engine->out_y1;
33 switch(input->get_color_model()) {
34 case BC_RGB_FLOAT: rgb_float(); break;
35 case BC_RGBA_FLOAT: rgba_float(); break;
36 case BC_RGB888: rgb888(); break;
37 case BC_YUV888: yuv888(); break;
38 case BC_RGBA8888: rgba8888(); break;
39 case BC_YUVA8888: yuva8888(); break;
40 case BC_RGB161616: rgb161616(); break;
41 case BC_YUV161616: yuv161616(); break;
42 case BC_RGBA16161616: rgba16161616(); break;
43 case BC_YUVA16161616: yuva16161616(); break;
47 DirectEngine::DirectEngine(int cpus)
48 : LoadServer(cpus, cpus)
52 DirectEngine::~DirectEngine()
56 void DirectEngine::init_packages()
58 if(in_x1 < 0) { out_x1 -= in_x1; in_x1 = 0; }
59 if(in_y1 < 0) { out_y1 -= in_y1; in_y1 = 0; }
60 if(out_x1 < 0) { in_x1 -= out_x1; out_x1 = 0; }
61 if(out_y1 < 0) { in_y1 -= out_y1; out_y1 = 0; }
62 if(out_x2 > output->get_w()) out_x2 = output->get_w();
63 if(out_y2 > output->get_h()) out_y2 = output->get_h();
64 int out_w = out_x2 - out_x1;
65 int out_h = out_y2 - out_y1;
66 if( !out_w || !out_h ) return;
69 int pkgs = get_total_packages();
70 int row1 = out_y1, row2 = row1;
71 for(int i = 0; i < pkgs; row1=row2 ) {
72 DirectPackage *package = (DirectPackage*)get_package(i);
73 row2 = ++i * rows / pkgs + out_y1;
74 package->out_row1 = row1;
75 package->out_row2 = row2;
79 LoadClient* DirectEngine::new_client()
81 return new DirectUnit(this);
84 LoadPackage* DirectEngine::new_package()
86 return new DirectPackage;