oiio: increased minimum version to 2.1.12

This commit is contained in:
itsmattkc
2020-11-19 11:06:40 +11:00
parent b463c5e6a5
commit 8c3f0ac64e
4 changed files with 5 additions and 59 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ find_package(OpenGL REQUIRED)
find_package(OpenColorIO 2.0.0 REQUIRED)
find_package(OpenImageIO 1.6 REQUIRED)
find_package(OpenImageIO 2.1.12 REQUIRED)
find_package(OpenEXR REQUIRED)
+3 -12
View File
@@ -100,10 +100,6 @@ FootagePtr OIIODecoder::Probe(const QString& filename, const QAtomicInt* cancell
// If we're here, we have a successful image open
in->close();
#if OIIO_VERSION < 10903
OIIO::ImageInput::destroy(in);
#endif
return footage;
}
@@ -235,11 +231,9 @@ bool OIIODecoder::OpenImageHandler(const QString &fn)
return false;
}
#if OIIO_VERSION < 20100
buffer_ = new OIIO::ImageBuf(OIIO::ImageSpec(spec.width, spec.height, spec.nchannels, type));
#else
buffer_ = new OIIO::ImageBuf(OIIO::ImageSpec(spec.width, spec.height, spec.nchannels, type), OIIO::InitializePixels::No);
#endif
buffer_ = new OIIO::ImageBuf(OIIO::ImageSpec(spec.width, spec.height, spec.nchannels, type),
OIIO::InitializePixels::No);
image_->read_image(type, buffer_->localpixels());
return true;
@@ -249,9 +243,6 @@ void OIIODecoder::CloseImageHandle()
{
if (image_) {
image_->close();
#if OIIO_VERSION < 10903
OIIO::ImageInput::destroy(image_);
#endif
image_ = nullptr;
}
-4
View File
@@ -48,11 +48,7 @@ protected:
virtual void CloseInternal() override;
private:
#if OIIO_VERSION < 10903
OIIO::ImageInput* image_;
#else
std::unique_ptr<OIIO::ImageInput> image_;
#endif
static bool FileTypeIsSupported(const QString& fn);
+1 -42
View File
@@ -19,66 +19,25 @@
***/
#include "oiioutils.h"
#if OIIO_VERSION < 20112
#include "render/videoparams.h"
#endif
namespace olive {
void OIIOUtils::FrameToBuffer(const Frame* frame, OIIO::ImageBuf *buf)
{
#if OIIO_VERSION < 20112
//
// Workaround for OIIO bug that ignores destination stride in versions OLDER than 2.1.12
//
// See more: https://github.com/OpenImageIO/oiio/pull/2487
//
int width_in_bytes = frame->width() * VideoParams::GetBytesPerPixel(frame->format(), frame->channel_count());
for (int i=0;i<buf->spec().height;i++) {
memcpy(
#if OIIO_VERSION < 10903
reinterpret_cast<char*>(buf->localpixels()) + i * width_in_bytes,
#else
reinterpret_cast<char*>(buf->localpixels()) + i * buf->scanline_stride(),
#endif
frame->const_data() + i * frame->linesize_bytes(),
width_in_bytes);
}
#else
buf->set_pixels(OIIO::ROI(),
buf->spec().format,
frame->const_data(),
OIIO::AutoStride,
frame->linesize_bytes());
#endif
}
void OIIOUtils::BufferToFrame(OIIO::ImageBuf *buf, Frame* frame)
{
#if OIIO_VERSION < 20112
//
// Workaround for OIIO bug that ignores destination stride in versions OLDER than 2.1.12
//
// See more: https://github.com/OpenImageIO/oiio/pull/2487
//
int width_in_bytes = frame->width() * VideoParams::GetBytesPerPixel(frame->format(), frame->channel_count());
for (int i=0;i<buf->spec().height;i++) {
memcpy(frame->data() + i * frame->linesize_bytes(),
#if OIIO_VERSION < 10903
reinterpret_cast<const char*>(buf->localpixels()) + i * width_in_bytes,
#else
reinterpret_cast<const char*>(buf->localpixels()) + i * buf->scanline_stride(),
#endif
width_in_bytes);
}
#else
buf->get_pixels(OIIO::ROI(),
buf->spec().format,
frame->data(),
OIIO::AutoStride,
frame->linesize_bytes());
#endif
}
rational OIIOUtils::GetPixelAspectRatioFromOIIO(const OIIO::ImageSpec &spec)