diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b508c21b..aae02a5fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ See the [roadmap](https://github.com/niessner/Opt/blob/master/ROADMAP.md) for ne ## [Unreleased] +### Changed +- Renamed isUnknown parameter in C++ wrapper class OptImage to usesOptFloat +- Removed internal Opt compiler cruft. + +### Fixed +- Small robustness changes for compilers. (mihaibujanca) + + ## [0.2.2] - 2017-11-29 ### Added - Higher verbosity levels, along with documentation diff --git a/examples/shape_from_shading/src/SFSSolverInput.h b/examples/shape_from_shading/src/SFSSolverInput.h index 5c93e14e4..ca7e9a03a 100644 --- a/examples/shape_from_shading/src/SFSSolverInput.h +++ b/examples/shape_from_shading/src/SFSSolverInput.h @@ -8,8 +8,8 @@ static std::shared_ptr createWrapperOptImage(std::shared_ptr simpleBuffer) { std::vector dims = { (unsigned int)simpleBuffer->width(), (unsigned int)simpleBuffer->height() }; OptImage::Type t = (simpleBuffer->type() == SimpleBuffer::DataType::FLOAT) ? OptImage::Type::FLOAT : OptImage::Type::UCHAR; - bool isUnknown = (t == OptImage::Type::FLOAT); - return std::shared_ptr(new OptImage(dims, simpleBuffer->data(), t, 1, OptImage::Location::GPU, isUnknown, false)); + bool usesOptFloat = (t == OptImage::Type::FLOAT); + return std::shared_ptr(new OptImage(dims, simpleBuffer->data(), t, 1, OptImage::Location::GPU, usesOptFloat, false)); } struct SFSSolverInput { diff --git a/examples/shared/NamedParameters.h b/examples/shared/NamedParameters.h index 4643ba76b..7618d9633 100644 --- a/examples/shared/NamedParameters.h +++ b/examples/shared/NamedParameters.h @@ -24,7 +24,7 @@ class NamedParameters { std::vector unknownParameters() const { std::vector params; for (auto p : m_parameters) { - if (p.im && p.im->isUnknown()) { + if (p.im && p.im->usesOptFloat()) { params.push_back(p); } } diff --git a/examples/shared/OptImage.h b/examples/shared/OptImage.h index 1e06825f1..e84eebce6 100644 --- a/examples/shared/OptImage.h +++ b/examples/shared/OptImage.h @@ -15,8 +15,8 @@ class OptImage { public: enum Type { FLOAT, DOUBLE, UCHAR, INT }; enum Location { CPU, GPU }; - OptImage(std::vector dims, void* data, Type type, unsigned int channelCount, Location location, bool isUnknown = false, bool ownsData = false) : - m_dims(dims), m_data(data), m_type(type), m_channelCount(channelCount), m_location(location), m_isUnknown(isUnknown), m_ownsData(ownsData) { + OptImage(std::vector dims, void* data, Type type, unsigned int channelCount, Location location, bool usesOptFloat = false, bool ownsData = false) : + m_dims(dims), m_data(data), m_type(type), m_channelCount(channelCount), m_location(location), m_usesOptFloat(usesOptFloat), m_ownsData(ownsData) { } ~OptImage() { @@ -33,7 +33,7 @@ class OptImage { Location location() const { return m_location; } Type type() const { return m_type; } std::vector dims() const { return m_dims; } - bool isUnknown() const { return m_isUnknown; } + bool usesOptFloat() const { return m_usesOptFloat; } size_t dataSize() const { return totalElementsFromDims(m_dims) * OptImage::typeSize(m_type) * m_channelCount; } @@ -86,13 +86,13 @@ class OptImage { std::vector m_dims; unsigned int m_channelCount = 0; void* m_data = nullptr; - bool m_isUnknown = false; + bool m_usesOptFloat = false; Type m_type = Type::FLOAT; Location m_location = Location::CPU; }; -static std::shared_ptr createEmptyOptImage(std::vector dims, OptImage::Type type, unsigned int channelCount, OptImage::Location location, bool isUnknown) { +static std::shared_ptr createEmptyOptImage(std::vector dims, OptImage::Type type, unsigned int channelCount, OptImage::Location location, bool usesOptFloat) { void* data; size_t size = totalElementsFromDims(dims) * OptImage::typeSize(type) * channelCount; if (location == OptImage::Location::CPU) { @@ -100,7 +100,7 @@ static std::shared_ptr createEmptyOptImage(std::vector d } else { cudaSafeCall(cudaMalloc(&data, size)); } - return std::shared_ptr(new OptImage(dims, data, type, channelCount, location, isUnknown, true)); + return std::shared_ptr(new OptImage(dims, data, type, channelCount, location, usesOptFloat, true)); } static void copyImage(const std::shared_ptr& dst, const std::shared_ptr& src) { @@ -111,7 +111,7 @@ static void copyImage(const std::shared_ptr& dst, const std::shared_pt } static std::shared_ptr copyImageTo(const std::shared_ptr& original, OptImage::Location location) { - std::shared_ptr newIm = createEmptyOptImage(original->dims(), original->type(), original->channelCount(), location, original->isUnknown()); + std::shared_ptr newIm = createEmptyOptImage(original->dims(), original->type(), original->channelCount(), location, original->usesOptFloat()); copyImage(newIm, original); return newIm; } @@ -119,7 +119,7 @@ static std::shared_ptr copyImageTo(const std::shared_ptr& or // Only CPU->CPU static std::shared_ptr getDoubleImageFromFloatImage(const std::shared_ptr floatImage) { assert(floatImage->location() == OptImage::Location::CPU && floatImage->type() == OptImage::Type::FLOAT); - std::shared_ptr newIm = createEmptyOptImage(floatImage->dims(), OptImage::Type::DOUBLE, floatImage->channelCount(), floatImage->location(), floatImage->isUnknown()); + std::shared_ptr newIm = createEmptyOptImage(floatImage->dims(), OptImage::Type::DOUBLE, floatImage->channelCount(), floatImage->location(), floatImage->usesOptFloat()); float* fPtr = (float*)floatImage->data(); double* dPtr = (double*)newIm->data(); for (size_t i = 0; i < totalElementsFromDims(floatImage->dims()) * floatImage->channelCount(); ++i) { @@ -131,7 +131,7 @@ static std::shared_ptr getDoubleImageFromFloatImage(const std::shared_ // Only CPU->CPU static std::shared_ptr getFloatImageFromDoubleImage(const std::shared_ptr doubleImage) { assert(doubleImage->location() == OptImage::Location::CPU && doubleImage->type() == OptImage::Type::DOUBLE); - std::shared_ptr newIm = createEmptyOptImage(doubleImage->dims(), OptImage::Type::FLOAT, doubleImage->channelCount(), doubleImage->location(), doubleImage->isUnknown()); + std::shared_ptr newIm = createEmptyOptImage(doubleImage->dims(), OptImage::Type::FLOAT, doubleImage->channelCount(), doubleImage->location(), doubleImage->usesOptFloat()); double* dPtr = (double*)doubleImage->data(); float* fPtr = (float*)newIm->data(); for (size_t i = 0; i < totalElementsFromDims(doubleImage->dims()) * doubleImage->channelCount(); ++i) {