Commit 52d850a3 authored by Brian Barran's avatar Brian Barran
Browse files

added compression options to SEGYImport; modified core to support passing...

added compression options to SEGYImport; modified core to support passing these options; updated python bindings for the options
parent 03837943
Pipeline #12080 failed with stages
in 1 minute and 7 seconds
......@@ -60,7 +60,7 @@ inline OpenVDS::VDS *generateSimpleInMemory3DVDS(int32_t samplesX = 100, int32_t
OpenVDS::InMemoryOpenOptions options;
OpenVDS::MetadataContainer metadataContainer;
OpenVDS::Error error;
return OpenVDS::Create(options, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, error);
return OpenVDS::Create(options, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, OpenVDS::CompressionMethod::None, 0.0f, error);
}
inline void fill3DVDSWithNoise(OpenVDS::VDS *vds, int32_t channel = 0, const OpenVDS::FloatVector3 &frequency = OpenVDS::FloatVector3(0.6f, 2.f, 4.f))
......
......@@ -208,10 +208,10 @@ PyGlobal::initModule(py::module& m)
m.def("open" , static_cast<native::VDSHandle(*)(native::StringWrapper, native::Error &)>(&Open), py::arg("url").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Open_2));
m.def("open" , static_cast<native::VDSHandle(*)(const native::OpenOptions &, native::Error &)>(&Open), py::arg("options").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Open_3));
m.def("open" , static_cast<native::VDSHandle(*)(native::IOManager *, native::Error &)>(&Open), py::arg("ioManager").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Open_4));
m.def("create" , static_cast<native::VDSHandle(*)(native::StringWrapper, native::StringWrapper, const native::VolumeDataLayoutDescriptor &, VectorWrapper<native::VolumeDataAxisDescriptor>, VectorWrapper<native::VolumeDataChannelDescriptor>, const native::MetadataReadAccess &, native::Error &)>(&Create), py::arg("url").none(false), py::arg("connectionString").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create));
m.def("create" , static_cast<native::VDSHandle(*)(native::StringWrapper, const native::VolumeDataLayoutDescriptor &, VectorWrapper<native::VolumeDataAxisDescriptor>, VectorWrapper<native::VolumeDataChannelDescriptor>, const native::MetadataReadAccess &, native::Error &)>(&Create), py::arg("url").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create_2));
m.def("create" , static_cast<native::VDSHandle(*)(const native::OpenOptions &, const native::VolumeDataLayoutDescriptor &, VectorWrapper<native::VolumeDataAxisDescriptor>, VectorWrapper<native::VolumeDataChannelDescriptor>, const native::MetadataReadAccess &, native::Error &)>(&Create), py::arg("options").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create_3));
m.def("create" , static_cast<native::VDSHandle(*)(native::IOManager *, const native::VolumeDataLayoutDescriptor &, VectorWrapper<native::VolumeDataAxisDescriptor>, VectorWrapper<native::VolumeDataChannelDescriptor>, const native::MetadataReadAccess &, native::Error &)>(&Create), py::arg("ioManager").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create_4));
m.def("create" , static_cast<native::VDSHandle(*)(native::StringWrapper, native::StringWrapper, const native::VolumeDataLayoutDescriptor &, VectorWrapper<native::VolumeDataAxisDescriptor>, VectorWrapper<native::VolumeDataChannelDescriptor>, const native::MetadataReadAccess &, native::CompressionMethod, float, native::Error &)>(&Create), py::arg("url").none(false), py::arg("connectionString").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("compressionMethod").none(false), py::arg("compressionTolerance").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create));
m.def("create" , static_cast<native::VDSHandle(*)(native::StringWrapper, const native::VolumeDataLayoutDescriptor &, VectorWrapper<native::VolumeDataAxisDescriptor>, VectorWrapper<native::VolumeDataChannelDescriptor>, const native::MetadataReadAccess &, native::CompressionMethod, float, native::Error &)>(&Create), py::arg("url").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("compressionMethod").none(false), py::arg("compressionTolerance").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create_2));
m.def("create" , static_cast<native::VDSHandle(*)(const native::OpenOptions &, const native::VolumeDataLayoutDescriptor &, VectorWrapper<native::VolumeDataAxisDescriptor>, VectorWrapper<native::VolumeDataChannelDescriptor>, const native::MetadataReadAccess &, native::CompressionMethod, float, native::Error &)>(&Create), py::arg("options").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("compressionMethod").none(false), py::arg("compressionTolerance").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create_3));
m.def("create" , static_cast<native::VDSHandle(*)(native::IOManager *, const native::VolumeDataLayoutDescriptor &, VectorWrapper<native::VolumeDataAxisDescriptor>, VectorWrapper<native::VolumeDataChannelDescriptor>, const native::MetadataReadAccess &, native::CompressionMethod, float, native::Error &)>(&Create), py::arg("ioManager").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("compressionMethod").none(false), py::arg("compressionTolerance").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create_4));
m.def("getLayout" , static_cast<native::VolumeDataLayout *(*)(native::VDSHandle)>(&GetLayout), py::arg("handle").none(false), OPENVDS_DOCSTRING(GetLayout));
m.def("getAccessManager" , static_cast<native::VolumeDataAccessManager *(*)(native::VDSHandle)>(&GetAccessManager), py::arg("handle").none(false), OPENVDS_DOCSTRING(GetAccessManager));
m.def("close" , static_cast<void(*)(native::VDSHandle)>(&Close), py::arg("handle").none(false), OPENVDS_DOCSTRING(Close));
......@@ -287,54 +287,54 @@ PyGlobal::initModule(py::module& m)
}
return handle;
}, py::arg("ioManager").none(false), OPENVDS_DOCSTRING(Open_4));
m.def("create" , [](const std::string &url, const std::string &connectionString, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata, native::Error &error)
m.def("create" , [](const std::string &url, const std::string &connectionString, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata, native::CompressionMethod compressionMethod, float compressionTolerance, native::Error &error)
{
return native::Create(url, connectionString, layout , axisdesc, channeldesc, metadata, error);
}, py::arg("url").none(false), py::arg("connectionString").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create));
m.def("create" , [](const std::string &url, const std::string &connectionString, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata)
return native::Create(url, connectionString, layout , axisdesc, channeldesc, metadata, compressionMethod, compressionTolerance, error);
}, py::arg("url").none(false), py::arg("connectionString").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("compressionMethod").none(false), py::arg("compressionTolerance").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create));
m.def("create" , [](const std::string &url, const std::string &connectionString, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata, native::CompressionMethod compressionMethod, float compressionTolerance)
{
native::Error err;
auto handle = native::Create(url, connectionString, layout , axisdesc, channeldesc, metadata, err);
auto handle = native::Create(url, connectionString, layout , axisdesc, channeldesc, metadata, compressionMethod, compressionTolerance, err);
if (err.code)
{
throw std::runtime_error(err.string);
}
return handle;
}, py::arg("url").none(false), py::arg("connectionString").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), OPENVDS_DOCSTRING(Create));
m.def("create" , [](const std::string &url, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata, native::Error &error)
}, py::arg("url").none(false), py::arg("connectionString").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("compressionMethod").none(false), py::arg("compressionTolerance").none(false), OPENVDS_DOCSTRING(Create));
m.def("create" , [](const std::string &url, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata, native::CompressionMethod compressionMethod, float compressionTolerance, native::Error &error)
{
return native::Create(url, layout , axisdesc, channeldesc, metadata, error);
}, py::arg("url").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create_2));
m.def("create" , [](const std::string &url, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata)
return native::Create(url, layout , axisdesc, channeldesc, metadata, compressionMethod, compressionTolerance, error);
}, py::arg("url").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("compressionMethod").none(false), py::arg("compressionTolerance").none(false), py::arg("error").none(false), OPENVDS_DOCSTRING(Create_2));
m.def("create" , [](const std::string &url, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata, native::CompressionMethod compressionMethod, float compressionTolerance)
{
native::Error err;
auto handle = native::Create(url, layout , axisdesc, channeldesc, metadata, err);
auto handle = native::Create(url, layout , axisdesc, channeldesc, metadata, compressionMethod, compressionTolerance, err);
if (err.code)
{
throw std::runtime_error(err.string);
}
return handle;
}, py::arg("url").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), OPENVDS_DOCSTRING(Create_2));
m.def("create" , [](const native::OpenOptions &opt, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata)
}, py::arg("url").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("compressionMethod").none(false), py::arg("compressionTolerance").none(false), OPENVDS_DOCSTRING(Create_2));
m.def("create" , [](const native::OpenOptions &opt, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata, native::CompressionMethod compressionMethod, float compressionTolerance)
{
native::Error err;
auto handle = native::Create(opt, layout , axisdesc, channeldesc, metadata, err);
auto handle = native::Create(opt, layout , axisdesc, channeldesc, metadata, compressionMethod, compressionTolerance, err);
if (err.code)
{
throw std::runtime_error(err.string);
}
return handle;
}, py::arg("options").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), OPENVDS_DOCSTRING(Create_3));
m.def("create" , [](native::IOManager *mgr, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata)
}, py::arg("options").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("compressionMethod").none(false), py::arg("compressionTolerance").none(false), OPENVDS_DOCSTRING(Create_3));
m.def("create" , [](native::IOManager *mgr, const native::VolumeDataLayoutDescriptor &layout, std::vector<native::VolumeDataAxisDescriptor> axisdesc, std::vector<native::VolumeDataChannelDescriptor> channeldesc, const native::MetadataReadAccess &metadata, native::CompressionMethod compressionMethod, float compressionTolerance)
{
native::Error err;
auto handle = native::Create(mgr, layout , axisdesc, channeldesc, metadata, err);
auto handle = native::Create(mgr, layout , axisdesc, channeldesc, metadata, compressionMethod, compressionTolerance, err);
if (err.code)
{
throw std::runtime_error(err.string);
}
return handle;
}, py::arg("ioManager").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), OPENVDS_DOCSTRING(Create_4));
}, py::arg("ioManager").none(false), py::arg("layoutDescriptor").none(false), py::arg("axisDescriptors").none(false), py::arg("channelDescriptors").none(false), py::arg("metadata").none(false), py::arg("compressionMethod").none(false), py::arg("compressionTolerance").none(false), OPENVDS_DOCSTRING(Create_4));
// IMPLEMENTED : AWSOpenOptions_.def(py::init<const std::string &, const std::string &, const std::string &, const std::string &>(), py::arg("bucket").none(false), py::arg("key").none(false), py::arg("region").none(false), py::arg("endpointOverride").none(false), OPENVDS_DOCSTRING(AWSOpenOptions_AWSOpenOptions_2));
AWSOpenOptions_.def(py::init<const std::string &, const std::string &, const std::string &, const std::string &>(), py::arg("bucket").none(false), py::arg("key").none(false), py::arg("region").none(false) = "", py::arg("endpointOverride").none(false) = "", OPENVDS_DOCSTRING(AWSOpenOptions_AWSOpenOptions_2));
......
......@@ -321,7 +321,7 @@ VDSHandle Open(StringWrapper url, StringWrapper connectionString, Error& error)
return Open(*(openOptions.get()), error);
}
static bool Init(VDS *vds, VolumeDataStore *volumeDataStore, Error& error)
static bool Init(VDS *vds, VolumeDataStore *volumeDataStore, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance, Error& error)
{
vds->produceStatuses.clear();
vds->produceStatuses.resize(int(Dimensions_45) + 1, VolumeDataLayer::ProduceStatus_Unavailable);
......@@ -337,7 +337,7 @@ static bool Init(VDS *vds, VolumeDataStore *volumeDataStore, Error& error)
{
return false;
}
CreateVolumeDataLayout(*vds);
CreateVolumeDataLayout(*vds, compressionMethod, compressionTolerance);
vds->accessManager.reset(new VolumeDataAccessManagerImpl(*vds));
return true;
......@@ -348,7 +348,7 @@ VDSHandle Open(IOManager *ioManager, Error& error)
std::unique_ptr<VDS> ret(new VDS());
error = Error();
if(Init(ret.get(), new VolumeDataStoreIOManager(*ret, ioManager), error))
if(Init(ret.get(), new VolumeDataStoreIOManager(*ret, ioManager), OpenVDS::CompressionMethod::None, 0.0f, error))
{
return ret.release();
}
......@@ -380,7 +380,7 @@ VDS *Open(const OpenOptions &options, Error &error)
return nullptr;
}
if(Init(ret.get(), volumeDataStore.release(), error))
if(Init(ret.get(), volumeDataStore.release(), OpenVDS::CompressionMethod::None, 0.0f, error))
{
return ret.release();
}
......@@ -434,7 +434,7 @@ std::string GetLayerName(VolumeDataLayer const &volumeDataLayer)
}
}
void CreateVolumeDataLayout(VDS &vds)
void CreateVolumeDataLayout(VDS &vds, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance)
{
int32_t dimensionality = int32_t(vds.axisDescriptors.size());
......@@ -457,8 +457,8 @@ void CreateVolumeDataLayout(VDS &vds)
actualValueRangeChannel,
actualValueRange,
VolumeDataHash::GetUniqueHash(),
CompressionMethod::BitcompLossyToSigned,
0.001,
compressionMethod,
compressionTolerance,
false,
0));
......@@ -497,7 +497,7 @@ static void copyMetadataToContainer(MetadataContainer &container, const Metadata
}
}
static bool Init(VDS *vds, VolumeDataStore* volumeDataStore, VolumeDataLayoutDescriptor const &layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const &metadata, Error &error)
static bool Init(VDS *vds, VolumeDataStore* volumeDataStore, VolumeDataLayoutDescriptor const &layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const &metadata, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance, Error &error)
{
vds->produceStatuses.clear();
vds->produceStatuses.resize(int(Dimensions_45) + 1, VolumeDataLayer::ProduceStatus_Unavailable);
......@@ -536,7 +536,7 @@ static bool Init(VDS *vds, VolumeDataStore* volumeDataStore, VolumeDataLayoutDes
copyMetadataToContainer(vds->metadataContainer, metadata);
CreateVolumeDataLayout(*vds);
CreateVolumeDataLayout(*vds, compressionMethod, compressionTolerance);
vds->produceStatuses.clear();
vds->produceStatuses.resize(int(Dimensions_45) + 1, VolumeDataLayer::ProduceStatus_Unavailable);
......@@ -548,12 +548,12 @@ static bool Init(VDS *vds, VolumeDataStore* volumeDataStore, VolumeDataLayoutDes
return true;
}
VDSHandle Create(IOManager *ioManager, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, Error& error)
VDSHandle Create(IOManager *ioManager, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance, Error& error)
{
std::unique_ptr<VDS> ret(new VDS());
error = Error();
if(Init(ret.get(), new VolumeDataStoreIOManager(*ret, ioManager), layoutDescriptor, axisDescriptors, channelDescriptors, metadata, error))
if(Init(ret.get(), new VolumeDataStoreIOManager(*ret, ioManager), layoutDescriptor, axisDescriptors, channelDescriptors, metadata, compressionMethod, compressionTolerance, error))
{
return ret.release();
}
......@@ -563,16 +563,16 @@ VDSHandle Create(IOManager *ioManager, VolumeDataLayoutDescriptor const& layoutD
}
}
VDSHandle Create(StringWrapper url, StringWrapper connectionString, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, Error& error)
VDSHandle Create(StringWrapper url, StringWrapper connectionString, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance, Error& error)
{
std::unique_ptr<OpenOptions> openOptions(CreateOpenOptions(url, connectionString, error));
if (error.code || !openOptions)
return nullptr;
return Create(*openOptions, layoutDescriptor, axisDescriptors, channelDescriptors, metadata, error);
return Create(*openOptions, layoutDescriptor, axisDescriptors, channelDescriptors, metadata, compressionMethod, compressionTolerance, error);
}
VDSHandle Create(const OpenOptions& options, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, Error& error)
VDSHandle Create(const OpenOptions& options, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance, Error& error)
{
std::unique_ptr<VDS> ret(new VDS());
std::unique_ptr<VolumeDataStore> volumeDataStore;
......@@ -594,7 +594,7 @@ VDSHandle Create(const OpenOptions& options, VolumeDataLayoutDescriptor const& l
return nullptr;
}
if(Init(ret.get(), volumeDataStore.release(), layoutDescriptor, axisDescriptors, channelDescriptors, metadata, error))
if(Init(ret.get(), volumeDataStore.release(), layoutDescriptor, axisDescriptors, channelDescriptors, metadata, compressionMethod, compressionTolerance, error))
{
return ret.release();
}
......
......@@ -585,7 +585,7 @@ OPENVDS_EXPORT VDSHandle Open(IOManager*ioManager, Error &error);
/// <returns>
/// The VDS handle that can be used to get the VolumeDataLayout and the VolumeDataAccessManager
/// </returns>
OPENVDS_EXPORT VDSHandle Create(StringWrapper url, StringWrapper connectionString, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, Error& error);
OPENVDS_EXPORT VDSHandle Create(StringWrapper url, StringWrapper connectionString, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance, Error& error);
/// <summary>
/// Create a new VDS
......@@ -601,10 +601,10 @@ OPENVDS_EXPORT VDSHandle Create(StringWrapper url, StringWrapper connectionStrin
/// <returns>
/// The VDS handle that can be used to get the VolumeDataLayout and the VolumeDataAccessManager
/// </returns>
inline VDSHandle Create(StringWrapper url, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, Error& error)
inline VDSHandle Create(StringWrapper url, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance, Error& error)
{
std::string connectionString;
return Create(url, connectionString, layoutDescriptor, axisDescriptors, channelDescriptors, metadata, error);
return Create(url, connectionString, layoutDescriptor, axisDescriptors, channelDescriptors, metadata, compressionMethod, compressionTolerance, error);
}
/// <summary>
......@@ -612,14 +612,14 @@ inline VDSHandle Create(StringWrapper url, VolumeDataLayoutDescriptor const& lay
/// </summary>
/// <param name="options">
/// The options for the connection
/// </param>
/// </param>, OpenVDS::CompressionMethod compressionMethod, float compress, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance, ionTolerance,
/// <param name="error">
/// If an error occured, the error code and message will be written to this output parameter
/// </param>
/// <returns>
/// The VDS handle that can be used to get the VolumeDataLayout and the VolumeDataAccessManager
/// </returns>
OPENVDS_EXPORT VDSHandle Create(const OpenOptions& options, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, Error& error);
OPENVDS_EXPORT VDSHandle Create(const OpenOptions& options, VolumeDataLayoutDescriptor const& layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const& metadata, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance, Error& error);
/// <summary>
/// Create a new VDS
......@@ -634,7 +634,7 @@ OPENVDS_EXPORT VDSHandle Create(const OpenOptions& options, VolumeDataLayoutDesc
/// <returns>
/// The VDS handle that can be used to get the VolumeDataLayout and the VolumeDataAccessManager
/// </returns>
OPENVDS_EXPORT VDSHandle Create(IOManager* ioManager, VolumeDataLayoutDescriptor const &layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const &metadata, Error &error);
OPENVDS_EXPORT VDSHandle Create(IOManager* ioManager, VolumeDataLayoutDescriptor const &layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const &metadata, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance, Error &error);
/// <summary>
/// Get the VolumeDataLayout for a VDS
......
......@@ -951,7 +951,7 @@ bool DownloadAndParseVolumeDataLayoutAndLayerStatus(VDS& vds, Error& error)
return false;
}
CreateVolumeDataLayout(vds);
CreateVolumeDataLayout(vds, OpenVDS::CompressionMethod::None, 0.0f);
return true;
}
......
......@@ -90,7 +90,7 @@ struct VDS
GlobalStateImpl * globalState;
};
void CreateVolumeDataLayout(VDS &handle);
void CreateVolumeDataLayout(VDS &handle, OpenVDS::CompressionMethod compressionMethod, float compressionTolerance);
std::string GetLayerName(VolumeDataLayer const &volumeDataLayer);
......
......@@ -139,7 +139,7 @@ GTEST_TEST(VDS_integration, ParseVolumeDataLayoutAndLayerStatus)
EXPECT_EQ(error.code, 0);
// Create volume data layout from descriptors
CreateVolumeDataLayout(handle);
CreateVolumeDataLayout(handle, OpenVDS::CompressionMethod::None, 0.0f);
// Serialize volume data layout
std::vector<uint8_t>
......
......@@ -320,7 +320,7 @@ TEST(IOErrorHandlingUpload, ErrorHandlingVolumeDataLayoutHttpError)
auto &object = ioManager->m_data["VolumeDataLayout"];
object.error.code = 456;
object.error.string = "This tests refuses to accept your VolumeDataLayout";
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Create(ioManager, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, error), OpenVDS::Close);
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Create(ioManager, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, OpenVDS::CompressionMethod::None, 0.0f, error), OpenVDS::Close);
ASSERT_FALSE(handle);
ASSERT_EQ(error.code, 456);
......@@ -357,7 +357,7 @@ TEST(IOErrorHandlingUpload, ErrorHandlingChunkHttpError)
auto &chunk = ioManager->m_data["Dimensions_012LOD0/1"];
chunk.error.code = 489;
chunk.error.string = "We don't let chunk 1 through";
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Create(ioManager, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, error), OpenVDS::Close);
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Create(ioManager, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, OpenVDS::CompressionMethod::None, 0.0f, error), OpenVDS::Close);
ASSERT_TRUE(handle);
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(handle.get());
......@@ -420,7 +420,7 @@ TEST(IOErrorHandlingUpload, ErrorHandlingLayerStatusHttpError)
auto &chunk = ioManager->m_data["LayerStatus"];
chunk.error.code = 466;
chunk.error.string = "No Layerstatus";
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Create(ioManager, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, error), OpenVDS::Close);
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Create(ioManager, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, OpenVDS::CompressionMethod::None, 0.0f, error), OpenVDS::Close);
ASSERT_TRUE(handle);
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(handle.get());
......@@ -483,7 +483,7 @@ TEST(IOErrorHandlingUpload, ErrorHandlingChunkMetadataHttpError)
auto &chunk = ioManager->m_data["Dimensions_012LOD0/ChunkMetadata/0"];
chunk.error.code = 433;
chunk.error.string = "No metadata";
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Create(ioManager, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, error), OpenVDS::Close);
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Create(ioManager, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, OpenVDS::CompressionMethod::None, 0.0f, error), OpenVDS::Close);
ASSERT_TRUE(handle);
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(handle.get());
......
......@@ -103,9 +103,9 @@ TEST(IOTests, CreateSyntheticVDSAndVerifyUpload)
auto create_start = std::chrono::high_resolution_clock::now();
#ifdef IN_MEMORY_TEST
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> networkVDS(OpenVDS::Create(new IOManagerFacadeLight(inMemory), layoutDescriptor, axisDescriptors, channelDescriptors, metadata, error), &OpenVDS::Close);
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> networkVDS(OpenVDS::Create(new IOManagerFacadeLight(inMemory), layoutDescriptor, axisDescriptors, channelDescriptors, metadata, OpenVDS::CompressionMethod::None, 0.0f, error), &OpenVDS::Close);
#else
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> networkVDS(OpenVDS::Create(url, connectionString, layoutDescriptor, axisDescriptors, channelDescriptors, metadata, error), &OpenVDS::Close);
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> networkVDS(OpenVDS::Create(url, connectionString, layoutDescriptor, axisDescriptors, channelDescriptors, metadata, OpenVDS::CompressionMethod::None, 0.0f, error), &OpenVDS::Close);
#endif
ASSERT_TRUE(networkVDS);
......@@ -282,7 +282,7 @@ TEST(IOTests, CreateSyntheticVDSAndVerifyCreateVDSFile)
remove(openOptions.fileName.c_str());
auto create_start = std::chrono::high_resolution_clock::now();
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> fileVDS(OpenVDS::Create(openOptions, layoutDescriptor, axisDescriptors, channelDescriptors, metadata, error), &OpenVDS::Close);
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> fileVDS(OpenVDS::Create(openOptions, layoutDescriptor, axisDescriptors, channelDescriptors, metadata, OpenVDS::CompressionMethod::None, 0.0f, error), &OpenVDS::Close);
ASSERT_TRUE(fileVDS);
OpenVDS::VolumeDataAccessManager *inMemoryAccessManager = OpenVDS::GetAccessManager(inMemoryVDS.get());
......
......@@ -60,10 +60,10 @@ static OpenVDS::VDS *generateSimpleInMemory3DVDS(int32_t samplesX = 100, int32_t
OpenVDS::Error error;
if (ioManager)
{
return OpenVDS::Create(ioManager, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, error);
return OpenVDS::Create(ioManager, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, OpenVDS::CompressionMethod::None, 0.0f, error);
}
OpenVDS::InMemoryOpenOptions options;
return OpenVDS::Create(options, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, error);
return OpenVDS::Create(options, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, OpenVDS::CompressionMethod::None, 0.0f, error);
}
inline void fill3DVDSWithNoise(OpenVDS::VDS *vds, int32_t channel = 0, const OpenVDS::FloatVector3 &frequency = OpenVDS::FloatVector3(0.6f, 2.f, 4.f))
......
......@@ -1082,7 +1082,12 @@ main(int argc, char* argv[])
std::string persistentID;
bool uniqueID = false;
bool disablePersistentID = false;
bool compression = false;
float compressionTolerance = 0.0;
bool sparseCompression = false;
OpenVDS::CompressionMethod compressionMethod = OpenVDS::CompressionMethod::None;
std::vector<std::string> fileNames;
options.add_option("", "h", "header-format", "A JSON file defining the header format for the input SEG-Y file. The expected format is a dictonary of strings (field names) to pairs (byte position, field width) where field width can be \"TwoByte\" or \"FourByte\". Additionally, an \"Endianness\" key can be specified as \"BigEndian\" or \"LittleEndian\".", cxxopts::value<std::string>(headerFormatFileName), "<file>");
......@@ -1105,7 +1110,11 @@ main(int argc, char* argv[])
options.add_option("", "", "persistentID", "A globally unique ID for the VDS, usually an 8-digit hexadecimal number.", cxxopts::value<std::string>(persistentID), "<ID>");
options.add_option("", "", "uniqueID", "Generate a new globally unique ID when scanning the input SEG-Y file.", cxxopts::value<bool>(uniqueID), "");
options.add_option("", "", "disable-persistentID", "Disable the persistentID usage, placing the VDS directly into the url location.", cxxopts::value<bool>(disablePersistentID), "");
options.add_option("", "", "compression", "Enable compression.", cxxopts::value<bool>(compression), "");
options.add_option("", "", "tolerance", "Compression tolerance for lossy compression. Set to 0 for lossless. Ignored for integral data types.", cxxopts::value<float>(compressionTolerance), "");
options.add_option("", "", "sparse", "Enable sparse compression.", cxxopts::value<bool>(sparseCompression), "");
options.add_option("", "", "input", "", cxxopts::value<std::vector<std::string>>(fileNames), "");
options.parse_positional("input");
......@@ -1176,6 +1185,25 @@ main(int argc, char* argv[])
}
}
if (compression)
{
if (compressionTolerance == 0.0f)
{
compressionMethod = OpenVDS::CompressionMethod::BitcompLossless;
}
else
{
if (sparseCompression)
{
compressionMethod = OpenVDS::CompressionMethod::BitcompLossyToSignedSparse;
}
else
{
compressionMethod = OpenVDS::CompressionMethod::BitcompLossyToSigned;
}
}
}
// get the canonical field name for the primary and secondary key
ResolveAlias(primaryKey);
ResolveAlias(secondaryKey);
......@@ -1456,11 +1484,11 @@ main(int argc, char* argv[])
if(vdsFileName.empty())
{
handle = OpenVDS::Create(url, connection, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, createError);
handle = OpenVDS::Create(url, connection, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, compressionMethod, compressionTolerance, createError);
}
else
{
handle = OpenVDS::Create(OpenVDS::VDSFileOpenOptions(vdsFileName), layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, createError);
handle = OpenVDS::Create(OpenVDS::VDSFileOpenOptions(vdsFileName), layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, compressionMethod, compressionTolerance, createError);
}
if (createError.code != 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment