void Processor::Impl::addTransform(const Config & config, const ConstContextRcPtr & context, const ConstTransformRcPtr& transform, TransformDirection direction) { BuildOps(m_cpuOps, config, context, transform, direction); }
ConstProcessorRcPtr Config::getProcessor(const ConstTransformRcPtr& transform, TransformDirection direction) const { LocalProcessorRcPtr processor = LocalProcessor::Create(); BuildOps(*processor, *this, transform, direction); processor->finalizeOps(); return processor; }
void BuildColorSpaceOps(OpRcPtrVec & ops, const Config & config, const ConstContextRcPtr & context, const ConstColorSpaceRcPtr & srcColorSpace, const ConstColorSpaceRcPtr & dstColorSpace) { if(!srcColorSpace) throw Exception("BuildColorSpaceOps failed, null srcColorSpace."); if(!dstColorSpace) throw Exception("BuildColorSpaceOps failed, null dstColorSpace."); if(AreColorSpacesInSameEqualityGroup(srcColorSpace, dstColorSpace)) return; if(dstColorSpace->isData() || srcColorSpace->isData()) return; // Consider dt8 -> vd8? // One would have to explode the srcColorSpace->getTransform(COLORSPACE_DIR_TO_REFERENCE); // result, and walk through it step by step. If the dstColorspace family were // ever encountered in transit, we'd want to short circuit the result. AllocationData srcAllocation; srcAllocation.allocation = srcColorSpace->getAllocation(); srcAllocation.vars.resize( srcColorSpace->getAllocationNumVars()); if(srcAllocation.vars.size() > 0) { srcColorSpace->getAllocationVars(&srcAllocation.vars[0]); } CreateGpuAllocationNoOp(ops, srcAllocation); // Go to the reference space, either by using // * cs->ref in the forward direction // * ref->cs in the inverse direction if(srcColorSpace->getTransform(COLORSPACE_DIR_TO_REFERENCE)) { BuildOps(ops, config, context, srcColorSpace->getTransform(COLORSPACE_DIR_TO_REFERENCE), TRANSFORM_DIR_FORWARD); } else if(srcColorSpace->getTransform(COLORSPACE_DIR_FROM_REFERENCE)) { BuildOps(ops, config, context, srcColorSpace->getTransform(COLORSPACE_DIR_FROM_REFERENCE), TRANSFORM_DIR_INVERSE); } // Otherwise, both are not defined so its a no-op. This is not an error condition. // Go from the reference space, either by using // * ref->cs in the forward direction // * cs->ref in the inverse direction if(dstColorSpace->getTransform(COLORSPACE_DIR_FROM_REFERENCE)) { BuildOps(ops, config, context, dstColorSpace->getTransform(COLORSPACE_DIR_FROM_REFERENCE), TRANSFORM_DIR_FORWARD); } else if(dstColorSpace->getTransform(COLORSPACE_DIR_TO_REFERENCE)) { BuildOps(ops, config, context, dstColorSpace->getTransform(COLORSPACE_DIR_TO_REFERENCE), TRANSFORM_DIR_INVERSE); } // Otherwise, both are not defined so its a no-op. This is not an error condition. AllocationData dstAllocation; dstAllocation.allocation = dstColorSpace->getAllocation(); dstAllocation.vars.resize( dstColorSpace->getAllocationNumVars()); if(dstAllocation.vars.size() > 0) { dstColorSpace->getAllocationVars(&dstAllocation.vars[0]); } CreateGpuAllocationNoOp(ops, dstAllocation); }