X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fxfer.C;h=87ad6bdd5b619971865f53a14f8a7b2b552722fc;hb=1f78d86b5532943b2a3ea51f409a1fe5bd961e02;hp=c689b6b6a8b4cf3be0f7085d8b726626001cc5df;hpb=aafa1fc4eb3303966eedeb0e503c1f0dadac8f70;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/xfer.C b/cinelerra-5.1/guicast/xfer.C index c689b6b6..87ad6bdd 100644 --- a/cinelerra-5.1/guicast/xfer.C +++ b/cinelerra-5.1/guicast/xfer.C @@ -245,9 +245,9 @@ void BC_CModels::transfer( // specialized functions // in bccmdl.py: specialize("bc_rgba8888", "bc_transparency", "XFER_rgba8888_to_transparency") -void BC_Xfer::XFER_rgba8888_to_transparency() +void BC_Xfer::XFER_rgba8888_to_transparency(unsigned y0, unsigned y1) { - for( unsigned i=0; ilock("BC_Xfer::SlicerList::get_slicer"); + } + Slicer *slicer = first; + remove_pointer(slicer); + return slicer; +} + +void BC_Xfer::xfer_slices(int slices) +{ + if( !xfn ) return; + int max_slices = BC_Resources::machine_cpus/2+1; + if( slices > max_slices ) slices = max_slices; + Slicer *active[slices]; + unsigned y0 = 0, y1 = out_h; + int slices1 = slices-1; + if( slices1 > 0 ) { + slicers.lock("BC_Xfer::xfer_slices"); + for( int i=0; islice(this, y0, y1); + } + slicers.unlock(); + } + (this->*xfn)(y0, out_h); + if( slices1 > 0 ) { + for( int i=0; icomplete->lock("BC_Xfer::xfer_slices"); + slicers.lock("BC_Xfer::xfer_slices"); + for( int i=0; iunlock(); + } +} + +BC_Xfer::Slicer::Slicer(BC_Xfer *xp) +{ + this->xp = xp; + init = new Condition(0, "BC_Xfer::Slicer::init", 0); + complete = new Condition(0, "BC_Xfer::Slicer::complete", 0); + done = 0; + start(); +} +BC_Xfer::Slicer::~Slicer() +{ + done = 1; + init->unlock(); + join(); +} + +void BC_Xfer::Slicer::slice(BC_Xfer *xp, unsigned y0, unsigned y1) +{ + this->xp = xp; + this->y0 = y0; + this->y1 = y1; + init->unlock(); +} + +void BC_Xfer::Slicer::run() +{ + while( !done ) { + init->lock("Slicer::run"); + if( done ) break; + xfer_fn xfn = xp->xfn; + (xp->*xfn)(y0, y1); + complete->unlock(); + } +} + +void BC_CModels::bcxfer_stop_slicers() +{ + BC_Xfer::slicers.reset(); +} +