diff --git a/CMakeLists.txt b/CMakeLists.txt index d2d760892..9b6312bec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/app/codec/oiio/oiiodecoder.cpp b/app/codec/oiio/oiiodecoder.cpp index 7f4a280c1..d6f1b124c 100644 --- a/app/codec/oiio/oiiodecoder.cpp +++ b/app/codec/oiio/oiiodecoder.cpp @@ -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; } diff --git a/app/codec/oiio/oiiodecoder.h b/app/codec/oiio/oiiodecoder.h index 3a6398d45..9b06df1d6 100644 --- a/app/codec/oiio/oiiodecoder.h +++ b/app/codec/oiio/oiiodecoder.h @@ -48,11 +48,7 @@ protected: virtual void CloseInternal() override; private: -#if OIIO_VERSION < 10903 - OIIO::ImageInput* image_; -#else std::unique_ptr image_; -#endif static bool FileTypeIsSupported(const QString& fn); diff --git a/app/common/oiioutils.cpp b/app/common/oiioutils.cpp index 1c3067ccc..c2d3eb738 100644 --- a/app/common/oiioutils.cpp +++ b/app/common/oiioutils.cpp @@ -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;ispec().height;i++) { - memcpy( -#if OIIO_VERSION < 10903 - reinterpret_cast(buf->localpixels()) + i * width_in_bytes, -#else - reinterpret_cast(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;ispec().height;i++) { - memcpy(frame->data() + i * frame->linesize_bytes(), -#if OIIO_VERSION < 10903 - reinterpret_cast(buf->localpixels()) + i * width_in_bytes, -#else - reinterpret_cast(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)