-HistStripePackage::HistStripePackage()
- : LoadPackage()
-{
-}
-
-HistStripeUnit::HistStripeUnit(HistStripeEngine *server, HistogramMain *plugin)
- : LoadClient(server)
-{
- this->plugin = plugin;
- this->server = server;
-}
-
-void HistStripeUnit::process_package(LoadPackage *package)
-{
- HistStripePackage *pkg = (HistStripePackage*)package;
- int frames = plugin->config.frames;
- float scale = 1. / frames;
- int iy0 = pkg->y0, iy1 = pkg->y1;
- int fw = plugin->fframe->get_w();
- uint8_t **frows = plugin->fframe->get_rows();
- uint8_t **trows = plugin->temp->get_rows();
- switch( server->operation ) {
- case ADD_TEMP: // add temp to fframe
- for( int iy=iy0; iy<iy1; ++iy ) {
- float *trow = (float *)trows[iy];
- float *frow = (float *)frows[iy];
- for( int ix=0; ix<fw; ++ix ) {
- *frow++ += *trow++;
- *frow++ += *trow++;
- *frow++ += *trow++;
- }
- }
- break;
- case ADD_FFRM: // add fframe to scaled temp
- for( int iy=iy0; iy<iy1; ++iy ) {
- float *trow = (float *)trows[iy];
- float *frow = (float *)frows[iy];
- for( int ix=0; ix<fw; ++ix ) {
- *trow = *trow * scale + *frow++; ++trow;
- *trow = *trow * scale + *frow++; ++trow;
- *trow = *trow * scale + *frow++; ++trow;
- }
- }
- break;
- case ADD_FFRMS: // add fframe to temp, scale temp, scale fframe
- for( int iy=iy0; iy<iy1; ++iy ) {
- float *trow = (float *)trows[iy];
- float *frow = (float *)frows[iy];
- for( int ix=0; ix<fw; ++ix ) {
- *trow += *frow; *trow++ *= scale; *frow++ *= scale;
- *trow += *frow; *trow++ *= scale; *frow++ *= scale;
- *trow += *frow; *trow++ *= scale; *frow++ *= scale;
- }
- }
- break;
- case ADD_TEMPS: // add scaled temp to fframe
- for( int iy=iy0; iy<iy1; ++iy ) {
- float *trow = (float *)trows[iy];
- float *frow = (float *)frows[iy];
- for( int ix=0; ix<fw; ++ix ) {
- *frow++ += *trow++ * scale;
- *frow++ += *trow++ * scale;
- *frow++ += *trow++ * scale;
- }
- }
- break;
- case SUB_TEMPS: // sub scaled temp from frame
- for( int iy=iy0; iy<iy1; ++iy ) {
- float *trow = (float *)trows[iy];
- float *frow = (float *)frows[iy];
- for( int ix=0; ix<fw; ++ix ) {
- *frow++ -= *trow++ * scale;
- *frow++ -= *trow++ * scale;
- *frow++ -= *trow++ * scale;
- }
- }
- break;
- }
-}
-
-HistStripeEngine::HistStripeEngine(HistogramMain *plugin,
- int total_clients, int total_packages)
- : LoadServer(total_clients, total_packages)
-{
- this->plugin = plugin;
-}
-void HistStripeEngine::init_packages()
-{
- int ih = plugin->input->get_h(), iy0 = 0;
- for( int i=0,n=get_total_packages(); i<n; ) {
- HistStripePackage *pkg = (HistStripePackage*)get_package(i);
- int iy1 = (ih * ++i) / n;
- pkg->y0 = iy0; pkg->y1 = iy1;
- iy0 = iy1;
- }
-}
-
-LoadClient* HistStripeEngine::new_client()
-{
- return new HistStripeUnit(this, plugin);
-}
-
-LoadPackage* HistStripeEngine::new_package()
-{
- return new HistStripePackage();
-}
-
-void HistStripeEngine::process_packages(int operation)
-{
- this->operation = operation;
- LoadServer::process_packages();
-}
-
-
-