diff options
91 files changed, 339 insertions, 224 deletions
diff --git a/src/multimedia/platform/qplatformmediaintegration.cpp b/src/multimedia/platform/qplatformmediaintegration.cpp index dda00de61..4bacc488f 100644 --- a/src/multimedia/platform/qplatformmediaintegration.cpp +++ b/src/multimedia/platform/qplatformmediaintegration.cpp @@ -207,6 +207,12 @@ QLatin1String QPlatformMediaIntegration::name() return m_backendName; } +QVideoFrame QPlatformMediaIntegration::convertVideoFrame(QVideoFrame &, + const QVideoFrameFormat &) +{ + return {}; +} + QPlatformMediaIntegration::QPlatformMediaIntegration(QLatin1String name) : m_backendName(name) { } QPlatformMediaIntegration::~QPlatformMediaIntegration() = default; diff --git a/src/multimedia/platform/qplatformmediaintegration_p.h b/src/multimedia/platform/qplatformmediaintegration_p.h index 19fa40baf..b949af02a 100644 --- a/src/multimedia/platform/qplatformmediaintegration_p.h +++ b/src/multimedia/platform/qplatformmediaintegration_p.h @@ -53,6 +53,7 @@ class QPlatformAudioOutput; class QPlatformVideoDevices; class QCapturableWindow; class QPlatformCapturableWindows; +class QVideoFrame; class Q_MULTIMEDIA_EXPORT QPlatformMediaIntegration : public QObject { @@ -96,6 +97,9 @@ public: static QStringList availableBackends(); QLatin1String name(); // for unit tests + // Convert a QVideoFrame to the destination format + virtual QVideoFrame convertVideoFrame(QVideoFrame &, const QVideoFrameFormat &); + protected: virtual QPlatformMediaFormatInfo *createFormatInfo(); diff --git a/src/plugins/multimedia/ffmpeg/CMakeLists.txt b/src/plugins/multimedia/ffmpeg/CMakeLists.txt index 68a09b20f..b18cea002 100644 --- a/src/plugins/multimedia/ffmpeg/CMakeLists.txt +++ b/src/plugins/multimedia/ffmpeg/CMakeLists.txt @@ -21,6 +21,7 @@ qt_internal_add_plugin(QFFmpegMediaPlugin qffmpegavaudioformat.cpp qffmpegavaudioformat_p.h qffmpegaudiodecoder.cpp qffmpegaudiodecoder_p.h qffmpegaudioinput.cpp qffmpegaudioinput_p.h + qffmpegconverter.cpp qffmpegconverter_p.h qffmpeghwaccel.cpp qffmpeghwaccel_p.h qffmpegmediametadata.cpp qffmpegmediametadata_p.h qffmpegmediaplayer.cpp qffmpegmediaplayer_p.h diff --git a/src/plugins/multimedia/ffmpeg/qffmpegconverter.cpp b/src/plugins/multimedia/ffmpeg/qffmpegconverter.cpp new file mode 100644 index 000000000..e947394b6 --- /dev/null +++ b/src/plugins/multimedia/ffmpeg/qffmpegconverter.cpp @@ -0,0 +1,270 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qffmpegconverter_p.h" +#include <QtMultimedia/qvideoframeformat.h> +#include <QtMultimedia/qvideoframe.h> +#include <QtCore/qloggingcategory.h> +#include <private/qvideotexturehelper_p.h> + +extern "C" { +#include <libswscale/swscale.h> +} + +QT_BEGIN_NAMESPACE + +namespace { + +Q_LOGGING_CATEGORY(lc, "qt.multimedia.ffmpeg.converter"); + + +// Converts to FFmpeg pixel format. This function differs from +// QFFmpegVideoBuffer::toAVPixelFormat which only covers the subset +// of pixel formats required for encoding. Here we need to cover more +// pixel formats to be able to generate test images for decoding/display +AVPixelFormat toAVPixelFormat(QVideoFrameFormat::PixelFormat pixelFormat) +{ + switch (pixelFormat) { + default: + case QVideoFrameFormat::Format_Invalid: + case QVideoFrameFormat::Format_AYUV: + case QVideoFrameFormat::Format_AYUV_Premultiplied: + case QVideoFrameFormat::Format_YV12: + return AV_PIX_FMT_NONE; // TODO: FIXME + case QVideoFrameFormat::Format_IMC1: + case QVideoFrameFormat::Format_IMC3: + case QVideoFrameFormat::Format_IMC2: + case QVideoFrameFormat::Format_IMC4: + return AV_PIX_FMT_YUV420P; + case QVideoFrameFormat::Format_Jpeg: + return AV_PIX_FMT_BGRA; + case QVideoFrameFormat::Format_ARGB8888: + return AV_PIX_FMT_ARGB; + case QVideoFrameFormat::Format_ARGB8888_Premultiplied: + case QVideoFrameFormat::Format_XRGB8888: + return AV_PIX_FMT_0RGB; + case QVideoFrameFormat::Format_BGRA8888: + return AV_PIX_FMT_BGRA; + case QVideoFrameFormat::Format_BGRA8888_Premultiplied: + case QVideoFrameFormat::Format_BGRX8888: + return AV_PIX_FMT_BGR0; + case QVideoFrameFormat::Format_ABGR8888: + return AV_PIX_FMT_ABGR; + case QVideoFrameFormat::Format_XBGR8888: + return AV_PIX_FMT_0BGR; + case QVideoFrameFormat::Format_RGBA8888: + return AV_PIX_FMT_RGBA; + case QVideoFrameFormat::Format_RGBX8888: + return AV_PIX_FMT_RGB0; + case QVideoFrameFormat::Format_YUV422P: + return AV_PIX_FMT_YUV422P; + case QVideoFrameFormat::Format_YUV420P: + return AV_PIX_FMT_YUV420P; + case QVideoFrameFormat::Format_YUV420P10: + return AV_PIX_FMT_YUV420P10; + case QVideoFrameFormat::Format_UYVY: + return AV_PIX_FMT_UYVY422; + case QVideoFrameFormat::Format_YUYV: + return AV_PIX_FMT_YUYV422; + case QVideoFrameFormat::Format_NV12: + return AV_PIX_FMT_NV12; + case QVideoFrameFormat::Format_NV21: + return AV_PIX_FMT_NV21; + case QVideoFrameFormat::Format_Y8: + return AV_PIX_FMT_GRAY8; + case QVideoFrameFormat::Format_Y16: + return AV_PIX_FMT_GRAY16; + case QVideoFrameFormat::Format_P010: + return AV_PIX_FMT_P010; + case QVideoFrameFormat::Format_P016: + return AV_PIX_FMT_P016; + case QVideoFrameFormat::Format_SamplerExternalOES: + return AV_PIX_FMT_MEDIACODEC; + } +} + +struct SwsFrameData +{ + static constexpr int arraySize = 4; // Array size required by sws_scale + std::array<uchar *, arraySize> bits; + std::array<int, arraySize> stride; +}; + +SwsFrameData getSwsData(QVideoFrame &dst) +{ + switch (dst.pixelFormat()) { + case QVideoFrameFormat::Format_IMC1: + return { { dst.bits(0), dst.bits(2), dst.bits(1), nullptr }, + { dst.bytesPerLine(0), dst.bytesPerLine(2), dst.bytesPerLine(1), 0 } }; + + case QVideoFrameFormat::Format_IMC2: + return { { dst.bits(0), dst.bits(1) + dst.bytesPerLine(1) / 2, dst.bits(1), nullptr }, + { dst.bytesPerLine(0), dst.bytesPerLine(1), dst.bytesPerLine(1), 0 } }; + + case QVideoFrameFormat::Format_IMC4: + return { { dst.bits(0), dst.bits(1), dst.bits(1) + dst.bytesPerLine(1) / 2, nullptr }, + { dst.bytesPerLine(0), dst.bytesPerLine(1), dst.bytesPerLine(1), 0 } }; + default: + return { { dst.bits(0), dst.bits(1), dst.bits(2), nullptr }, + { dst.bytesPerLine(0), dst.bytesPerLine(1), dst.bytesPerLine(2), 0 } }; + } +} + +struct SwsColorSpace +{ + int colorSpace; + int colorRange; // 0 - mpeg/video, 1 - jpeg/full +}; + +// Qt heuristics for determining color space requires checking +// both frame color space and range. This function mimics logic +// used elsewhere in Qt Multimedia. +SwsColorSpace toSwsColorSpace(QVideoFrameFormat::ColorRange colorRange, + QVideoFrameFormat::ColorSpace colorSpace) +{ + const int avRange = colorRange == QVideoFrameFormat::ColorRange_Video ? 0 : 1; + + switch (colorSpace) { + case QVideoFrameFormat::ColorSpace_BT601: + if (colorRange == QVideoFrameFormat::ColorRange_Full) + return { SWS_CS_ITU709, 1 }; // TODO: FIXME - Not exact match + return { SWS_CS_ITU601, 0 }; + case QVideoFrameFormat::ColorSpace_BT709: + return { SWS_CS_ITU709, avRange }; + case QVideoFrameFormat::ColorSpace_AdobeRgb: + return { SWS_CS_ITU601, 1 }; // TODO: Why do ITU601 and Adobe RGB match well? + case QVideoFrameFormat::ColorSpace_BT2020: + return { SWS_CS_BT2020, avRange }; + case QVideoFrameFormat::ColorSpace_Undefined: + default: + return { SWS_CS_DEFAULT, avRange }; + } +} + +using SwsContextUPtr = std::unique_ptr<SwsContext, decltype(&sws_freeContext)>; +using PixelFormat = QVideoFrameFormat::PixelFormat; + +// clang-format off + +SwsContextUPtr createConverter(const QSize &srcSize, PixelFormat srcPixFmt, + const QSize &dstSize, PixelFormat dstPixFmt) +{ + SwsContext* context = sws_getContext( + srcSize.width(), srcSize.height(), toAVPixelFormat(srcPixFmt), + dstSize.width(), dstSize.height(), toAVPixelFormat(dstPixFmt), + SWS_BILINEAR, nullptr, nullptr, nullptr); + + return { context, &sws_freeContext }; +} + +bool setColorSpaceDetails(SwsContext *context, + const QVideoFrameFormat &srcFormat, + const QVideoFrameFormat &dstFormat) +{ + const SwsColorSpace src = toSwsColorSpace(srcFormat.colorRange(), srcFormat.colorSpace()); + const SwsColorSpace dst = toSwsColorSpace(dstFormat.colorRange(), dstFormat.colorSpace()); + + constexpr int brightness = 0; + constexpr int contrast = 0; + constexpr int saturation = 0; + const int status = sws_setColorspaceDetails(context, + sws_getCoefficients(src.colorSpace), src.colorRange, + sws_getCoefficients(dst.colorSpace), dst.colorRange, + brightness, contrast, saturation); + + return status == 0; +} + +bool convert(SwsContext *context, QVideoFrame &src, int srcHeight, QVideoFrame &dst) +{ + if (!src.map(QVideoFrame::ReadOnly)) + return false; + + QScopeGuard unmapSrc{[&] { + src.unmap(); + }}; + + if (!dst.map(QVideoFrame::WriteOnly)) + return false; + + QScopeGuard unmapDst{[&] { + dst.unmap(); + }}; + + const SwsFrameData srcData = getSwsData(src); + const SwsFrameData dstData = getSwsData(dst); + + constexpr int firstSrcSliceRow = 0; + const int scaledHeight = sws_scale(context, + srcData.bits.data(), srcData.stride.data(), + firstSrcSliceRow, srcHeight, + dstData.bits.data(), dstData.stride.data()); + + if (scaledHeight != srcHeight) + return false; + + return true; +} + +// Ensure even size if using planar format with chroma subsampling +QSize adjustSize(const QSize& size, PixelFormat srcFmt, PixelFormat dstFmt) +{ + const auto* srcDesc = QVideoTextureHelper::textureDescription(srcFmt); + const auto* dstDesc = QVideoTextureHelper::textureDescription(dstFmt); + + QSize output = size; + for (const auto desc : { srcDesc, dstDesc }) { + for (int i = 0; i < desc->nplanes; ++i) { + // TODO: Assumes that max subsampling is 2 + if (desc->sizeScale[i].x != 1) + output.setWidth(output.width() & ~1); // Make even + + if (desc->sizeScale[i].y != 1) + output.setHeight(output.height() & ~1); // Make even + } + } + + return output; +} + +} // namespace + +// Converts a video frame to the dstFormat video frame format. +QVideoFrame convertFrame(QVideoFrame &src, const QVideoFrameFormat &dstFormat) +{ + if (src.size() != dstFormat.frameSize()) { + qCCritical(lc) << "Resizing is not supported"; + return {}; + } + + // Adjust size to even width/height if we have chroma subsampling + const QSize size = adjustSize(src.size(), src.pixelFormat(), dstFormat.pixelFormat()); + if (size != src.size()) + qCWarning(lc) << "Input truncated to even width/height"; + + const SwsContextUPtr conv = createConverter( + size, src.pixelFormat(), size, dstFormat.pixelFormat()); + + if (!conv) { + qCCritical(lc) << "Failed to create SW converter"; + return {}; + } + + if (!setColorSpaceDetails(conv.get(), src.surfaceFormat(), dstFormat)) { + qCCritical(lc) << "Failed to set color space details"; + return {}; + } + + QVideoFrame dst{ dstFormat }; + + if (!convert(conv.get(), src, size.height(), dst)) { + qCCritical(lc) << "Frame conversion failed"; + return {}; + } + + return dst; +} + +// clang-format on + +QT_END_NAMESPACE diff --git a/src/plugins/multimedia/ffmpeg/qffmpegconverter_p.h b/src/plugins/multimedia/ffmpeg/qffmpegconverter_p.h new file mode 100644 index 000000000..57ee3135f --- /dev/null +++ b/src/plugins/multimedia/ffmpeg/qffmpegconverter_p.h @@ -0,0 +1,30 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QFFMPEGCONVERTER_P_H +#define QFFMPEGCONVERTER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qtconfigmacros.h> +#include <private/qtmultimediaglobal_p.h> + +QT_BEGIN_NAMESPACE + +class QVideoFrameFormat; +class QVideoFrame; + +QVideoFrame convertFrame(QVideoFrame &src, const QVideoFrameFormat &dstFormat); + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration.cpp b/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration.cpp index 291ca1111..aefe6102e 100644 --- a/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration.cpp +++ b/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration.cpp @@ -15,6 +15,7 @@ #include "qffmpegresampler_p.h" #include "qffmpegsymbolsresolve_p.h" #include "qgrabwindowsurfacecapture_p.h" +#include "qffmpegconverter_p.h" #ifdef Q_OS_MACOS #include <VideoToolbox/VideoToolbox.h> @@ -308,6 +309,12 @@ QMaybe<QPlatformAudioInput *> QFFmpegMediaIntegration::createAudioInput(QAudioIn return new QFFmpegAudioInput(input); } +QVideoFrame QFFmpegMediaIntegration::convertVideoFrame(QVideoFrame &srcFrame, + const QVideoFrameFormat &destFormat) +{ + return convertFrame(srcFrame, destFormat); +} + QPlatformMediaFormatInfo *QFFmpegMediaIntegration::createFormatInfo() { return new QFFmpegMediaFormatInfo; diff --git a/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration_p.h b/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration_p.h index b8787bcc4..473a5f044 100644 --- a/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration_p.h +++ b/src/plugins/multimedia/ffmpeg/qffmpegmediaintegration_p.h @@ -41,6 +41,9 @@ public: QMaybe<QPlatformAudioInput *> createAudioInput(QAudioInput *input) override; // QPlatformAudioOutput *createAudioOutput(QAudioOutput *) override; + QVideoFrame convertVideoFrame(QVideoFrame &srcFrame, + const QVideoFrameFormat &destFormat) override; + protected: QPlatformMediaFormatInfo *createFormatInfo() override; diff --git a/tests/auto/unit/multimedia/CMakeLists.txt b/tests/auto/unit/multimedia/CMakeLists.txt index 598bad5ad..f259691d0 100644 --- a/tests/auto/unit/multimedia/CMakeLists.txt +++ b/tests/auto/unit/multimedia/CMakeLists.txt @@ -19,7 +19,9 @@ add_subdirectory(qmediatimerange) add_subdirectory(qmultimediautils) add_subdirectory(qvideoframe) add_subdirectory(qvideoframeformat) -add_subdirectory(qvideoframecolormanagement) +if(QT_FEATURE_ffmpeg) + add_subdirectory(qvideoframecolormanagement) +endif() add_subdirectory(qaudiobuffer) add_subdirectory(qaudiodecoder) add_subdirectory(qsamplecache) diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/CMakeLists.txt b/tests/auto/unit/multimedia/qvideoframecolormanagement/CMakeLists.txt index ed1aa7062..6a6e6413b 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/CMakeLists.txt +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/CMakeLists.txt @@ -7,7 +7,6 @@ file(GLOB_RECURSE test_data_glob testdata/*) list(APPEND testdata_resource_files ${test_data_glob}) - qt_internal_add_test(tst_qvideoframecolormanagement SOURCES tst_qvideoframecolormanagement.cpp diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg Binary files differindex 5ed72dbd8..52b0f620b 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_AdobeRgb_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_AdobeRgb_Full.png Binary files differindex 5ee0ffd50..5a582dc54 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_AdobeRgb_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_AdobeRgb_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_AdobeRgb_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_AdobeRgb_Video.png Binary files differindex 5ee0ffd50..5a582dc54 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_AdobeRgb_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_AdobeRgb_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT2020_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT2020_Full.png Binary files differindex 1ffaa49a7..d8a0ca1de 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT2020_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT2020_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT2020_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT2020_Video.png Binary files differindex bbb449843..2c090ed5b 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT2020_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT2020_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT601_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT601_Full.png Binary files differindex 8d23d5f97..1549fe94c 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT601_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT601_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT601_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT601_Video.png Binary files differindex b93a5bbb5..25a7b2360 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT601_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT601_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT709_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT709_Full.png Binary files differindex fd03d6c1b..4e589c8a3 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT709_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT709_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT709_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT709_Video.png Binary files differindex ba25be895..468533e75 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT709_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_420p_BT709_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_AdobeRgb_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_AdobeRgb_Full.png Binary files differindex 1f7981cfb..5a542b470 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_AdobeRgb_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_AdobeRgb_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_AdobeRgb_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_AdobeRgb_Video.png Binary files differindex 1f7981cfb..5a542b470 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_AdobeRgb_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_AdobeRgb_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT2020_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT2020_Full.png Binary files differindex 15cc4c820..54d72d4f5 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT2020_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT2020_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT2020_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT2020_Video.png Binary files differindex 2adc8f256..ca8dd008a 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT2020_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT2020_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT601_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT601_Full.png Binary files differindex 7e4dda498..e610e4856 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT601_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT601_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT601_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT601_Video.png Binary files differindex 041390cf2..59bf95269 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT601_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT601_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT709_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT709_Full.png Binary files differindex f8ebfd1c1..38e762b24 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT709_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT709_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT709_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT709_Video.png Binary files differindex c4f0d8481..3e32a0071 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT709_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_422p_BT709_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_AdobeRgb_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_AdobeRgb_Full.png Binary files differindex 5ee0ffd50..5a582dc54 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_AdobeRgb_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_AdobeRgb_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_AdobeRgb_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_AdobeRgb_Video.png Binary files differindex 5ee0ffd50..5a582dc54 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_AdobeRgb_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_AdobeRgb_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT2020_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT2020_Full.png Binary files differindex 1ffaa49a7..d8a0ca1de 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT2020_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT2020_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT2020_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT2020_Video.png Binary files differindex bbb449843..2c090ed5b 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT2020_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT2020_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT601_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT601_Full.png Binary files differindex 8d23d5f97..1549fe94c 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT601_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT601_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT601_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT601_Video.png Binary files differindex b93a5bbb5..25a7b2360 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT601_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT601_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT709_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT709_Full.png Binary files differindex fd03d6c1b..4e589c8a3 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT709_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT709_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT709_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT709_Video.png Binary files differindex ba25be895..468533e75 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT709_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_BT709_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_AdobeRgb_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_AdobeRgb_Full.png Binary files differindex ae268bb2c..9ff1e777f 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_AdobeRgb_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_AdobeRgb_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_AdobeRgb_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_AdobeRgb_Video.png Binary files differindex ae268bb2c..9ff1e777f 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_AdobeRgb_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_AdobeRgb_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT2020_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT2020_Full.png Binary files differindex 936c09291..87de0d49b 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT2020_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT2020_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT2020_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT2020_Video.png Binary files differindex b82d839ff..b3ba1649c 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT2020_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT2020_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT601_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT601_Full.png Binary files differindex b31fe973f..d5e1442dc 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT601_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT601_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT601_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT601_Video.png Binary files differindex acee1379f..2de256386 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT601_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT601_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT709_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT709_Full.png Binary files differindex 29907ab63..a23f50591 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT709_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT709_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT709_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT709_Video.png Binary files differindex 484bebb18..8a628ed64 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT709_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_BT709_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_AdobeRgb_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_AdobeRgb_Full.png Binary files differindex 5ee0ffd50..5a582dc54 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_AdobeRgb_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_AdobeRgb_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_AdobeRgb_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_AdobeRgb_Video.png Binary files differindex 5ee0ffd50..5a582dc54 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_AdobeRgb_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_AdobeRgb_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT2020_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT2020_Full.png Binary files differindex 1ffaa49a7..d8a0ca1de 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT2020_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT2020_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT2020_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT2020_Video.png Binary files differindex bbb449843..2c090ed5b 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT2020_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT2020_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT601_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT601_Full.png Binary files differindex 8d23d5f97..1549fe94c 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT601_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT601_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT601_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT601_Video.png Binary files differindex b93a5bbb5..25a7b2360 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT601_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT601_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT709_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT709_Full.png Binary files differindex fd03d6c1b..4e589c8a3 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT709_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT709_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT709_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT709_Video.png Binary files differindex ba25be895..468533e75 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT709_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_BT709_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_AdobeRgb_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_AdobeRgb_Full.png Binary files differindex 5a9b205d7..8c75a4d17 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_AdobeRgb_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_AdobeRgb_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_AdobeRgb_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_AdobeRgb_Video.png Binary files differindex 5a9b205d7..8c75a4d17 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_AdobeRgb_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_AdobeRgb_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT2020_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT2020_Full.png Binary files differindex 7b4bf0e80..c9f034cc5 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT2020_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT2020_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT2020_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT2020_Video.png Binary files differindex c4337e393..5fa2df07c 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT2020_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT2020_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT601_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT601_Full.png Binary files differindex ffb3cb44d..164e66de3 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT601_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT601_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT601_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT601_Video.png Binary files differindex b0bb04ff6..2d8594007 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT601_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT601_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT709_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT709_Full.png Binary files differindex 8d0863068..17df5fd8d 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT709_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT709_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT709_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT709_Video.png Binary files differindex 13768c1f8..aab94ac74 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT709_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_BT709_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_AdobeRgb_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_AdobeRgb_Full.png Binary files differindex 5ee0ffd50..5a582dc54 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_AdobeRgb_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_AdobeRgb_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_AdobeRgb_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_AdobeRgb_Video.png Binary files differindex 5ee0ffd50..5a582dc54 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_AdobeRgb_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_AdobeRgb_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT2020_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT2020_Full.png Binary files differindex 1ffaa49a7..d8a0ca1de 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT2020_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT2020_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT2020_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT2020_Video.png Binary files differindex bbb449843..2c090ed5b 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT2020_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT2020_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT601_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT601_Full.png Binary files differindex 8d23d5f97..1549fe94c 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT601_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT601_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT601_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT601_Video.png Binary files differindex b93a5bbb5..25a7b2360 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT601_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT601_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT709_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT709_Full.png Binary files differindex fd03d6c1b..4e589c8a3 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT709_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT709_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT709_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT709_Video.png Binary files differindex ba25be895..468533e75 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT709_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_BT709_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_AdobeRgb_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_AdobeRgb_Full.png Binary files differindex 5ee0ffd50..5a582dc54 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_AdobeRgb_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_AdobeRgb_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_AdobeRgb_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_AdobeRgb_Video.png Binary files differindex 5ee0ffd50..5a582dc54 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_AdobeRgb_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_AdobeRgb_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT2020_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT2020_Full.png Binary files differindex 1ffaa49a7..d8a0ca1de 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT2020_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT2020_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT2020_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT2020_Video.png Binary files differindex bbb449843..2c090ed5b 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT2020_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT2020_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT601_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT601_Full.png Binary files differindex 8d23d5f97..1549fe94c 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT601_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT601_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT601_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT601_Video.png Binary files differindex b93a5bbb5..25a7b2360 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT601_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT601_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT709_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT709_Full.png Binary files differindex fd03d6c1b..4e589c8a3 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT709_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT709_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT709_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT709_Video.png Binary files differindex ba25be895..468533e75 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT709_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_BT709_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_AdobeRgb_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_AdobeRgb_Full.png Binary files differindex 4fd00f938..a866a8a13 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_AdobeRgb_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_AdobeRgb_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_AdobeRgb_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_AdobeRgb_Video.png Binary files differindex 4fd00f938..a866a8a13 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_AdobeRgb_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_AdobeRgb_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT2020_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT2020_Full.png Binary files differindex 309454576..dac578e73 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT2020_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT2020_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT2020_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT2020_Video.png Binary files differindex f97e71817..715629c72 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT2020_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT2020_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT601_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT601_Full.png Binary files differindex d513a8123..48ac3ced4 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT601_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT601_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT601_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT601_Video.png Binary files differindex 6e9c36b39..1e1c0faba 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT601_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT601_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT709_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT709_Full.png Binary files differindex c0568cb62..9b8b28fc5 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT709_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT709_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT709_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT709_Video.png Binary files differindex 207fc0be1..19af87e19 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT709_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_BT709_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_AdobeRgb_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_AdobeRgb_Full.png Binary files differindex 4fd00f938..a866a8a13 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_AdobeRgb_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_AdobeRgb_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_AdobeRgb_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_AdobeRgb_Video.png Binary files differindex 4fd00f938..a866a8a13 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_AdobeRgb_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_AdobeRgb_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT2020_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT2020_Full.png Binary files differindex 309454576..dac578e73 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT2020_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT2020_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT2020_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT2020_Video.png Binary files differindex f97e71817..715629c72 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT2020_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT2020_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT601_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT601_Full.png Binary files differindex d513a8123..48ac3ced4 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT601_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT601_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT601_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT601_Video.png Binary files differindex 6e9c36b39..1e1c0faba 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT601_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT601_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT709_Full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT709_Full.png Binary files differindex c0568cb62..9b8b28fc5 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT709_Full.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT709_Full.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT709_Video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT709_Video.png Binary files differindex 207fc0be1..19af87e19 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT709_Video.png +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_BT709_Video.png diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/tst_qvideoframecolormanagement.cpp b/tests/auto/unit/multimedia/qvideoframecolormanagement/tst_qvideoframecolormanagement.cpp index 83e78d2d8..b91352872 100644 --- a/tests/auto/unit/multimedia/qvideoframecolormanagement/tst_qvideoframecolormanagement.cpp +++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/tst_qvideoframecolormanagement.cpp @@ -6,6 +6,8 @@ #include <qvideoframe.h> #include <qvideoframeformat.h> #include "private/qmemoryvideobuffer_p.h" +#include "private/qplatformmediaintegration_p.h" +#include "private/qimagevideobuffer_p.h" #include <QtGui/QColorSpace> #include <QtGui/QImage> #include <QtCore/QPointer> @@ -118,206 +120,6 @@ QString path(const QTemporaryDir &dir, const TestParams ¶m, const QString &s return dir.filePath(name(param) + suffix); } -// clang-format off - -class RgbToYCbCrConverter -{ -public: - constexpr RgbToYCbCrConverter(double Wr, double Wg) - : m_wr{ Wr }, m_wg{ Wg }, m_wb{ 1.0 - Wr - Wg } - { } - - // Calculate Y in range [0..255] - constexpr double Y(QRgb rgb) const - { - return m_wr * qRed(rgb) + m_wg * qGreen(rgb) + m_wb * qBlue(rgb); - } - - // Calculate Cb in range [0..255] - constexpr double Cb(QRgb rgb) const - { - return (qBlue(rgb) - Y(rgb)) / (2 * (1.0 - m_wb)) + 255.0 / 2; - } - - // Calculate Cr in range [0..255] - constexpr double Cr(QRgb rgb) const - { - return (qRed(rgb) - Y(rgb)) / (2 * (1.0 - m_wr)) + 255.0 / 2; - } - -private: - const double m_wr; - const double m_wg; - const double m_wb; -}; - -// clang-format on - -constexpr RgbToYCbCrConverter rgb2yuv_bt709_full{0.2126, 0.7152}; - -constexpr uchar double2uchar(double v) -{ - return static_cast<uchar>(std::clamp(v + 0.5, 0.5, 255.5)); -} - -constexpr uchar rgb2y(const QRgb &rgb) -{ - const double Y = rgb2yuv_bt709_full.Y(rgb); - return double2uchar(Y); -} - -constexpr uchar rgb2u(const QRgb &rgb) -{ - const double U = rgb2yuv_bt709_full.Cb(rgb); - return double2uchar(U); -} - -constexpr uchar rgb2v(const QRgb &rgb) -{ - const double V = rgb2yuv_bt709_full.Cr(rgb); - return double2uchar(V); -} - -void rgb2y_planar(const QImage &image, QVideoFrame &frame, int yPlane) -{ - uchar *bits = frame.bits(yPlane); - for (int row = 0; row < image.height(); ++row) { - for (int col = 0; col < image.width(); ++col) { - const QRgb pixel = image.pixel(col, row); - bits[col] = rgb2y(pixel); - } - bits += frame.bytesPerLine(yPlane); - } -} - -void rgb2uv_planar(const QImage &image, QVideoFrame &frame) -{ - uchar *vBits = nullptr; - uchar *uBits = nullptr; - int vStride = 0; - int uStride = 0; - int sampleIncrement = 1; - int verticalScale = 2; - if (frame.pixelFormat() == QVideoFrameFormat::Format_IMC1) { - uStride = frame.bytesPerLine(2); - vStride = frame.bytesPerLine(1); - uBits = frame.bits(2); - vBits = frame.bits(1); - } else if (frame.pixelFormat() == QVideoFrameFormat::Format_IMC2) { - uStride = frame.bytesPerLine(1); - vStride = frame.bytesPerLine(1); - uBits = frame.bits(1) + vStride / 2; - vBits = frame.bits(1); - } else if (frame.pixelFormat() == QVideoFrameFormat::Format_IMC3) { - uStride = frame.bytesPerLine(1); - vStride = frame.bytesPerLine(2); - uBits = frame.bits(1); - vBits = frame.bits(2); - } else if (frame.pixelFormat() == QVideoFrameFormat::Format_IMC4) { - uStride = frame.bytesPerLine(1); - vStride = frame.bytesPerLine(1); - uBits = frame.bits(1); - vBits = frame.bits(1) + vStride / 2; - } else if (frame.pixelFormat() == QVideoFrameFormat::Format_NV12) { - uStride = frame.bytesPerLine(1); - vStride = frame.bytesPerLine(1); - uBits = frame.bits(1); - vBits = frame.bits(1) + 1; - sampleIncrement = 2; - } else if (frame.pixelFormat() == QVideoFrameFormat::Format_NV21) { - uStride = frame.bytesPerLine(1); - vStride = frame.bytesPerLine(1); - uBits = frame.bits(1) + 1; - vBits = frame.bits(1); - sampleIncrement = 2; - } else if (frame.pixelFormat() == QVideoFrameFormat::Format_YUV420P) { - uStride = frame.bytesPerLine(1); - vStride = frame.bytesPerLine(2); - uBits = frame.bits(1); - vBits = frame.bits(2); - } else if (frame.pixelFormat() == QVideoFrameFormat::Format_YUV422P) { - uStride = frame.bytesPerLine(1); - vStride = frame.bytesPerLine(2); - uBits = frame.bits(1); - vBits = frame.bits(2); - verticalScale = 1; - } - - const QImage downSampled = image.scaled(image.width() / 2, image.height() / verticalScale); - const int width = downSampled.width(); - const int height = downSampled.height(); - { - for (int row = 0; row < height; ++row) { - for (int col = 0; col < width; ++col) { - const QRgb pixel = downSampled.pixel(col, row); - uBits[col * sampleIncrement] = rgb2u(pixel); - vBits[col * sampleIncrement] = rgb2v(pixel); - } - vBits += vStride; - uBits += uStride; - } - } -} - -void naive_rgbToYuv_planar(const QImage &image, QVideoFrame &frame) -{ - Q_ASSERT(image.format() == QImage::Format_RGB32); - Q_ASSERT(frame.planeCount() > 1); - Q_ASSERT(image.size() == frame.size()); - - frame.map(QVideoFrame::WriteOnly); - - rgb2y_planar(image, frame, 0); - rgb2uv_planar(image, frame); - - frame.unmap(); -} - -void naive_rgbToYuv422(const QImage &image, QVideoFrame &frame) -{ - // Packed format uyvy or yuyv. Each 32 bit frame sample represents - // two pixels with distinct y values, but shared u and v values - Q_ASSERT(image.format() == QImage::Format_RGB32); - Q_ASSERT(frame.planeCount() == 1); - Q_ASSERT(image.size() == frame.size()); - - const QVideoFrameFormat::PixelFormat format = frame.pixelFormat(); - - Q_ASSERT(format == QVideoFrameFormat::Format_UYVY || format == QVideoFrameFormat::Format_YUYV); - - constexpr int plane = 0; - frame.map(QVideoFrame::WriteOnly); - - uchar *line = frame.bits(plane); - for (int row = 0; row < image.height(); ++row) { - uchar *bits = line; - for (int col = 0; col < image.width() - 1; col += 2) { - // Handle to image pixels at a time - const QRgb pixel0 = image.pixel(col, row); - const QRgb pixel1 = image.pixel(col + 1, row); - - // Down-sample u and v channels - bits[0] = (rgb2u(pixel0) + rgb2u(pixel1)) / 2; - bits[2] = (rgb2v(pixel0) + rgb2v(pixel1)) / 2; - - // But not the y-channel - bits[1] = rgb2y(pixel0); - bits[3] = rgb2y(pixel1); - - // Swizzle fom uyuv to yuyv - if (format == QVideoFrameFormat::Format_YUYV) { - std::swap(bits[0], bits[1]); - std::swap(bits[2], bits[3]); - } - - bits += 4; - } - line += frame.bytesPerLine(plane); - } - - frame.unmap(); -} - QVideoFrame createTestFrame(const TestParams ¶ms, const QImage &image) { QVideoFrameFormat format(image.size(), params.pixelFormat); @@ -325,27 +127,13 @@ QVideoFrame createTestFrame(const TestParams ¶ms, const QImage &image) format.setColorSpace(params.colorSpace); format.setColorTransfer(QVideoFrameFormat::ColorTransfer_Unknown); - QVideoFrame frame(format); - - if (params.pixelFormat == QVideoFrameFormat::Format_IMC1 - || params.pixelFormat == QVideoFrameFormat::Format_IMC2 - || params.pixelFormat == QVideoFrameFormat::Format_IMC3 - || params.pixelFormat == QVideoFrameFormat::Format_IMC4 - || params.pixelFormat == QVideoFrameFormat::Format_NV12 - || params.pixelFormat == QVideoFrameFormat::Format_NV21 - || params.pixelFormat == QVideoFrameFormat::Format_YUV420P - || params.pixelFormat == QVideoFrameFormat::Format_YUV422P) { - naive_rgbToYuv_planar(image, frame); - } else if (params.pixelFormat == QVideoFrameFormat::Format_UYVY - || params.pixelFormat == QVideoFrameFormat::Format_YUYV) { - naive_rgbToYuv422(image, frame); - } else { - qDebug() << "Not implemented yet"; - Q_ASSERT(false); - return {}; - } + auto buffer = std::make_unique<QImageVideoBuffer>(image); + QVideoFrameFormat imageFormat = { + image.size(), QVideoFrameFormat::pixelFormatFromImageFormat(image.format()) + }; - return frame; + QVideoFrame source{ buffer.release(), imageFormat }; + return QPlatformMediaIntegration::instance()->convertVideoFrame(source, format); } struct ImageDiffReport @@ -607,8 +395,13 @@ private slots: // Verify that images are similar const double ratioAboveThreshold = static_cast<double>(result->DiffCountAboveThreshold) / result->PixelCount; - QCOMPARE_LT(ratioAboveThreshold, 0.01); - QCOMPARE_LT(result->MaxDiff, 5); + + // These thresholds are empirically determined to allow tests to pass in CI. + // If tests fail, review the difference between the reference and actual + // output to determine if it is a platform dependent inaccuracy before + // adjusting the limits + QCOMPARE_LT(ratioAboveThreshold, 0.01); // Fraction of pixels with larger differences + QCOMPARE_LT(result->MaxDiff, 6); // Maximum per-channel difference } private: |