diff --git a/app/render/pixelformat.cpp b/app/render/pixelformat.cpp index d37aa3f36..9fa451c3b 100644 --- a/app/render/pixelformat.cpp +++ b/app/render/pixelformat.cpp @@ -20,6 +20,7 @@ #include "pixelformat.h" +#include "OpenImageIO/imagebuf.h" #include #include #include @@ -47,7 +48,7 @@ bool PixelFormat::FormatHasAlphaChannel(const PixelFormat::Format &format) return false; } -OIIO::TypeDesc PixelFormat::GetOIIOTypeDesc(const PixelFormat::Format &format) +OIIO::TypeDesc::BASETYPE PixelFormat::GetOIIOTypeDesc(const PixelFormat::Format &format) { switch (format) { case PixelFormat::PIX_FMT_RGB8: @@ -242,13 +243,12 @@ FramePtr PixelFormat::ConvertPixelFormat(FramePtr frame, const PixelFormat::Form converted->set_format(dest_format); converted->allocate(); - OIIO::TypeDesc src_type = GetOIIOTypeDesc(frame->format()); - OIIO::TypeDesc dst_type = GetOIIOTypeDesc(dest_format); + OIIO::ImageBuf src(OIIO::ImageSpec(frame->width(), frame->height(), ChannelCount(frame->format()), GetOIIOTypeDesc(frame->format())), frame->data()); + OIIO::ImageBuf dst(OIIO::ImageSpec(converted->width(), converted->height(), ChannelCount(converted->format()), GetOIIOTypeDesc(converted->format())), converted->data()); - if (OIIO::convert_type(src_type, frame->data(), dst_type, converted->data())) { + if (dst.copy_pixels(src)) { return converted; } else { - qDebug() << "Failed to convert type:" << OIIO::geterror().c_str(); return nullptr; } } diff --git a/app/render/pixelformat.h b/app/render/pixelformat.h index eec25f1d8..7f9a59555 100644 --- a/app/render/pixelformat.h +++ b/app/render/pixelformat.h @@ -117,7 +117,7 @@ public: /** * @brief Get corresponding OpenImageIO TypeDesc for a given pixel format */ - static OIIO::TypeDesc GetOIIOTypeDesc(const Format& format); + static OIIO::TypeDesc::BASETYPE GetOIIOTypeDesc(const Format& format); /** * @brief Get format name