Commit 677e4030 authored by Jørgen Lind's avatar Jørgen Lind
Browse files

OpenVDS DataAccess test

parent f3b88678
......@@ -27,14 +27,15 @@ namespace OpenVDS
class MetadataPageTransfer : public TransferHandler
{
public:
MetadataPageTransfer(MetadataManager *manager, MetadataPage *metadataPage)
MetadataPageTransfer(MetadataManager *manager, VolumeDataAccessManagerImpl *accessManager, MetadataPage *metadataPage)
: manager(manager)
, accessManager(accessManager)
, metadataPage(metadataPage)
{ }
void handleData(std::vector<uint8_t> &&data) override
{
manager->pageTransferCompleted(metadataPage, std::move(data));
manager->pageTransferCompleted(accessManager, metadataPage, std::move(data));
}
void handleError(Error &error) override
......@@ -42,25 +43,27 @@ void handleError(Error &error) override
}
MetadataManager *manager;
VolumeDataAccessManagerImpl *accessManager;
MetadataPage *metadataPage;
};
MetadataManager::MetadataManager(IOManager* iomanager, VolumeDataAccessManagerImpl* accessManager, std::string const& layerUrl, MetadataStatus const& metadataStatus, int pageLimit)
: m_iomanager(iomanager)
, m_accessManager(accessManager)
, m_layerUrl(layerUrl)
, m_metadataStatus(metadataStatus)
, m_pageLimit(pageLimit)
{}
MetadataManager::MetadataManager(IOManager* iomanager, std::string const& layerUrl, MetadataStatus const& metadataStatus, int pageLimit)
: m_iomanager(iomanager)
, m_layerUrl(layerUrl)
, m_metadataStatus(metadataStatus)
, m_pageLimit(pageLimit)
{
}
MetadataManager::~MetadataManager()
{}
{
}
void MetadataManager::limitPages()
{
assert(m_pageMap.size() == m_pageList.size());
while(m_pageList.size() > m_pageLimit && m_pageList.back().m_lockCount == 0)
while (m_pageList.size() > m_pageLimit && m_pageList.back().m_lockCount == 0)
{
m_pageMap.erase(m_pageList.back().m_pageIndex);
m_pageList.pop_back();
......@@ -69,8 +72,8 @@ void MetadataManager::limitPages()
assert(m_pageMap.size() == m_pageList.size());
}
MetadataPage *
MetadataManager::lockPage(int pageIndex, bool *initiateTransfer)
MetadataPage*
MetadataManager::lockPage(int pageIndex, bool* initiateTransfer)
{
assert(initiateTransfer);
......@@ -80,7 +83,7 @@ MetadataManager::lockPage(int pageIndex, bool *initiateTransfer)
MetadataPageMap::iterator mi = m_pageMap.find(pageIndex);
if(mi != m_pageMap.end())
if (mi != m_pageMap.end())
{
// Move page to front of list
m_pageList.splice(m_pageList.begin(), m_pageList, mi->second);
......@@ -96,7 +99,7 @@ MetadataManager::lockPage(int pageIndex, bool *initiateTransfer)
*initiateTransfer = true;
}
MetadataPage *page = std::addressof(*m_pageList.begin());
MetadataPage* page = std::addressof(*m_pageList.begin());
page->m_lockCount++;
......@@ -109,43 +112,41 @@ MetadataManager::lockPage(int pageIndex, bool *initiateTransfer)
return page;
}
void MetadataManager::initiateTransfer(MetadataPage *page, std::string const &url, bool verbose)
void MetadataManager::initiateTransfer(VolumeDataAccessManagerImpl *accessManager, MetadataPage* page, std::string const& url, bool verbose)
{
std::unique_lock<std::mutex> lock(m_mutex);
assert(!page->m_valid && !page->m_activeTransfer);
page->m_activeTransfer = m_iomanager->requestObject(url, std::make_shared<MetadataPageTransfer>(this, page));
page->m_activeTransfer = m_iomanager->requestObject(url, std::make_shared<MetadataPageTransfer>(this, accessManager, page));
}
void MetadataManager::pageTransferError(MetadataPage *page, const char *msg)
void MetadataManager::pageTransferError(MetadataPage* page, const char* msg)
{
std::string
errorString = std::string("Failed to transfer metadata page: ") + std::string(msg);
fprintf(stderr, "OpenVDS: %s\n", errorString.c_str());
// what to do
// std::unique_lock<std::mutex> metadataManagersMutexLock(VDSRemotePlugin::s_metadataManagersMutex);
//
// for(auto pluginInstance : m_references)
// {
// pluginInstance->PageTransferCompleted(page);
// what to do
// std::unique_lock<std::mutex> metadataManagersMutexLock(VDSRemotePlugin::s_metadataManagersMutex);
//
// for(auto pluginInstance : m_references)
// {
// pluginInstance->PageTransferCompleted(page);
// }
//TODO pendingrequestchangedcondition.notify_all
}
void MetadataManager::pageTransferCompleted(MetadataPage *page, std::vector<uint8_t> &&data)
void MetadataManager::pageTransferCompleted(VolumeDataAccessManagerImpl* accessManager, MetadataPage* page, std::vector<uint8_t> &&data)
{
std::unique_lock<std::mutex> lock(m_mutex);
page->m_data = data;
page->m_data = std::move(data);
page->m_valid = true;
page->m_activeTransfer = nullptr;
lock.unlock();
m_accessManager->pageTransferCompleted(page);
accessManager->pageTransferCompleted(page);
}
......
......@@ -87,7 +87,6 @@ namespace OpenVDS
class MetadataManager
{
IOManager *m_iomanager;
VolumeDataAccessManagerImpl *m_accessManager;
std::string m_layerUrl;
MetadataStatus m_metadataStatus;
......@@ -103,7 +102,7 @@ namespace OpenVDS
void limitPages();
public:
MetadataManager(IOManager *iomanager, VolumeDataAccessManagerImpl *accessManager, std::string const &layerURL, MetadataStatus const &metadataStatus, int pageLimit);
MetadataManager(IOManager *iomanager, std::string const &layerURL, MetadataStatus const &metadataStatus, int pageLimit);
~MetadataManager();
const char *layerUrl() const { return m_layerUrl.c_str(); }
......@@ -113,9 +112,9 @@ namespace OpenVDS
void pageTransferError(MetadataPage *page, const char *msg);
void pageTransferCompleted(MetadataPage* page, std::vector<uint8_t>&& data);
void pageTransferCompleted(VolumeDataAccessManagerImpl *accessManager, MetadataPage* page, std::vector<uint8_t>&& data);
void initiateTransfer(MetadataPage *page, std::string const &url, bool verbose);
void initiateTransfer(VolumeDataAccessManagerImpl* accessManager, MetadataPage* page, std::string const& url, bool verbose);
uint8_t const *getPageEntry(MetadataPage *page, int entry) const;
......
......@@ -747,7 +747,7 @@ bool parseLayerStatus(const std::vector<uint8_t> &json, VDSHandle &handle, Error
{
int pageLimit = handle.axisDescriptors.size() <= 3 ? 64 : 1024;
handle.layerMetadataContainer.managers.insert(std::make_pair(layerName, std::unique_ptr<MetadataManager>(new MetadataManager(handle.ioManager.get(), static_cast<VolumeDataAccessManagerImpl *>(handle.dataAccessManager.get()), layerName, metadataStatus, pageLimit))));
handle.layerMetadataContainer.managers.insert(std::make_pair(layerName, std::unique_ptr<MetadataManager>(new MetadataManager(handle.ioManager.get(), layerName, metadataStatus, pageLimit))));
}
}
}
......
......@@ -442,14 +442,8 @@ static std::string makeURLForChunk(const std::string &layerUrl, uint64_t chunk)
return std::string(url);
}
bool VolumeDataAccessManagerImpl::prepareReadChunkData(const VolumeDataChunk &chunk, int32_t (&pitch)[Dimensionality_Max], bool verbose, Error &error)
bool VolumeDataAccessManagerImpl::prepareReadChunkData(const VolumeDataChunk &chunk, bool verbose, Error &error)
{
// This can probably be improved by looking up the data directly in the cache and not requesting it if it's valid,
// similar to the VolumeSamples code
for(auto &p : pitch)
p = 0;
int32_t channel = chunk.layer->getChannelIndex();
const char *channelName = channel > 0 ? chunk.layer->getLayout()->getChannelName(chunk.layer->getChannelIndex()) : "";
int32_t lod = chunk.layer->getLOD();
......@@ -481,7 +475,7 @@ bool VolumeDataAccessManagerImpl::prepareReadChunkData(const VolumeDataChunk &ch
char url[1000];
snprintf(url, sizeof(url), "%s/ChunkMetadata/%d", layerURL, pageIndex);
metadataManager->initiateTransfer(metadataPage, url, verbose);
metadataManager->initiateTransfer(this, metadataPage, url, verbose);
}
// Check if the page is not valid and we need to add the request later when the metadata page transfer completes
......
......@@ -177,7 +177,7 @@ public:
int64_t requestVolumeTraces(float *buffer, VolumeDataLayout const *volumeDataLayout, DimensionsND dimensionsND, int lod, int channel, const float(*tracePositions)[Dimensionality_Max], int nTraceCount, InterpolationMethod eInterpolationMethod, int iTraceDimension, float rReplacementNoValue) override;
int64_t prefetchVolumeChunk(VolumeDataLayout const *volumeDataLayout, DimensionsND dimensionsND, int lod, int channel, int64_t chunk) override;
bool prepareReadChunkData(const VolumeDataChunk& chunk, int32_t(&pitch)[Dimensionality_Max], bool verbose, Error& error);
bool prepareReadChunkData(const VolumeDataChunk& chunk, bool verbose, Error& error);
bool readChunk(const VolumeDataChunk& chunk, std::vector<uint8_t>& serializedData, std::vector<uint8_t>& metadata, CompressionInfo& compressionInfo, Error& error);
void pageTransferCompleted(MetadataPage* page);
......
......@@ -176,13 +176,9 @@ VolumeDataPage* VolumeDataPageAccessorImpl::readPage(int64_t chunk)
assert(page->isPinned());
std::vector<uint8_t> blob;
int32_t pitch[Dimensionality_Max];
Error error;
VolumeDataChunk volumeDataChunk = m_layer->getChunkFromIndex(chunk);
if (!m_accessManager->prepareReadChunkData(volumeDataChunk, pitch, true, error))
if (!m_accessManager->prepareReadChunkData(volumeDataChunk, true, error))
{
page->unPin();
fprintf(stderr, "Failed to download chunk: %s\n", error.string.c_str());
......@@ -191,10 +187,10 @@ VolumeDataPage* VolumeDataPageAccessorImpl::readPage(int64_t chunk)
pageMutexLocker.unlock();
std::vector<uint8_t> page_data;
std::vector<uint8_t> serialized_data;
std::vector<uint8_t> metadata;
CompressionInfo compressionInfo;
if (!m_accessManager->readChunk(volumeDataChunk, page_data, metadata, compressionInfo, error))
if (!m_accessManager->readChunk(volumeDataChunk, serialized_data, metadata, compressionInfo, error))
{
pageMutexLocker.lock();
page->unPin();
......@@ -202,7 +198,9 @@ VolumeDataPage* VolumeDataPageAccessorImpl::readPage(int64_t chunk)
return nullptr;
}
if (!VolumeDataStore::deserializeVolumeData(volumeDataChunk, page_data, metadata, compressionInfo.GetCompressionMethod(), compressionInfo.GetAdaptiveLevel(), m_layer->getFormat(), page_data, error))
std::vector<uint8_t> page_data;
DataBlock dataBlock;
if (!VolumeDataStore::deserializeVolumeData(volumeDataChunk, serialized_data, metadata, compressionInfo.GetCompressionMethod(), compressionInfo.GetAdaptiveLevel(), m_layer->getFormat(), dataBlock, page_data, error))
{
pageMutexLocker.lock();
page->unPin();
......@@ -210,6 +208,15 @@ VolumeDataPage* VolumeDataPageAccessorImpl::readPage(int64_t chunk)
return nullptr;
}
int pitch[Dimensionality_Max];
for (int i = 0; i < std::size(pitch); i++)
{
if (i < std::size(dataBlock.pitch))
pitch[i] = dataBlock.pitch[i];
else
pitch[i] = 1;
}
pageMutexLocker.lock();
page->setBufferData(std::move(page_data), pitch);
m_pagesRead++;
......
......@@ -102,7 +102,6 @@ VolumeDataPageImpl::VolumeDataPageImpl(VolumeDataPageAccessorImpl* volumeDataPag
, m_chunk(chunk)
, m_blob()
, m_pins(1)
, m_buffer(nullptr)
, m_isDirty(false)
, m_chunksCopiedTo(0)
{
......@@ -122,8 +121,6 @@ VolumeDataPageImpl::~VolumeDataPageImpl()
{
fprintf(stderr, "OpenVDS: VolumeDataPage was not released before VolumeDataPageAccessor was destructed");
}
m_buffer = NULL;
}
// All these methods require the caller to hold a lock
......@@ -174,7 +171,7 @@ void VolumeDataPageImpl::setBufferData(std::vector<uint8_t>&& blob, const int(&p
{
//assert(m_volumeDataPageAccessor->m_pageListMutex.isLockedByCurrentThread());
m_blob = blob;
m_blob = std::move(blob);
for(int32_t iDimension = 0; iDimension < Dimensionality_Max; iDimension++)
{
......@@ -197,12 +194,7 @@ void* VolumeDataPageImpl::getBufferInternal(int(&anPitch)[Dimensionality_Max], b
anPitch[iDimension] = m_pitch[iDimension];
}
if(!m_buffer)
{
m_buffer = m_blob.data();
}
return m_buffer;
return m_blob.data();
}
bool VolumeDataPageImpl::isCopyMarginNeeded(VolumeDataPageImpl* targetPage)
......
......@@ -38,8 +38,6 @@ private:
int32_t m_pins;
void *m_buffer;
bool m_isDirty;
int32_t m_pitch[Dimensionality_Max];
......
......@@ -376,7 +376,7 @@ VolumeDataPartition::getChunkMinMax(int64_t chunk, int32_t *min, int32_t *max, b
}
else
{
nMax = std::max(nMax + m_positiveMargin[iDimension], m_dimensionNumSamples[iDimension] + m_positiveBorder[iDimension]);
nMax = std::min(nMax + m_positiveMargin[iDimension], m_dimensionNumSamples[iDimension] + m_positiveBorder[iDimension]);
}
}
......
......@@ -129,12 +129,10 @@ static void copyLinearBufferIntoDataBlock(const void *sourceBuffer, const DataBl
}
}
bool deserializeVolumeData(const std::vector<uint8_t> &serializedData, VolumeDataChannelDescriptor::Format format, CompressionMethod compressionMethod, bool isRenderable, const FloatRange &valueRange, float integerScale, float integerOffset, bool isUseNoValue, float noValue, int32_t adaptiveLevel, DataBlock &dataBlock, std::vector<uint8_t> &destination, Error &error)
bool deserializeVolumeData(const std::vector<uint8_t> &serializedData, VolumeDataChannelDescriptor::Format format, CompressionMethod compressionMethod, const FloatRange &valueRange, float integerScale, float integerOffset, bool isUseNoValue, float noValue, int32_t adaptiveLevel, DataBlock &dataBlock, std::vector<uint8_t> &destination, Error &error)
{
if(compressionMethodIsWavelet(compressionMethod))
{
assert(isRenderable);
const void *data = serializedData.data();
int32_t dataVersion = ((int32_t *)data)[0];
......@@ -324,24 +322,23 @@ static void fillConstantValueBuffer(std::vector<uint8_t> &buffer, int32_t alloca
}
}
static bool createConstantValueDataBlock(VolumeDataChunk const &volumeDataChunk, VolumeDataChannelDescriptor::Format format, float noValue, VolumeDataChannelDescriptor::Components components, VolumeDataHash const &constantValueVolumeDataHash, std::vector<uint8_t> &buffer, Error &error)
static bool createConstantValueDataBlock(VolumeDataChunk const &volumeDataChunk, VolumeDataChannelDescriptor::Format format, float noValue, VolumeDataChannelDescriptor::Components components, VolumeDataHash const &constantValueVolumeDataHash, DataBlock &dataBlock, std::vector<uint8_t> &buffer, Error &error)
{
int32_t size[4];
volumeDataChunk.layer->getChunkVoxelSize(volumeDataChunk.chunkIndex, size);
int32_t dimensionality = volumeDataChunk.layer->getChunkDimensionality();
DataBlock datablock;
if (!initializeDataBlock(format, components, Dimensionality(dimensionality), size, datablock, error))
if (!initializeDataBlock(format, components, Dimensionality(dimensionality), size, dataBlock, error))
return false;
int32_t allocatedSize = getAllocatedByteSize(datablock);
int32_t allocatedSize = getAllocatedByteSize(dataBlock);
buffer.resize(allocatedSize);
int32_t allocatedElements = datablock.allocatedSize[0] * datablock.allocatedSize[1] * datablock.allocatedSize[2] * datablock.allocatedSize[3] * datablock.components;
int32_t allocatedElements = dataBlock.allocatedSize[0] * dataBlock.allocatedSize[1] * dataBlock.allocatedSize[2] * dataBlock.allocatedSize[3] * dataBlock.components;
float convertedConstantValue = getConvertedConstantValue(volumeDataChunk.layer->getVolumeDataChannelDescriptor(), format, noValue, constantValueVolumeDataHash);
assert(datablock.format == format);
assert(dataBlock.format == format);
VolumeDataChannelDescriptor::Format effectiveFormat = format;
......@@ -356,7 +353,7 @@ static bool createConstantValueDataBlock(VolumeDataChunk const &volumeDataChunk,
{
default:
error.code = -3;
error.string = "Invalid format in createConstantValueDataBlock";
error.string = "Invalid format in createConstantValuedataBlock";
return false;
case VolumeDataChannelDescriptor::Format_U8: fillConstantValueBuffer<uint8_t>(buffer, allocatedElements, convertedConstantValue); break;
case VolumeDataChannelDescriptor::Format_U16: fillConstantValueBuffer<uint16_t>(buffer, allocatedElements, convertedConstantValue); break;
......@@ -369,7 +366,7 @@ static bool createConstantValueDataBlock(VolumeDataChunk const &volumeDataChunk,
return true;
}
bool VolumeDataStore::deserializeVolumeData(const VolumeDataChunk &volumeDataChunk, const std::vector<uint8_t>& serializedData, const std::vector<uint8_t>& metadata, CompressionMethod compressionMethod, int32_t adaptiveLevel, VolumeDataChannelDescriptor::Format loadFormat, std::vector<uint8_t>& target, Error& error)
bool VolumeDataStore::deserializeVolumeData(const VolumeDataChunk &volumeDataChunk, const std::vector<uint8_t>& serializedData, const std::vector<uint8_t>& metadata, CompressionMethod compressionMethod, int32_t adaptiveLevel, VolumeDataChannelDescriptor::Format loadFormat, DataBlock &dataBlock, std::vector<uint8_t>& target, Error& error)
{
uint64_t volumeDataHashValue = VolumeDataHash::UNKNOWN;
......@@ -392,7 +389,7 @@ bool VolumeDataStore::deserializeVolumeData(const VolumeDataChunk &volumeDataChu
if (volumeDataHash.isConstant())
{
if (!createConstantValueDataBlock(volumeDataChunk, volumeDataLayer->getFormat(), volumeDataLayer->getNoValue(), volumeDataLayer->getComponents(), volumeDataHash, target, error))
if (!createConstantValueDataBlock(volumeDataChunk, volumeDataLayer->getFormat(), volumeDataLayer->getNoValue(), volumeDataLayer->getComponents(), volumeDataHash, dataBlock, target, error))
return false;
}
else
......@@ -417,8 +414,7 @@ bool VolumeDataStore::deserializeVolumeData(const VolumeDataChunk &volumeDataChu
}
}
DataBlock dataBlock;
if (!OpenVDS::deserializeVolumeData(serializedData, loadFormat, compressionMethod, false, deserializeValueRange, volumeDataLayer->getIntegerScale(), volumeDataLayer->getIntegerOffset(), volumeDataLayer->isUseNoValue(), volumeDataLayer->getNoValue(), adaptiveLevel, dataBlock, target, error))
if (!OpenVDS::deserializeVolumeData(serializedData, loadFormat, compressionMethod, deserializeValueRange, volumeDataLayer->getIntegerScale(), volumeDataLayer->getIntegerOffset(), volumeDataLayer->isUseNoValue(), volumeDataLayer->getNoValue(), adaptiveLevel, dataBlock, target, error))
return false;
}
......
......@@ -33,7 +33,7 @@ namespace OpenVDS
struct VolumeDataStore
{
static bool verify(const VolumeDataChunk& volumeDataChunk, const std::vector<uint8_t>& serializedData, CompressionMethod compressionMethod, bool isFullyRead);
static bool deserializeVolumeData(const VolumeDataChunk& chunk, const std::vector<uint8_t>& serializedData, const std::vector<uint8_t>& metadata, CompressionMethod compressionMethod, int32_t adaptiveLevel, VolumeDataChannelDescriptor::Format loadFormat, std::vector<uint8_t>& target, Error& error);
static bool deserializeVolumeData(const VolumeDataChunk& chunk, const std::vector<uint8_t>& serializedData, const std::vector<uint8_t>& metadata, CompressionMethod compressionMethod, int32_t adaptiveLevel, VolumeDataChannelDescriptor::Format loadFormat, DataBlock &dataBlock, std::vector<uint8_t>& target, Error& error);
};
}
......
......@@ -711,9 +711,9 @@ bool Wavelet::deCompress(bool isTransform, int32_t decompressInfo, float decompr
assert(m_dataVersion == WAVELET_DATA_VERSION_1_4);
initCoder();
int *startOfCompressedData = (int *)m_compressedData;
int32_t *startOfCompressedData = (int32_t *)m_compressedData;
int32_t compressedSize = m_wordCompressedData[1];
int32_t compressedSize = startOfCompressedData[1];
// no data?
if (compressedSize < WAVELET_MIN_COMPRESSED_HEADER)
......
......@@ -480,10 +480,10 @@ static void evalAndSplitAllNormal(const WaveletAdaptiveLL_DecodeIterator& decode
nChildrenOut += tempOutputItemIndices[thread];
}
if (tempOutputItemIndices[thread])
if (tempOutputPosIndices[thread])
{
memmove(outputPos + nValuesOut, tempOutputPos[thread], tempOutputItemIndices[thread] * sizeof(int));
nValuesOut += tempOutputItemIndices[thread];
memmove(outputPos + nValuesOut, tempOutputPos[thread], tempOutputPosIndices[thread] * sizeof(int));
nValuesOut += tempOutputPosIndices[thread];
}
if (tempInputItemIndices[thread])
......
......@@ -17,7 +17,7 @@
#include <OpenVDS/OpenVDS.h>
#include <OpenVDS/VolumeDataAccess.h>
#include <VDS/VolumeDataLayout.h>
#include <cstdlib>
#include <gtest/gtest.h>
......@@ -48,10 +48,28 @@ GTEST_TEST(OpenVDS_integration, SimpleVolumeDataPageRead)
OpenVDS::VolumeDataPageAccessor *pageAccessor = dataAccessManager->createVolumeDataPageAccessor(layout, OpenVDS::Dimensions_012, 0, 0, 10, false);
ASSERT_TRUE(pageAccessor);
int pos[OpenVDS::Dimensionality_Max] = {};
int pos[OpenVDS::Dimensionality_Max] = {layout->getDimensionNumSamples(0) / 2, layout->getDimensionNumSamples(1) /2, layout->getDimensionNumSamples(2) / 2};
OpenVDS::VolumeDataPage *page = pageAccessor->readPageAtPosition(pos);
ASSERT_TRUE(page);
int pitch[OpenVDS::Dimensionality_Max] = {};
const void *buffer = page->getBuffer(pitch);
ASSERT_TRUE(buffer);
bool pitch_non_null = false;
for (auto p : pitch)
pitch_non_null |= p;
ASSERT_TRUE(pitch_non_null);
int min[6];
int max[6];
page->getMinMax(min, max);
ASSERT_TRUE(min[0] < pos[0]);
ASSERT_TRUE(min[1] < pos[1]);
ASSERT_TRUE(min[2] < pos[2]);
ASSERT_TRUE(pos[0] < max[0]);
ASSERT_TRUE(pos[1] < max[1]);
ASSERT_TRUE(pos[2] < max[2]);
OpenVDS::destroy(handle);
}
......@@ -29,7 +29,7 @@
namespace OpenVDS
{
bool deserializeVolumeData(const std::vector<uint8_t> &serializedData, VolumeDataChannelDescriptor::Format format, CompressionMethod compressionMethod, bool isRenderable, const FloatRange &valueRange, float integerScale, float integerOffset, bool isUseNoValue, float noValue, int32_t adaptiveLevel, DataBlock &dataBlock, std::vector<uint8_t> &destination, Error &error);
bool deserializeVolumeData(const std::vector<uint8_t>& serializedData, VolumeDataChannelDescriptor::Format format, CompressionMethod compressionMethod, const FloatRange& valueRange, float integerScale, float integerOffset, bool isUseNoValue, float noValue, int32_t adaptiveLevel, DataBlock& dataBlock, std::vector<uint8_t>& destination, Error& error);
}
static void stats(const OpenVDS::DataBlock &aDataBlock, const std::vector<uint8_t> &aData, const OpenVDS::DataBlock &bDataBlock, const std::vector<uint8_t> &bData, double &diff, double &maxError, double &deviation, double &samples)
......@@ -155,14 +155,14 @@ GTEST_TEST(VDS_integration, DeSerializeVolumeData)
std::vector<uint8_t> serializedNone = loadTestFile("/chunk.CompressionMethod_None");
std::vector<uint8_t> dataNone;
OpenVDS::DataBlock dataBlockNone;
OpenVDS::deserializeVolumeData(serializedNone, OpenVDS::VolumeDataChannelDescriptor::Format_R32, OpenVDS::CompressionMethod::None, true, OpenVDS::FloatRange(-0.07883811742067337f, 0.07883811742067337f), 1.0f, 0.0f, false, 0.0f, 0, dataBlockNone, dataNone, error);
OpenVDS::deserializeVolumeData(serializedNone, OpenVDS::VolumeDataChannelDescriptor::Format_R32, OpenVDS::CompressionMethod::None, OpenVDS::FloatRange(-0.07883811742067337f, 0.07883811742067337f), 1.0f, 0.0f, false, 0.0f, 0, dataBlockNone, dataNone, error);
EXPECT_EQ(error.code, 0);
std::vector<uint8_t> serializedWavelet = loadTestFile("/chunk.CompressionMethod_Wavelet");
std::vector<uint8_t> dataWavelet;
OpenVDS::DataBlock dataBlockWavelet;
OpenVDS::deserializeVolumeData(serializedWavelet, OpenVDS::VolumeDataChannelDescriptor::Format_R32, OpenVDS::CompressionMethod::Wavelet, true, OpenVDS::FloatRange(-0.07883811742067337f, 0.07883811742067337f), 1.0f, 0.0f, false, 0.0f, 0, dataBlockWavelet, dataWavelet, error);
OpenVDS::deserializeVolumeData(serializedWavelet, OpenVDS::VolumeDataChannelDescriptor::Format_R32, OpenVDS::CompressionMethod::Wavelet, OpenVDS::FloatRange(-0.07883811742067337f, 0.07883811742067337f), 1.0f, 0.0f, false, 0.0f, 0, dataBlockWavelet, dataWavelet, error);
EXPECT_EQ(error.code, 0);
EXPECT_EQ(dataNone.size(), dataWavelet.size());
......@@ -182,7 +182,7 @@ GTEST_TEST(VDS_integration, DeSerializeVolumeData)
std::vector<uint8_t> serializedRLE = loadTestFile("/chunk.CompressionMethod_RLE");
std::vector<uint8_t> dataRLE;
OpenVDS::DataBlock dataBlockRLE;
OpenVDS::deserializeVolumeData(serializedRLE, OpenVDS::VolumeDataChannelDescriptor::Format_R32, OpenVDS::CompressionMethod::RLE, true, OpenVDS::FloatRange(-0.07883811742067337f, 0.07883811742067337f), 1.0f, 0.0f, false, 0.0f, 0, dataBlockRLE, dataRLE, error);
OpenVDS::deserializeVolumeData(serializedRLE, OpenVDS::VolumeDataChannelDescriptor::Format_R32, OpenVDS::CompressionMethod::RLE, OpenVDS::FloatRange(-0.07883811742067337f, 0.07883811742067337f), 1.0f, 0.0f, false, 0.0f, 0, dataBlockRLE, dataRLE, error);
EXPECT_EQ(error.code, 0);
EXPECT_EQ(dataNone.size(), dataRLE.size());
......@@ -192,7 +192,7 @@ GTEST_TEST(VDS_integration, DeSerializeVolumeData)
std::vector<uint8_t> serializedZip = loadTestFile("/chunk.CompressionMethod_Zip");
std::vector<uint8_t> dataZip;
OpenVDS::DataBlock dataBlockZip;
OpenVDS::deserializeVolumeData(serializedZip, OpenVDS::VolumeDataChannelDescriptor::Format_R32, OpenVDS::CompressionMethod::Zip, true, OpenVDS::FloatRange(-0.07883811742067337f, 0.07883811742067337f), 1.0f, 0.0f, false, 0.0f, 0, dataBlockZip, dataZip, error);
OpenVDS::deserializeVolumeData(serializedZip, OpenVDS::VolumeDataChannelDescriptor::Format_R32, OpenVDS::CompressionMethod::Zip, OpenVDS::FloatRange(-0.07883811742067337f, 0.07883811742067337f), 1.0f, 0.0f, false, 0.0f, 0, dataBlockZip, dataZip, error);
EXPECT_EQ(error.code, 0);
EXPECT_EQ(dataNone.size(), dataZip.size());
......
Supports Markdown
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