Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package QMPlay2 for openSUSE:Factory checked in at 2023-08-23 14:58:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/QMPlay2 (Old) and /work/SRC/openSUSE:Factory/.QMPlay2.new.1766 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "QMPlay2" Wed Aug 23 14:58:28 2023 rev:77 rq:1105327 version:23.08.22 Changes: -------- --- /work/SRC/openSUSE:Factory/QMPlay2/QMPlay2.changes 2023-08-09 17:25:10.389350344 +0200 +++ /work/SRC/openSUSE:Factory/.QMPlay2.new.1766/QMPlay2.changes 2023-08-23 14:59:37.566205951 +0200 @@ -1,0 +2,11 @@ +Tue Aug 22 21:05:33 UTC 2023 - Simon Vogl <simon.v...@gmx.net> + +- Update to version 23.08.22 + * don't display empty color space name in Information panel, + * Yadif: Remove inline assembly and optimize C++ code, + * convert HDR->SDR on OpenGL + DXVA2, + * HWAccel fixes with legacy outputs, + * DXVA2 and D3D11VA 10-bit fixes, + * other minor fixes. + +------------------------------------------------------------------- Old: ---- QMPlay2-src-23.08.08.tar.xz New: ---- QMPlay2-src-23.08.22.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ QMPlay2.spec ++++++ --- /var/tmp/diff_new_pack.CgoOyg/_old 2023-08-23 14:59:38.346207346 +0200 +++ /var/tmp/diff_new_pack.CgoOyg/_new 2023-08-23 14:59:38.354207360 +0200 @@ -20,7 +20,7 @@ %bcond_with qt6 Name: QMPlay2 -Version: 23.08.08 +Version: 23.08.22 Release: 0 Summary: A Qt based media player, streamer and downloader License: LGPL-3.0-or-later ++++++ QMPlay2-src-23.08.08.tar.xz -> QMPlay2-src-23.08.22.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/AUTHORS new/QMPlay2-src-23.08.22/AUTHORS --- old/QMPlay2-src-23.08.08/AUTHORS 2023-05-21 00:00:23.000000000 +0200 +++ new/QMPlay2-src-23.08.22/AUTHORS 2023-08-22 20:15:30.000000000 +0200 @@ -1,5 +1,5 @@ ------------------------ Creator and programmer ---------------------- -BÅażej SzczygieÅ - spa...@wp.pl +BÅażej SzczygieÅ - mumei6...@gmail.com ----------------------------- Translations --------------------------- BÅażej SzczygieÅ (English) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/CMakeLists.txt new/QMPlay2-src-23.08.22/CMakeLists.txt --- old/QMPlay2-src-23.08.08/CMakeLists.txt 2023-08-05 23:50:49.000000000 +0200 +++ new/QMPlay2-src-23.08.22/CMakeLists.txt 2023-08-21 01:06:30.000000000 +0200 @@ -16,7 +16,7 @@ endif() # Set default build type as Release -if(NOT CMAKE_BUILD_TYPE) +if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "None") set(CMAKE_BUILD_TYPE "Release") endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/ChangeLog new/QMPlay2-src-23.08.22/ChangeLog --- old/QMPlay2-src-23.08.08/ChangeLog 2023-08-08 12:14:20.000000000 +0200 +++ new/QMPlay2-src-23.08.22/ChangeLog 2023-08-21 20:48:33.000000000 +0200 @@ -1,3 +1,11 @@ +Changes in QMPlay2 23.08.22: + - don't display empty color space name in Information panel, + - Yadif: Remove inline assembly and optimize C++ code, + - convert HDR->SDR on OpenGL + DXVA2, + - HWAccel fixes with legacy outputs, + - DXVA2 and D3D11VA 10-bit fixes, + - other minor fixes, + Changes in QMPlay2 23.08.08: - improve playback of HDR10 videos on SDR displays (OpenGL >= 3 and Vulkan), - don't set BT.709 for video height > 576 if color space is not specified, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/README.md new/QMPlay2-src-23.08.22/README.md --- old/QMPlay2-src-23.08.08/README.md 2023-08-08 15:52:02.000000000 +0200 +++ new/QMPlay2-src-23.08.22/README.md 2023-08-21 23:20:29.000000000 +0200 @@ -188,6 +188,7 @@ - Qt5Svg - for SVG icons, - Qt5Qml - for MediaBrowser, - Qt5WinExtras - for Windows, + - Qt6Core5Compat - for Qt6, - FFmpeg >= 4.0: - libavformat - requires OpenSSL or GnuTLS for https support, - libavcodec - for FFmpeg module only, @@ -206,6 +207,7 @@ - DirectX (Windows only): DirectDraw SDK (included in mingw-w64), - AudioCD: libcdio and libcddb, - ALSA (Linux only): libasound, +- PipeWire - libpipewire, - PulseAudio - libpulse-simple, - PortAudio: portaudio (v19), - XVideo (X11 only): libxv. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/lang/pl.ts new/QMPlay2-src-23.08.22/lang/pl.ts --- old/QMPlay2-src-23.08.08/lang/pl.ts 2023-08-05 00:26:01.000000000 +0200 +++ new/QMPlay2-src-23.08.22/lang/pl.ts 2023-08-22 19:55:19.000000000 +0200 @@ -3187,7 +3187,7 @@ </message> <message> <source>Try to display HDR10 videos in HDR mode (experimental)</source> - <translation>Spróbuj wyÅwietliÄ filmy HDR10 w trybie HDR</translation> + <translation>Spróbuj wyÅwietliÄ filmy HDR10 w trybie HDR (eksperymentalne)</translation> </message> <message> <source>Low quality image scaling (nearest neighbor)</source> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/gui/DemuxerThr.cpp new/QMPlay2-src-23.08.22/src/gui/DemuxerThr.cpp --- old/QMPlay2-src-23.08.08/src/gui/DemuxerThr.cpp 2023-08-06 23:36:51.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/gui/DemuxerThr.cpp 2023-08-08 22:49:26.000000000 +0200 @@ -1059,7 +1059,10 @@ colorPrimariesName = tr("unknown"); if (colorTrcName.isEmpty() && !colorPrimariesName.isEmpty()) colorTrcName = tr("unknown"); - additionalFormatInfo = " (" + colorRangeName + ", " + colorSpaceName; + additionalFormatInfo = " ("; + if (!colorRangeName.isEmpty()) + additionalFormatInfo += colorRangeName + ", "; + additionalFormatInfo += colorSpaceName; if (!colorPrimariesName.isEmpty()) { additionalFormatInfo += "/" + colorPrimariesName; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/gui/Main.cpp new/QMPlay2-src-23.08.22/src/gui/Main.cpp --- old/QMPlay2-src-23.08.08/src/gui/Main.cpp 2023-08-06 21:02:07.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/gui/Main.cpp 2023-08-21 23:11:30.000000000 +0200 @@ -28,6 +28,7 @@ #include <Functions.hpp> #include <VideoDock.hpp> #include <Settings.hpp> +#include <Demuxer.hpp> #include <Version.hpp> #include <Module.hpp> #include <IPC.hpp> @@ -766,6 +767,7 @@ } qRegisterMetaType<AVRational>("AVRational"); + qRegisterMetaType<Demuxer *>("Demuxer*"); QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/D3D11VAVulkan.cpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/D3D11VAVulkan.cpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/D3D11VAVulkan.cpp 2023-08-08 16:27:53.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/D3D11VAVulkan.cpp 2023-08-19 22:20:07.000000000 +0200 @@ -18,9 +18,9 @@ #include <D3D11VAVulkan.hpp> -#include <QResource> #include <QLibrary> #include <QDebug> +#include <QFile> #include <QDir> #include <QMPlay2Core.hpp> @@ -179,7 +179,7 @@ if (m_images.empty()) { - if (frame.pixelFormat() == AV_PIX_FMT_P016) + if (frame.depth() > 8) { m_format1 = DXGI_FORMAT_R16_UNORM; m_format2 = DXGI_FORMAT_R16G16_UNORM; @@ -393,8 +393,12 @@ return false; } - const QResource res(m_linearImage ? ":/D3D11VABuffer.dxcs" : ":/D3D11VATexture.dxcs"); - auto dxcs = QByteArray::fromRawData(reinterpret_cast<const char *>(res.data()), res.size()); + QFile res(m_linearImage ? ":/D3D11VABuffer.dxcs" : ":/D3D11VATexture.dxcs"); + if (Q_UNLIKELY(!res.open(QFile::ReadOnly))) + return false; + + const auto dxcs = res.readAll(); + res.close(); ComPtr<ID3DBlob> csData; d3dCompile( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDec.cpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDec.cpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDec.cpp 2023-07-26 23:42:24.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDec.cpp 2023-08-21 00:41:01.000000000 +0200 @@ -42,6 +42,11 @@ destroyDecoder(); } +void FFDec::setSupportedPixelFormats(const AVPixelFormats &pixelFormats) +{ + m_supportedPixelFormats = pixelFormats; +} + int FFDec::pendingFrames() const { return m_frames.count(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDec.hpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDec.hpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDec.hpp 2023-08-04 00:29:43.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDec.hpp 2023-08-21 00:41:01.000000000 +0200 @@ -46,6 +46,8 @@ FFDec(); ~FFDec(); + void setSupportedPixelFormats(const AVPixelFormats &pixelFormats) override; + int pendingFrames() const override; /**/ @@ -70,6 +72,8 @@ AVRational m_timeBase; bool codecIsOpen; + AVPixelFormats m_supportedPixelFormats; + #ifdef USE_VULKAN std::shared_ptr<QmVk::ImagePool> m_vkImagePool; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecDXVA2.cpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecDXVA2.cpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecDXVA2.cpp 2023-06-13 22:25:42.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecDXVA2.cpp 2023-08-21 01:06:30.000000000 +0200 @@ -81,9 +81,16 @@ if (streamInfo.params->codec_type != AVMEDIA_TYPE_VIDEO || !hasHWAccel("dxva2")) return false; - m_pixFmt = Frame::convert3PlaneTo2Plane(streamInfo.pixelFormat()); - if (m_pixFmt != AV_PIX_FMT_NV12 && (m_pixFmt != AV_PIX_FMT_P016 || streamInfo.params->codec_id == AV_CODEC_ID_H264)) + const auto pixFmt = streamInfo.pixelFormat(); + if (pixFmt == AV_PIX_FMT_YUV420P10) + { + if (streamInfo.params->codec_id == AV_CODEC_ID_H264) + return false; + } + else if (pixFmt != AV_PIX_FMT_YUV420P && pixFmt != AV_PIX_FMT_YUVJ420P) + { return false; + } AVCodec *codec = init(streamInfo); if (!codec) @@ -114,7 +121,7 @@ if (!QMPlay2Core.gpuInstance()->setHWDecContextForVideoOutput(dxva2OpenGL)) return false; } - if (!dxva2OpenGL->checkCodec(streamInfo.codec_name, m_pixFmt == AV_PIX_FMT_YUV420P10)) + if (!dxva2OpenGL->checkCodec(streamInfo.codec_name, pixFmt == AV_PIX_FMT_YUV420P10)) return false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecDXVA2.hpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecDXVA2.hpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecDXVA2.hpp 2023-08-04 00:29:43.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecDXVA2.hpp 2023-08-18 20:34:29.000000000 +0200 @@ -37,5 +37,4 @@ private: AVBufferRef *m_hwDeviceBufferRef = nullptr; std::shared_ptr<VideoFilter> m_filter; - AVPixelFormat m_pixFmt = AV_PIX_FMT_NONE; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecHWAccel.cpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecHWAccel.cpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecHWAccel.cpp 2023-06-13 22:23:37.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecHWAccel.cpp 2023-08-21 01:04:22.000000000 +0200 @@ -24,12 +24,15 @@ extern "C" { #include <libavcodec/avcodec.h> + #include <libswscale/swscale.h> } FFDecHWAccel::FFDecHWAccel() {} FFDecHWAccel::~FFDecHWAccel() -{} +{ + sws_freeContext(m_swsCtx); +} bool FFDecHWAccel::hasHWAccel(const char *hwaccelName) { @@ -82,7 +85,7 @@ { decoded = Frame(frame, Frame::convert3PlaneTo2Plane(codec_ctx->sw_pix_fmt)); if (!m_hasHWDecContext) - decoded = decoded.downloadHwData(); + decoded = decoded.downloadHwData(&m_swsCtx, m_supportedPixelFormats); } decodeLastStep(encodedPacket, decoded, frameFinished); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecHWAccel.hpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecHWAccel.hpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecHWAccel.hpp 2023-08-04 00:29:43.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecHWAccel.hpp 2023-08-21 01:04:22.000000000 +0200 @@ -39,4 +39,5 @@ protected: bool m_hasCriticalError = false; bool m_hasHWDecContext = false; + SwsContext *m_swsCtx = nullptr; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecSW.cpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecSW.cpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecSW.cpp 2023-08-04 00:29:43.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecSW.cpp 2023-08-21 00:41:01.000000000 +0200 @@ -138,7 +138,7 @@ void FFDecSW::setSupportedPixelFormats(const AVPixelFormats &pixelFormats) { - supportedPixelFormats = pixelFormats; + FFDec::setSupportedPixelFormats(pixelFormats); setPixelFormat(); } @@ -489,7 +489,7 @@ return; } - m_dontConvert = supportedPixelFormats.contains(codec_ctx->pix_fmt); + m_dontConvert = m_supportedPixelFormats.contains(codec_ctx->pix_fmt); if (m_dontConvert) { m_desiredPixFmt = codec_ctx->pix_fmt; @@ -514,7 +514,7 @@ const QByteArray srcPixFmtName = srcPixDesc->name; - for (const AVPixelFormat pixFmt : qAsConst(supportedPixelFormats)) + for (const AVPixelFormat pixFmt : qAsConst(m_supportedPixelFormats)) { if (!sws_isSupportedOutput(pixFmt)) continue; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecSW.hpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecSW.hpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFDecSW.hpp 2023-08-04 00:29:43.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFDecSW.hpp 2023-08-21 00:40:49.000000000 +0200 @@ -90,7 +90,6 @@ int lastFrameW, lastFrameH, lastPixFmt; SwsContext *sws_ctx; - AVPixelFormats supportedPixelFormats; const AVPixFmtDescriptor *m_origPixDesc = nullptr; AVPixelFormat m_desiredPixFmt = AV_PIX_FMT_NONE; bool m_dontConvert = false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFmpeg.cpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFmpeg.cpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFmpeg.cpp 2023-05-24 23:39:35.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFmpeg.cpp 2023-08-21 21:05:18.000000000 +0200 @@ -45,6 +45,7 @@ #endif } +#include <QGuiApplication> #include <QComboBox> FFmpeg::FFmpeg() : @@ -55,6 +56,8 @@ #ifdef QMPlay2_VDPAU vdpauIcon = QIcon(":/VDPAU.svgz"); + if (!QMPlay2Core.isVulkanRenderer() && !QGuiApplication::platformName().contains("wayland")) + vdpauSupported = true; #endif #ifdef QMPlay2_VAAPI vaapiIcon = QIcon(":/VAAPI.svgz"); @@ -111,7 +114,7 @@ # endif # if defined(QMPlay2_VDPAU) - if (!QMPlay2Core.isVulkanRenderer()) + if (vdpauSupported) { m_vdpauDeintMethodB = new QComboBox; m_vdpauDeintMethodB->addItems({tr("None"), "Temporal", "Temporal-spatial"}); @@ -167,7 +170,7 @@ if (showDisabled || getBool("DecoderEnabled")) modulesInfo += Info(DecoderName, DECODER, m_icon); #ifdef QMPlay2_VDPAU - if (showDisabled || (getBool("DecoderVDPAUEnabled") && !QMPlay2Core.isVulkanRenderer())) + if (showDisabled || (getBool("DecoderVDPAUEnabled") && vdpauSupported)) { modulesInfo += Info(DecoderVDPAUName, DECODER, vdpauIcon); modulesInfo += Info(VDPAUWriterName, WRITER | VIDEOHWFILTER, vdpauIcon); @@ -202,7 +205,7 @@ else if (name == DecoderName && getBool("DecoderEnabled")) return new FFDecSW(*this); #ifdef QMPlay2_VDPAU - else if (name == DecoderVDPAUName && getBool("DecoderVDPAUEnabled") && !QMPlay2Core.isVulkanRenderer()) + else if (name == DecoderVDPAUName && getBool("DecoderVDPAUEnabled") && vdpauSupported) return new FFDecVDPAU(*this); #endif #ifdef QMPlay2_VAAPI @@ -228,11 +231,7 @@ FFmpeg::SettingsWidget *FFmpeg::getSettingsWidget() { -#if defined(QMPlay2_DXVA2) || defined(QMPlay2_D3D11VA) - return new ModuleSettingsWidget(*this, dxva2Supported, d3d11vaSupported); -#else - return new ModuleSettingsWidget(*this); -#endif + return new ModuleSettingsWidget(*this, dxva2Supported, d3d11vaSupported, vdpauSupported); } void FFmpeg::videoDeintSave() @@ -266,12 +265,8 @@ #include <QSpinBox> #include <QLabel> -#if defined(QMPlay2_DXVA2) || defined(QMPlay2_D3D11VA) -ModuleSettingsWidget::ModuleSettingsWidget(Module &module, bool dxva2, bool d3d11va) : -#else -ModuleSettingsWidget::ModuleSettingsWidget(Module &module) : -#endif - Module::SettingsWidget(module) +ModuleSettingsWidget::ModuleSettingsWidget(Module &module, bool dxva2, bool d3d11va, bool vdpau) + : Module::SettingsWidget(module) { demuxerB = new QGroupBox(tr("Demuxer")); demuxerB->setCheckable(true); @@ -287,29 +282,34 @@ const auto copyVideoText = tr("Copy decoded video to CPU memory (slow)"); #ifdef QMPlay2_VDPAU - decoderVDPAUB = new QGroupBox(tr("Decoder") + " VDPAU - " + tr("hardware decoding")); - decoderVDPAUB->setCheckable(true); - decoderVDPAUB->setChecked(sets().getBool("DecoderVDPAUEnabled")); - - noisereductionVDPAUB = new QCheckBox(tr("Noise reduction")); - noisereductionVDPAUB->setChecked(sets().getBool("VDPAUNoiseReductionEnabled")); - connect(noisereductionVDPAUB, &QCheckBox::clicked, - this, [this] { - checkEnables(); - setVDPAU(); - }); - noisereductionLvlVDPAUS = new Slider; - noisereductionLvlVDPAUS->setRange(0, 50); - noisereductionLvlVDPAUS->setTickInterval(50); - noisereductionLvlVDPAUS->setTickPosition(QSlider::TicksBelow); - noisereductionLvlVDPAUS->setValue(sets().getDouble("VDPAUNoiseReductionLvl") * 50); - connect(noisereductionLvlVDPAUS, &Slider::valueChanged, - this, &ModuleSettingsWidget::setVDPAU); + if (vdpau) + { + decoderVDPAUB = new QGroupBox(tr("Decoder") + " VDPAU - " + tr("hardware decoding")); + decoderVDPAUB->setCheckable(true); + decoderVDPAUB->setChecked(sets().getBool("DecoderVDPAUEnabled")); + + noisereductionVDPAUB = new QCheckBox(tr("Noise reduction")); + noisereductionVDPAUB->setChecked(sets().getBool("VDPAUNoiseReductionEnabled")); + connect(noisereductionVDPAUB, &QCheckBox::clicked, + this, [this] { + checkEnables(); + setVDPAU(); + }); + noisereductionLvlVDPAUS = new Slider; + noisereductionLvlVDPAUS->setRange(0, 50); + noisereductionLvlVDPAUS->setTickInterval(50); + noisereductionLvlVDPAUS->setTickPosition(QSlider::TicksBelow); + noisereductionLvlVDPAUS->setValue(sets().getDouble("VDPAUNoiseReductionLvl") * 50); + connect(noisereductionLvlVDPAUS, &Slider::valueChanged, + this, &ModuleSettingsWidget::setVDPAU); - checkEnables(); + checkEnables(); - QFormLayout *vdpauLayout = new QFormLayout(decoderVDPAUB); - vdpauLayout->addRow(noisereductionVDPAUB, noisereductionLvlVDPAUS); + QFormLayout *vdpauLayout = new QFormLayout(decoderVDPAUB); + vdpauLayout->addRow(noisereductionVDPAUB, noisereductionLvlVDPAUS); + } +#else + Q_UNUSED(vdpau) #endif #ifdef QMPlay2_VAAPI @@ -323,6 +323,8 @@ decoderDXVA2EB = new QCheckBox(tr("Decoder") + " DXVA2 - " + tr("hardware decoding")); decoderDXVA2EB->setChecked(sets().getBool("DecoderDXVA2Enabled")); } +#else + Q_UNUSED(dxva2) #endif #ifdef QMPlay2_D3D11VA if (d3d11va) @@ -340,6 +342,8 @@ decoderD3D11VA->setLayout(d3d11vaLayout); } +#else + Q_UNUSED(d3d11va) #endif #ifdef QMPlay2_VTB @@ -402,7 +406,8 @@ QGridLayout *layout = new QGridLayout(this); layout->addWidget(demuxerB); #ifdef QMPlay2_VDPAU - layout->addWidget(decoderVDPAUB); + if (decoderVDPAUB) + layout->addWidget(decoderVDPAUB); #endif #ifdef QMPlay2_VAAPI layout->addWidget(decoderVAAPIEB); @@ -446,7 +451,8 @@ sets().set("LowresValue", lowresB->currentIndex()); sets().set("ThreadTypeSlice", thrTypeB->currentIndex()); #ifdef QMPlay2_VDPAU - sets().set("DecoderVDPAUEnabled", decoderVDPAUB->isChecked()); + if (decoderVDPAUB) + sets().set("DecoderVDPAUEnabled", decoderVDPAUB->isChecked()); #endif #ifdef QMPlay2_VAAPI sets().set("DecoderVAAPIEnabled", decoderVAAPIEB->isChecked()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFmpeg.hpp new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFmpeg.hpp --- old/QMPlay2-src-23.08.08/src/modules/FFmpeg/FFmpeg.hpp 2023-05-24 23:39:35.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/FFmpeg/FFmpeg.hpp 2023-08-21 20:59:15.000000000 +0200 @@ -51,12 +51,14 @@ #endif #if defined(QMPlay2_DXVA2) || defined(QMPlay2_D3D11VA) QIcon dxIcon; - bool dxva2Supported = false; - bool d3d11vaSupported = false; #endif #ifdef QMPlay2_VTB QIcon vtbIcon; #endif + + bool dxva2Supported = false; + bool d3d11vaSupported = false; + bool vdpauSupported = false; }; /**/ @@ -74,11 +76,7 @@ Q_DECLARE_TR_FUNCTIONS(ModuleSettingsWidget) #endif public: -#if defined(QMPlay2_DXVA2) || defined(QMPlay2_D3D11VA) - ModuleSettingsWidget(Module &module, bool dxva2, bool d3d11va); -#else - ModuleSettingsWidget(Module &module); -#endif + ModuleSettingsWidget(Module &module, bool dxva2, bool d3d11va, bool vdpau); #ifdef QMPlay2_VDPAU private: void setVDPAU(); @@ -93,9 +91,9 @@ QCheckBox *skipFramesB, *forceSkipFramesB; QGroupBox *decoderB; #ifdef QMPlay2_VDPAU - QGroupBox *decoderVDPAUB; - QCheckBox *noisereductionVDPAUB; - Slider *noisereductionLvlVDPAUS; + QGroupBox *decoderVDPAUB = nullptr; + QCheckBox *noisereductionVDPAUB = nullptr; + Slider *noisereductionLvlVDPAUS = nullptr; #endif #ifdef QMPlay2_VAAPI QCheckBox *decoderVAAPIEB; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/VideoFilters/YadifDeint.cpp new/QMPlay2-src-23.08.22/src/modules/VideoFilters/YadifDeint.cpp --- old/QMPlay2-src-23.08.08/src/modules/VideoFilters/YadifDeint.cpp 2023-08-04 11:25:19.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/VideoFilters/YadifDeint.cpp 2023-08-20 00:49:33.000000000 +0200 @@ -19,38 +19,19 @@ /* This is the C++/Qt port of the Yadif deinterlacing filter from FFmpeg (libavfilter/vf_yadif.c) Copyright (C) 2006-2011 Michael Niedermayer <michae...@gmx.at> - - The Yadif x86 SIMD implementation is taken from: - - FFmpeg project (libavfilter/x86/vf_yadif.asm) - Copyright (C) 2006-2011 Michael Niedermayer <michae...@gmx.at> - - MPlayer project (libmpcodecs/vf_yadif.c) - Copyright (C) 2006 Michael Niedermayer <michae...@gmx.at> */ #include <YadifDeint.hpp> #include <QMPlay2Core.hpp> -#include <CPU.hpp> #include <QtConcurrent/QtConcurrentRun> -extern "C" { - #include <libavutil/cpu.h> -} - #include <algorithm> #include <vector> -#undef RSHIFT - using namespace std; -static void (*filterLinePtr)(quint8 *, const void *const, - const quint8 *, const quint8 *, const quint8 *, - const qptrdiff, const qptrdiff, - const int, const bool); -static int alignment; - /* Yadif algo */ template<int j> @@ -61,7 +42,12 @@ const int score = abs(curr[mrefs-1+j] - curr[prefs-1-j]) + abs(curr[mrefs+j] - curr[prefs-j]) + abs(curr[mrefs+1+j] - curr[prefs+1-j]); if (score < spatialScore) { + // This must be in a separate condition w/o assigning condition to a variable, + // otherwise the compiler will not optimize it. spatialScore = score; + } + if (score < spatialScore) + { spatialPred = (curr[mrefs+j] + curr[prefs-j]) >> 1; switch (j) { @@ -78,7 +64,7 @@ } template<bool isNotEdge> static inline void filterLine(quint8 *dest, const void *const destEnd, - const quint8 *prev, const quint8 *curr, const quint8 *next, + const quint8 *__restrict__ prev, const quint8 *__restrict__ curr, const quint8 *__restrict__ next, const qptrdiff prefs, const qptrdiff mrefs, const int spatialCheck, const bool filterParity) { @@ -116,7 +102,7 @@ if (spatialPred > d + diff) spatialPred = d + diff; - else if (spatialPred < d - diff) + if (spatialPred < d - diff) spatialPred = d - diff; *(dest++) = spatialPred; @@ -128,287 +114,6 @@ } } -#ifdef QMPLAY2_CPU_X86 - -#define LOAD(mem, dst) \ - _movh " " mem ", " dst"\n\t"\ - "punpcklbw " mm(7)", " dst"\n\t" - -#define PABS(tmp, dst) \ - "pxor " tmp ", " tmp"\n\t"\ - "psubw " dst ", " tmp"\n\t"\ - "pmaxsw " tmp ", " dst"\n\t" - -#define CHECK(pj, mj) \ - _movu " "#pj"(%[curr],%[mrefs]), " mm(2)"\n\t"\ - _movu " "#mj"(%[curr],%[prefs]), " mm(3)"\n\t"\ - _mova " " mm(2)", " mm(4)"\n\t"\ - _mova " " mm(2)", " mm(5)"\n\t"\ - "pxor " mm(3)", " mm(4)"\n\t"\ - "pavgb " mm(3)", " mm(5)"\n\t"\ - "pand %[pb1], " mm(4)"\n\t"\ - "psubusb " mm(4)", " mm(5)"\n\t"\ - RSHIFT( 1, mm(5))\ - "punpcklbw " mm(7)", " mm(5)"\n\t"\ - _mova " " mm(2)", " mm(4)"\n\t"\ - "psubusb " mm(3)", " mm(2)"\n\t"\ - "psubusb " mm(4)", " mm(3)"\n\t"\ - "pmaxub " mm(3)", " mm(2)"\n\t"\ - _mova " " mm(2)", " mm(3)"\n\t"\ - _mova " " mm(2)", " mm(4)"\n\t"\ - RSHIFT( 1, mm(3))\ - RSHIFT( 2, mm(4))\ - "punpcklbw " mm(7)", " mm(2)"\n\t"\ - "punpcklbw " mm(7)", " mm(3)"\n\t"\ - "punpcklbw " mm(7)", " mm(4)"\n\t"\ - "paddw " mm(3)", " mm(2)"\n\t"\ - "paddw " mm(4)", " mm(2)"\n\t" - -#define CHECK1 \ - _mova " " mm(0)", " mm(3)"\n\t"\ - "pcmpgtw " mm(2)", " mm(3)"\n\t"\ - "pminsw " mm(2)", " mm(0)"\n\t"\ - _mova " " mm(3)", " mm(6)"\n\t"\ - "pand " mm(3)", " mm(5)"\n\t"\ - "pandn " mm(1)", " mm(3)"\n\t"\ - "por " mm(5)", " mm(3)"\n\t"\ - _mova " " mm(3)", " mm(1)"\n\t" - -/* pretend not to have checked dir=2 if dir=1 was bad. hurts both quality and speed, but matches the C version. */ -#define CHECK2 \ - "paddw %[pw1], " mm(6)"\n\t"\ - "psllw $14, " mm(6)"\n\t"\ - "paddsw " mm(6)", " mm(2)"\n\t"\ - _mova " " mm(0)", " mm(3)"\n\t"\ - "pcmpgtw " mm(2)", " mm(3)"\n\t"\ - "pminsw " mm(2)", " mm(0)"\n\t"\ - "pand " mm(3)", " mm(5)"\n\t"\ - "pandn " mm(1)", " mm(3)"\n\t"\ - "por " mm(5)", " mm(3)"\n\t"\ - _mova " " mm(3)", " mm(1)"\n\t" - -#define FILTER(prev2, next2, alignment) \ - while (dest < destEnd)\ - {\ - asm volatile\ - (\ - "pxor " mm(7)", " mm(7)"\n\t"\ - LOAD("(%[curr],%[mrefs])", mm(0))\ - LOAD("(%[curr],%[prefs])", mm(1))\ - LOAD("(%["#prev2"])", mm(2))\ - LOAD("(%["#next2"])", mm(3))\ - _mova " " mm(3)", " mm(4)"\n\t"\ - "paddw " mm(2)", " mm(3)"\n\t"\ - "psraw $1, " mm(3)"\n\t"\ - _mova " " mm(0)", %[tmp0]\n\t"\ - _mova " " mm(3)", %[tmp1]\n\t"\ - _mova " " mm(1)", %[tmp2]\n\t"\ - "psubw " mm(4)", " mm(2)"\n\t"\ - PABS( mm(4), mm(2))\ - LOAD("(%[prev],%[mrefs])", mm(3))\ - LOAD("(%[prev],%[prefs])", mm(4))\ - "psubw " mm(0)", " mm(3)"\n\t"\ - "psubw " mm(1)", " mm(4)"\n\t"\ - PABS( mm(5), mm(3))\ - PABS( mm(5), mm(4))\ - "paddw " mm(4)", " mm(3)"\n\t"\ - "psrlw $1, " mm(2)"\n\t"\ - "psrlw $1, " mm(3)"\n\t"\ - "pmaxsw " mm(3)", " mm(2)"\n\t"\ - LOAD("(%[next],%[mrefs])", mm(3))\ - LOAD("(%[next],%[prefs])", mm(4))\ - "psubw " mm(0)", " mm(3)"\n\t"\ - "psubw " mm(1)", " mm(4)"\n\t"\ - PABS( mm(5), mm(3))\ - PABS( mm(5), mm(4))\ - "paddw " mm(4)", " mm(3)"\n\t"\ - "psrlw $1, " mm(3)"\n\t"\ - "pmaxsw " mm(3)", " mm(2)"\n\t"\ - _mova " " mm(2)", %[tmp3]\n\t"\ -\ - "paddw " mm(0)", " mm(1)"\n\t"\ - "paddw " mm(0)", " mm(0)"\n\t"\ - "psubw " mm(1)", " mm(0)"\n\t"\ - "psrlw $1, " mm(1)"\n\t"\ - PABS( mm(2), mm(0))\ -\ - _movu " -1(%[curr],%[mrefs]), " mm(2)"\n\t"\ - _movu " -1(%[curr],%[prefs]), " mm(3)"\n\t"\ - _mova " " mm(2)", " mm(4)"\n\t"\ - "psubusb " mm(3)", " mm(2)"\n\t"\ - "psubusb " mm(4)", " mm(3)"\n\t"\ - "pmaxub " mm(3)", " mm(2)"\n\t"\ - SH( mm(2), mm(3))\ - "punpcklbw " mm(7)", " mm(2)"\n\t"\ - "punpcklbw " mm(7)", " mm(3)"\n\t"\ - "paddw " mm(2)", " mm(0)"\n\t"\ - "paddw " mm(3)", " mm(0)"\n\t"\ - "psubw %[pw1], " mm(0)"\n\t"\ -\ - CHECK(-2,0)\ - CHECK1\ - CHECK(-3,1)\ - CHECK2\ - CHECK(0,-2)\ - CHECK1\ - CHECK(1,-3)\ - CHECK2\ -\ - /* Spatial check */ \ - _mova " %[tmp3], " mm(6)" \n\t"\ - "cmpl $1, %[spatialCheck]\n\t"\ - "jne 1f\n\t"\ - LOAD("(%["#prev2"],%[mrefs],2)", mm(2))\ - LOAD("(%["#next2"],%[mrefs],2)", mm(4))\ - LOAD("(%["#prev2"],%[prefs],2)", mm(3))\ - LOAD("(%["#next2"],%[prefs],2)", mm(5))\ - "paddw " mm(4)", " mm(2)"\n\t"\ - "paddw " mm(5)", " mm(3)"\n\t"\ - "psrlw $1, " mm(2)"\n\t"\ - "psrlw $1, " mm(3)"\n\t"\ - _mova " %[tmp0], " mm(4)"\n\t"\ - _mova " %[tmp1], " mm(5)"\n\t"\ - _mova " %[tmp2], " mm(7)"\n\t"\ - "psubw " mm(4)", " mm(2)"\n\t"\ - "psubw " mm(7)", " mm(3)"\n\t"\ - _mova " " mm(5)", " mm(0)"\n\t"\ - "psubw " mm(4)", " mm(5)"\n\t"\ - "psubw " mm(7)", " mm(0)"\n\t"\ - _mova " " mm(2)", " mm(4)"\n\t"\ - "pminsw " mm(3)", " mm(2)"\n\t"\ - "pmaxsw " mm(4)", " mm(3)"\n\t"\ - "pmaxsw " mm(5)", " mm(2)"\n\t"\ - "pminsw " mm(5)", " mm(3)"\n\t"\ - "pmaxsw " mm(0)", " mm(2)"\n\t"\ - "pminsw " mm(0)", " mm(3)"\n\t"\ - "pxor " mm(4)", " mm(4)"\n\t"\ - "pmaxsw " mm(3)", " mm(6)"\n\t"\ - "psubw " mm(2)", " mm(4)"\n\t"\ - "pmaxsw " mm(4)", " mm(6)"\n\t"\ -\ - "1:\n\t"\ - _mova " %[tmp1], " mm(2)"\n\t"\ - _mova " " mm(2)", " mm(3)"\n\t"\ - "psubw " mm(6)", " mm(2)"\n\t"\ - "paddw " mm(6)", " mm(3)"\n\t"\ - "pmaxsw " mm(2)", " mm(1)"\n\t"\ - "pminsw " mm(3)", " mm(1)"\n\t"\ - "packuswb " mm(1)", " mm(1)"\n\t"\ -\ - _movh " " mm(1)", %[dest]\n\t"\ -\ - :[tmp0] "=m"(tmp0),\ - [tmp1] "=m"(tmp1),\ - [tmp2] "=m"(tmp2),\ - [tmp3] "=m"(tmp3),\ - [dest] "=m"(*dest)\ - :[prev] "r"(prev),\ - [curr] "r"(curr),\ - [next] "r"(next),\ - [prefs] "r"(prefs),\ - [mrefs] "r"(mrefs),\ - [pw1] "m"(pw_1),\ - [pb1] "m"(pb_1),\ - [spatialCheck] "g"(spatialCheck)\ - );\ - dest += alignment;\ - prev += alignment;\ - curr += alignment;\ - next += alignment;\ - } - -#ifdef QMPLAY2_CPU_X86_32 //Every x86-64 CPU has SSE2, so MMXEXT is unused there -static void filterLine_MMXEXT(quint8 *dest, const void *const destEnd, - const quint8 *prev, const quint8 *curr, const quint8 *next, - const qptrdiff prefs, const qptrdiff mrefs, - const int spatialCheck, const bool filterParity) -{ - const quint64 pw_1(0x0001000100010001ULL); - const quint64 pb_1(0x0101010101010101ULL); - quint64 tmp0, tmp1, tmp2, tmp3; - - #define _mova "movq" - #define _movu "movq" - #define _movh "movd" - #define mm(n) "%%mm"#n - - #define RSHIFT(val, dst) \ - "psrlq $"#val"*8, " dst"\n\t" - - #define SH(src, dst) \ - "pshufw $9, " src", " dst"\n\t" - - if (filterParity) - FILTER(prev, curr, 4) - else - FILTER(curr, next, 4) - - asm volatile("emms"); - - #undef SH - #undef RSHIFT - #undef mm - #undef _movh - #undef _movu - #undef _mova -} -#endif // QMPLAY2_CPU_X86_32 -static void filterLine_SSE2(quint8 *dest, const void *const destEnd, - const quint8 *prev, const quint8 *curr, const quint8 *next, - const qptrdiff prefs, const qptrdiff mrefs, - const int spatialCheck, const bool filterParity) -{ - struct u128 - { - u128() = default; - inline u128(quint64 v) : lo(v), hi(v) {} - quint64 lo, hi; - }; - __attribute__((aligned(16))) const u128 pw_1(0x0001000100010001ULL); - __attribute__((aligned(16))) const u128 pb_1(0x0101010101010101ULL); - __attribute__((aligned(16))) u128 tmp0, tmp1, tmp2, tmp3; - - #define _mova "movdqa" - #define _movu "movdqu" - #define _movh "movq" - #define mm(n) "%%xmm"#n - - #define RSHIFT(val, dst) \ - "psrldq $"#val", " dst"\n\t" - - #define SH(src, dst) \ - _mova " " src", " dst"\n\t"\ - "psrldq $2, " dst"\n\t" - - if (filterParity) - FILTER(prev, curr, 8) - else - FILTER(curr, next, 8) - - #undef SH - #undef RSHIFT - #undef mm - #undef _movh - #undef _movu - #undef _mova -} - -#undef LOAD -#undef PABS -#undef CHECK -#undef CHECK1 -#undef CHECK2 -#undef FILTER - -#endif // QMPLAY2_CPU_X86 -static void filterLine_CPP(quint8 *dest, const void *const destEnd, - const quint8 *prev, const quint8 *curr, const quint8 *next, - const qptrdiff prefs, const qptrdiff mrefs, - const int spatialCheck, const bool filterParity) -{ - filterLine<true>(dest, destEnd, prev, curr, next, prefs, mrefs, spatialCheck, filterParity); -} - static void filterSlice(const int plane, const int parity, const int tff, const bool spatialCheck, Frame &destFrame, const Frame &prevFrame, const Frame &currFrame, const Frame &nextFrame, const int jobId, const int jobsCount) @@ -427,8 +132,6 @@ const quint8 *const nextData = nextFrame.constData(plane); quint8 *const destData = destFrame.data(plane); - const int toSub = 3 + alignment - 1; - for (int y = sliceStart; y < sliceEnd; ++y) { const quint8 *curr = &currData[y * refs]; @@ -455,10 +158,10 @@ doSpatialCheck, filterParity ); - filterLinePtr + filterLine<true> ( dest + 3, - dest + w - toSub, + dest + w - 3, prev + 3, curr + 3, next + 3, @@ -467,18 +170,6 @@ doSpatialCheck, filterParity ); - filterLine<true> - ( - dest + w - toSub, - dest + w - 3, - prev + w - toSub, - curr + w - toSub, - next + w - toSub, - prefs, - mrefs, - doSpatialCheck, - filterParity - ); filterLine<false> ( dest + w - 3, @@ -507,26 +198,6 @@ , m_spatialCheck(spatialCheck) { m_threadsPool.setMaxThreadCount(min(QThread::idealThreadCount(), 18)); - if (!filterLinePtr) - { - filterLinePtr = filterLine_CPP; - alignment = 1; -#ifdef QMPLAY2_CPU_X86 - const int cpuFlags = QMPlay2CoreClass::getCPUFlags(); - if (cpuFlags & AV_CPU_FLAG_SSE2) - { - filterLinePtr = filterLine_SSE2; - alignment = 8; - } -#ifdef QMPLAY2_CPU_X86_32 - else if (cpuFlags & AV_CPU_FLAG_MMXEXT) - { - filterLinePtr = filterLine_MMXEXT; - alignment = 4; - } -#endif // QMPLAY2_CPU_X86_32 -#endif // QMPLAY2_CPU_X86 - } addParam("DeinterlaceFlags"); addParam("W"); addParam("H"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/Visualizations/VisWidget.cpp new/QMPlay2-src-23.08.22/src/modules/Visualizations/VisWidget.cpp --- old/QMPlay2-src-23.08.08/src/modules/Visualizations/VisWidget.cpp 2023-06-03 22:24:20.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/Visualizations/VisWidget.cpp 2023-08-20 23:40:27.000000000 +0200 @@ -21,6 +21,7 @@ #include <DockWidget.hpp> #include <Functions.hpp> +#include <QGuiApplication> #include <QMouseEvent> #include <QPainter> #include <QMenu> @@ -146,6 +147,8 @@ if (glW && watched == glW && event->type() == QEvent::Paint) { QPainter p(glW); + if (QGuiApplication::platformName().contains("wayland")) + p.fillRect(rect(), Qt::black); paint(p); m_pendingUpdate = false; return true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/modules/XVideo/XVideo.cpp new/QMPlay2-src-23.08.22/src/modules/XVideo/XVideo.cpp --- old/QMPlay2-src-23.08.08/src/modules/XVideo/XVideo.cpp 2023-05-24 23:39:35.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/modules/XVideo/XVideo.cpp 2023-08-21 01:11:34.000000000 +0200 @@ -19,6 +19,8 @@ #include <XVideo.hpp> #include <XVideoWriter.hpp> +#include <QGuiApplication> + XVideo::XVideo() : Module("XVideo") { @@ -31,13 +33,13 @@ QList<XVideo::Info> XVideo::getModulesInfo(const bool showDisabled) const { QList<Info> modulesInfo; - if (showDisabled || getBool("Enabled")) + if (showDisabled || (QGuiApplication::platformName() == "xcb" && getBool("Enabled"))) modulesInfo += Info(XVideoWriterName, WRITER, QStringList{"video"}); return modulesInfo; } void *XVideo::createInstance(const QString &name) { - if (name == XVideoWriterName && getBool("Enabled")) + if (name == XVideoWriterName && QGuiApplication::platformName() == "xcb" && getBool("Enabled")) return new XVideoWriter(*this); return nullptr; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/qmplay2/Frame.cpp new/QMPlay2-src-23.08.22/src/qmplay2/Frame.cpp --- old/QMPlay2-src-23.08.08/src/qmplay2/Frame.cpp 2023-08-08 16:04:22.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/qmplay2/Frame.cpp 2023-08-21 01:06:26.000000000 +0200 @@ -30,6 +30,7 @@ #include <libavutil/frame.h> #include <libavutil/pixdesc.h> #include <libavutil/imgutils.h> + #include <libswscale/swscale.h> } #include <cmath> @@ -511,7 +512,7 @@ return copyData(destData, destLinesize); } -Frame Frame::downloadHwData() const +Frame Frame::downloadHwData(SwsContext **swsCtx, const AVPixelFormats &supportedPixelFormats) const { Frame downloaded; if (isHW() && m_frame->hw_frames_ctx) @@ -538,11 +539,61 @@ dstFrame->format = AV_PIX_FMT_NONE; } + const bool convert = + swsCtx && + !supportedPixelFormats.isEmpty() && + !supportedPixelFormats.contains(found ? static_cast<AVPixelFormat>(dstFrame->format) : m_pixelFormat) + ; + if (av_hwframe_transfer_data(dstFrame, m_frame, 0) == 0) { - av_frame_copy_props(dstFrame, m_frame); - downloaded = Frame(dstFrame); + AVFrame *dstFrame2 = nullptr; + + if (convert) + { + dstFrame2 = av_frame_alloc(); + dstFrame2->width = dstFrame->width; + dstFrame2->height = dstFrame->height; + dstFrame2->format = AV_PIX_FMT_YUV420P; + if (av_frame_get_buffer(dstFrame2, 0) == 0) + { + *swsCtx = sws_getCachedContext( + *swsCtx, + dstFrame->width, + dstFrame->height, + m_pixelFormat, + dstFrame2->width, + dstFrame2->height, + static_cast<AVPixelFormat>(dstFrame2->format), + SWS_POINT, + nullptr, + nullptr, + nullptr + ); + if (*swsCtx) + { + sws_scale( + *swsCtx, + dstFrame->data, + dstFrame->linesize, + 0, + dstFrame->height, + dstFrame2->data, + dstFrame2->linesize + ); + } + downloaded = Frame(dstFrame2); + } + } + + if (downloaded.isEmpty()) + downloaded = Frame(dstFrame); + av_frame_copy_props(downloaded.m_frame, m_frame); + downloaded.m_frame->key_frame = m_frame->key_frame; downloaded.setTimeBase(m_timeBase); + + if (dstFrame2) + av_frame_free(&dstFrame2); } av_frame_free(&dstFrame); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/qmplay2/Frame.hpp new/QMPlay2-src-23.08.22/src/qmplay2/Frame.hpp --- old/QMPlay2-src-23.08.08/src/qmplay2/Frame.hpp 2023-08-04 22:23:50.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/qmplay2/Frame.hpp 2023-08-21 01:04:22.000000000 +0200 @@ -39,6 +39,7 @@ struct AVPixFmtDescriptor; struct AVBufferRef; +struct SwsContext; struct AVFrame; using AVPixelFormats = QVector<AVPixelFormat>; @@ -160,7 +161,7 @@ bool copyYV12(void *dest, qint32 linesizeLuma, qint32 linesizeChroma) const; - Frame downloadHwData() const; + Frame downloadHwData(SwsContext **swsCtx = nullptr, const AVPixelFormats &supportedPixelFormats = {}) const; #ifdef USE_VULKAN inline std::shared_ptr<QmVk::Image> vulkanImage() const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/qmplay2/Module.hpp new/QMPlay2-src-23.08.22/src/qmplay2/Module.hpp --- old/QMPlay2-src-23.08.08/src/qmplay2/Module.hpp 2023-08-04 00:29:43.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/qmplay2/Module.hpp 2023-08-21 01:07:59.000000000 +0200 @@ -134,7 +134,7 @@ /**/ -#define QMPLAY2_MODULES_API_VERSION 24 +#define QMPLAY2_MODULES_API_VERSION 25 #define QMPLAY2_EXPORT_MODULE(ModuleClass) \ extern "C" Q_DECL_EXPORT quint32 getQMPlay2ModuleAPIVersion() \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/qmplay2/Version.cpp new/QMPlay2-src-23.08.22/src/qmplay2/Version.cpp --- old/QMPlay2-src-23.08.08/src/qmplay2/Version.cpp 2023-08-08 12:00:13.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/qmplay2/Version.cpp 2023-08-21 20:49:19.000000000 +0200 @@ -25,7 +25,7 @@ #ifndef QMPlay2GitHEAD #define QMPlay2GitHEAD #endif -#define QMPlay2Version "23.08.08" QMPlay2GitHEAD +#define QMPlay2Version "23.08.22" QMPlay2GitHEAD QByteArray Version::get() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/qmplay2/opengl/OpenGLCommon.cpp new/QMPlay2-src-23.08.22/src/qmplay2/opengl/OpenGLCommon.cpp --- old/QMPlay2-src-23.08.08/src/qmplay2/opengl/OpenGLCommon.cpp 2023-08-08 01:12:45.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/qmplay2/opengl/OpenGLCommon.cpp 2023-08-19 11:53:10.000000000 +0200 @@ -262,6 +262,7 @@ { //Use sharpness only when OpenGL/OpenGL|ES version >= 3.0, because it can be slow on old hardware and/or buggy drivers and may increase CPU usage! videoFrag.prepend("#define GL3\n"); + videoFrag.prepend(readShader(":/opengl/colorspace.glsl")); } } else @@ -559,18 +560,19 @@ shaderProgramVideo->setUniformValue("uVideoEq", brightness, contrast, saturation, hue); shaderProgramVideo->setUniformValue("uSharpness", sharpness); shaderProgramVideo->setUniformValue("uBitsMultiplier", m_bitsMultiplier); + } - if (m_colorPrimaries == AVCOL_PRI_BT2020 && (m_colorTrc == AVCOL_TRC_BT709 || m_colorTrc == AVCOL_TRC_SMPTE2084)) - { - shaderProgramVideo->setUniformValue("uTrc", m_colorTrc); - shaderProgramVideo->setUniformValue("uMaxLuminance", m_maxLuminance); - shaderProgramVideo->setUniformValue("uColorPrimariesMatrix", Functions::getColorPrimariesTo709Matrix(m_colorPrimaries).toGenericMatrix<3, 3>()); - } - else - { - shaderProgramVideo->setUniformValue("uTrc", 0); - } + if (m_colorPrimaries == AVCOL_PRI_BT2020 && (m_colorTrc == AVCOL_TRC_BT709 || m_colorTrc == AVCOL_TRC_SMPTE2084)) + { + shaderProgramVideo->setUniformValue("uTrc", m_colorTrc); + shaderProgramVideo->setUniformValue("uMaxLuminance", m_maxLuminance); + shaderProgramVideo->setUniformValue("uColorPrimariesMatrix", Functions::getColorPrimariesTo709Matrix(m_colorPrimaries).toGenericMatrix<3, 3>()); + } + else + { + shaderProgramVideo->setUniformValue("uTrc", 0); } + shaderProgramVideo->setUniformValue("uTextureSize", m_textureSize); doReset = !resetDone; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/qmplay2/opengl/shaders/VideoRGB.frag new/QMPlay2-src-23.08.22/src/qmplay2/opengl/shaders/VideoRGB.frag --- old/QMPlay2-src-23.08.08/src/qmplay2/opengl/shaders/VideoRGB.frag 2023-08-06 18:48:49.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/qmplay2/opengl/shaders/VideoRGB.frag 2023-08-19 11:53:10.000000000 +0200 @@ -4,8 +4,11 @@ uniform vec3 uVideoAdj; uniform vec2 uTextureSize; uniform sampler2D uRGB; +uniform int uTrc; +uniform mat3 uColorPrimariesMatrix; +uniform float uMaxLuminance; -#ifdef Sharpness +#ifdef GL3 vec4 getRGBAtOffset(float x, float y) { return texture(uRGB, vTexCoord + vec2(x, y)); @@ -17,7 +20,7 @@ float brightness = uVideoAdj[0]; float contrast = uVideoAdj[1]; vec4 RGB = texture(uRGB, vTexCoord); -#ifdef Sharpness +#ifdef GL3 float sharpness = uVideoAdj[2]; if (sharpness != 0.0) { @@ -34,6 +37,14 @@ // Subtract blur from original image, multiply and then add it to the original image RGB = clamp(RGB + (RGB - blur) * sharpness, 0.0, 1.0); } + if (uTrc == AVCOL_TRC_BT709) + { + colorspace_trc_bt709(RGB.rgb, uColorPrimariesMatrix); + } + else if (uTrc == AVCOL_TRC_SMPTE2084) + { + colorspace_trc_smpte2084(RGB.rgb, uColorPrimariesMatrix, uMaxLuminance); + } #endif gl_FragColor = clamp((RGB - 0.5) * contrast + 0.5, 0.0, 1.0) + brightness; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QMPlay2-src-23.08.08/src/qmplay2/vulkan/VulkanWindow.cpp new/QMPlay2-src-23.08.22/src/qmplay2/vulkan/VulkanWindow.cpp --- old/QMPlay2-src-23.08.08/src/qmplay2/vulkan/VulkanWindow.cpp 2023-08-06 15:53:10.000000000 +0200 +++ new/QMPlay2-src-23.08.22/src/qmplay2/vulkan/VulkanWindow.cpp 2023-08-21 20:06:38.000000000 +0200 @@ -147,7 +147,11 @@ setSurfaceType(VulkanSurface); setVulkanInstance(m_instance->qVulkanInstance()); - switch (m_physicalDevice->properties().vendorID) + if (m_platformName == "xcb" && !qgetenv("WAYLAND_DISPLAY").isEmpty()) + { + m_useRenderPassClear = true; + } + else switch (m_physicalDevice->properties().vendorID) { #if !defined(Q_OS_WIN) case 0x8086: // Intel