Exemplo n.º 1
0
 void
 LocalFileFormat::BuildFileOps(OpRcPtrVec & ops,
                               const Config& /*config*/,
                               const ConstContextRcPtr & /*context*/,
                               CachedFileRcPtr untypedCachedFile,
                               const FileTransform& fileTransform,
                               TransformDirection dir) const
 {
     LocalCachedFileRcPtr cachedFile = DynamicPtrCast<LocalCachedFile>(untypedCachedFile);
     
     // This should never happen.
     if(!cachedFile)
     {
         std::ostringstream os;
         os << "Cannot build .3dl Op. Invalid cache type.";
         throw Exception(os.str().c_str());
     }
     
     TransformDirection newDir = CombineTransformDirections(dir,
         fileTransform.getDirection());
     if(newDir == TRANSFORM_DIR_UNKNOWN)
     {
         std::ostringstream os;
         os << "Cannot build file format transform,";
         os << " unspecified transform direction.";
         throw Exception(os.str().c_str());
     }
     
     // TODO: INTERP_LINEAR should not be hard-coded.
     // Instead query 'highest' interpolation?
     // (right now, it's linear). If cubic is added, consider
     // using it
     
     if(newDir == TRANSFORM_DIR_FORWARD)
     {
         if(cachedFile->has1D)
         {
             CreateLut1DOp(ops, cachedFile->lut1D,
                           INTERP_LINEAR, newDir);
         }
         if(cachedFile->has3D)
         {
             CreateLut3DOp(ops, cachedFile->lut3D,
                           fileTransform.getInterpolation(), newDir);
         }
     }
     else if(newDir == TRANSFORM_DIR_INVERSE)
     {
         if(cachedFile->has3D)
         {
             CreateLut3DOp(ops, cachedFile->lut3D,
                           fileTransform.getInterpolation(), newDir);
         }
         if(cachedFile->has1D)
         {
             CreateLut1DOp(ops, cachedFile->lut1D,
                           INTERP_LINEAR, newDir);
         }
     }
 }
Exemplo n.º 2
0
        void LocalFileFormat::BuildFileOps(OpRcPtrVec & ops,
                                  const Config& /*config*/,
                                  const ConstContextRcPtr & /*context*/,
                                  CachedFileRcPtr untypedCachedFile,
                                  const FileTransform& fileTransform,
                                  TransformDirection dir) const
        {
            LocalCachedFileRcPtr cachedFile = DynamicPtrCast<LocalCachedFile>(untypedCachedFile);

            if(!cachedFile) // This should never happen.
            {
                std::ostringstream os;
                os << "Cannot build Spi1D Op. Invalid cache type.";
                throw Exception(os.str().c_str());
            }

            TransformDirection newDir = CombineTransformDirections(dir,
                fileTransform.getDirection());

            CreateLut1DOp(ops,
                          cachedFile->lut,
                          fileTransform.getInterpolation(),
                          newDir);
        }