summaryrefslogtreecommitdiffstats
path: root/src/multimedia/video
Commit message (Collapse)AuthorAgeFilesLines
* Add methods QVideoFrame::streamFrameRate and setStreamFrameRateArtem Dyomin7 days2-0/+20
| | | | | | | | | | | | | | Users need to be able to modify underlying QVideoFrameFormat::streamFrameRate, it's needed for working custom video input, when the user gets QVideoFrame from QVideoSink and wants to set a new stream frame rate for the format and send it to custom video input. [ChangeLog][QVideoFrame] Added the property 'streamFrameRate' to QVideoFrame. Change-Id: I061eac1f1ecdb0828ef079cee14e0871181fdd08 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Add rotation property to QVideoFrameFormatArtem Dyomin7 days4-4/+26
| | | | | | | | | | | | | | | We initialize QMediaRecorder by its properties and matching QVideoFrameFormat of the source. That's why, we need the property in QVideoFrameFormat for proper initialization. Note, we already have 'isMirrored' in QVideoFrameFormat, 'mirrored' in QVideoFrame, 'rotation' in QVideoFrame, so adding rotation to QVdieoFrameFormat looks consistent. [ChangeLog][QVideoFrameFormat] Added the property 'rotation' to QVideoFrameFormat. Change-Id: I62abd2e8a1ade4e1e2144c2adc6bc6606828af88 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Use correct stride factor with YUV420P10 pixel formatJøger Hansegård7 days1-1/+1
| | | | | | | | | | | | | | | | | | YUV420P10 assumes 16 bits per component (of which 10 is used). This patch changes the stride factor from 1 to 2 with Format_YUV420P10 to reflect the 16 bit word size. The tests are also extended to cover most pixel formats supported by QVideoFrame. [ChangeLog] Fix display of videos using YUV420P10 pixel format Task-number: QTBUG-124537 Task-number: QTBUG-124534 Task-number: QTBUG-123749 Pick-to: 6.5 6.7 Change-Id: I289b33dc2b553cc3b8b6bc4b43831eb75c277129 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Rename QVideoFrameFormat::frameRate => streamFrameRateArtem Dyomin7 days2-2/+27
| | | | | | | | | | The name 'frameRate' is not consistent with QVideoFrameFormat, 'streamFrameRate' works much better. [ChangeLog][QVideoFrameFormat] Renamed the property QVideoFrameFormat::frameRate to QVideoFrameFormat::streamFrameRate. Change-Id: I03413f15669de471371e6ed42ce948c22d1b5f5f Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Align QVideoFrame::mirrored with QVideoFrameFormat::isMirroredArtem Dyomin8 days2-4/+4
| | | | | | | | | The values should by synced upon the frame creation. Pick-to: 6.7 6.5 Change-Id: I952334daaef5d9af209b783af0bf31ee2525aa92 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Tim Blechmann <tim@klingt.org>
* Apply clazy's old-style-connectTim Blechmann2024-05-031-2/+2
| | | | | | | | | Pointer-to-member syntax is faster, has improved type safety and is more tooling friendly. Pick-to: 6.5 6.7 Change-Id: If629ba3fe29bfa88014ee07d9641b77e030e7de8 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Add since 6.8 to a new QVideoFrame constructor documentationArtem Dyomin2024-04-261-0/+1
| | | | | | Change-Id: I4f2fd9194a718f061d9c1a43cc69c73c4d5f1805 Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Enable HDR based on video frame format for QtWidgetsPavel Dubsky2024-04-171-2/+9
| | | | | | | | | | | | | Currently swap chain is configured for SDR or HDR only on creation and there is no support for dynamic change when video is played using QVideoWindow. This change adds check that determines whether video frame contains SDR or HDR content and reconfigures swap chain (and subsequently shaders) if needed. Fixes: QTBUG-120963 Pick-to: 6.7 6.6 6.5 Change-Id: I8eef9b46b3999e00427cc50f82486cea7cd80e09 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Prevent lost D3D11 device with QVideoFrame::toImage() with Qt QuickJøger Hansegård2024-04-162-2/+2
| | | | | | | | | | | | | | | | | | This patch ensures that QFFmpeg::TextureConverter is only used to convert frames when the destination QRhi instance is the same as the one it was initialized on. If QVideoFrame::toImage() is called from the main thread while the frame is also being rendered in the Qt Quick render thread, QVideoFrame::toImage() will create its own QRhi instance. In this case we need to disable direct texture transfer of the QFFmpeg textures, and instead fall back to mapping the texture data through CPU memory. Task-number: QTBUG-113627 Pick-to: 6.7 6.5 Change-Id: I3184796d05627fcac1a069400e8a6a5879fcd5bc Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Add QVideoFrame constructor that converts from QImageJøger Hansegård2024-04-093-0/+48
| | | | | | | | | | | | | | | This new constructor simplifies creating QVideoFrame instances from a QImage, and is an enabler for capturing custom images to a video or send custom images to video output. This API change is based on draft in ea057257bd68f53aa4b201ddb4ad1986c5cc84e8 [ChangeLog] Added QVideoFrame constructor that converts from QImage Fixes: QTBUG-122099 Change-Id: If023738fd397ae393564b1857d711115909ac418 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* strings: use QStringLiteral instead of fromUtf8Tim Blechmann2024-04-091-6/+6
| | | | | | | | This avoids run-time unicode conversions. Pick-to: 6.5 6.6 6.7 Change-Id: Ief6aa32288b300ee05232e7372b6f701562194fc Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Tighten ownership of video buffers in QVideoFrameJøger Hansegård2024-04-042-6/+4
| | | | | | | | | | Switch to std::unique_ptr to prevent future lifetime management bugs Task-number: QTBUG-122099 Pick-to: 6.7 6.6 6.5 Change-Id: I453915a135e07dd175bf3632724a3d7d8200b47d Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Video - rename ALIGN to QT_MEDIA_ALIGNTim Blechmann2024-03-254-6/+6
| | | | | | | | | | ALIGN clashes with the macos macro of the same name as defined in `usr/include/i386/param.h` Pick-to: 6.5 6.6 6.7 Change-Id: I58ca673f38c75f1976d96dbb72bb494ae7e8036e Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
* Fix mapping of QVideoFrame in write modeArtem Dyomin2024-03-192-4/+14
| | | | | | | | | | | | | | | | After mapping of QVideoFrame with a write mode, we get this: - the hw frame in QFFmpegVideoBuffer is not valid anymore - the cached QImage is not valid anymore The implemented approach might be revisited if we decide to implement copy-on-modify idiom for QVideoFrame instead of buffer sharing. Fixes: QTBUG-123131 Pick-to: 6.7 6.6 6.5 Change-Id: I1c1662c5a4ac6f5bffa2cea8e36c4fbf60c20f64 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Fix keeping frame mapped after the target OpenGL texture releasedArtem Dyomin2024-03-141-46/+55
| | | | | | | | | | | | | | | | | | | | | It's a regression after codereview.qt-project.org/c/qt/qtmultimedia/+/537062 The added test doesn't work without the fix. The main reason of the regression is that the OpenGl rendering pipeline in QRhi keeps the source QImage/QByteArray for some time after the texture loading and even the texture releasing. It's not going to be fixed in QRhi now, the most relevant approach seem to be fixing on QtMM side with matching tests. We're choosing the approach suggested in codereview.qt-project.org/c/qt/qtmultimedia/+/541083 Pick-to: 6.7 6.6 6.5 Change-Id: I1822a5f61c022dc6375e41a984f13b23137b9b5a Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Fix size of QVideoSink when the video is rotatedArtem Dyomin2024-03-132-9/+6
| | | | | | | | | | | | | | | | | | The size of QVideoSink impacts on sizeHint of QVideoWidget, and it can be taken by users for their own size hints. All renderers draw rotated videos like this: if the frame size is AxB, and the rotation is 90 degrees, the rendering size becomes BxA. Let's keep QVideoSink::videoSize consistent. Added a function to qtmm utilities to get rotates size. Pick-to: 6.7 6.6 6.5 Change-Id: Ia0cb6f43a598820007fac8178104631a80d96dfb Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
* Fix 'divide by zero' codecheck warningArtem Dyomin2024-02-201-3/+4
| | | | | | | | Pick-to: 6.7 6.6 6.5 Change-Id: I620daf0763095ed1f079625c4fa13592356d1450 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
* Eliminate copying of frame data upon creating textures from memoryArtem Dyomin2024-02-195-25/+88
| | | | | | | | | | | | | | | | | | | | It's possible to load QRhiTexture from QImage, and QImage supports zero-copy creation from a pointer. It's documented in QRhi that the image format is not considered upon loading QRhiTexture from memory, so we use just any size-compatible image format. Already existing unit tests cover the change, see tst_qvideoframecolormanagement. To make the tests pass, we should fix opengl rendering backend in qtbase, see the matching CR: codereview.qt-project.org/c/qt/qtbase/+/537233 Task-number: QTBUG-121934 Pick-to: 6.7 6.6 6.5 Change-Id: Ief488550e8f8fe5dbbc6680f5284c6e540a1f3b4 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Reformat color matricesJøger Hansegård2024-02-181-53/+27
| | | | | | | | | | | | The color matrices used for color conversions in Qt Multimedia were a bit messy. This patch reformats the matrices and uses brace initialization for return value to reduce clutter. In addition some dead code is removed. Pick-to: 6.7 6.6 6.5 Change-Id: I20e68aae900445797c7e8c0807cb642aa62d5ecf Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Move QVideoFramePrivate to a separate fileArtem Dyomin2024-02-112-35/+53
| | | | | | | | | | The patch is need for following improvements. Task-number: QTBUG-121793 Pick-to: 6.7 6.6 6.5 Change-Id: I3ed128fc7059d7321af1e6f83bfade6c56cccad9 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Map/unmap QVideoFrame one time upon loading textures from memoryArtem Dyomin2024-02-081-8/+10
| | | | | | | | | | | If the planes count is more than 1, no reason to map/unmap frame for handling each plane. Pick-to: 6.7 6.6 6.5 Change-Id: I158e0faa4a9f1e6c617a3a7f245ee084bfdad50b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Rename qvideo.h => qtvideo.h according to API reviewArtem Dyomin2024-01-303-6/+6
| | | | | | Pick-to: 6.7 Change-Id: I315835a9ab011709aafcff4c35ed48a600bc64ee Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Doc: Fix documentation warningsTopi Reinio2024-01-251-1/+1
| | | | | | | | | | | | | | | | | | src/multimedia/video/qvideoframe.cpp:650: (qdoc) warning: clang couldn't find function when parsing \fn RotationAngle QVideoFrame::rotationAngle() src/multimediaquick/qquickimagecapture.cpp:158: (qdoc) warning: Undocumented parameter 'requestId' in ImageCapture::imageCaptured() In addition, the 'warninglimit' variable in qtmultimedia.qdocconf was not set correctly. Set it to zero to enforce no documentation warnings in the CI. Pick-to: 6.7 Change-Id: Ic9b4fcb3848d0035fe0da9ba68cd58b9ac2b3bad Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Implement fixing of QImage by QImageVideoBufferArtem Dyomin2024-01-232-1/+54
| | | | | | | | | | | | | | Many of QImage formats are not mapped to QVideoFrame formats without conversions. Let's consider this and ensure a correct video frame format. Eglfs screen capture is to be fixed in the next commits. The relevant unit test is added to the patch. Pick-to: 6.7 6.6 6.5 Change-Id: Ic4a490392ec2b6aa63e752badea7269a07d93af9 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix conversion of QImage::Format_RGBA8888_Premultiplied to PixelFormatArtem Dyomin2024-01-231-1/+3
| | | | | | | | | | | | | | QImage::Format_RGBA8888_Premultiplied should be converted to QVideoFrameFormat::Format_RGBA8888_Premultiplied which is not present in the list of formats. It should be added in 6.8. We've got the format on eglfs, when we grab a frame by OpenglCompositor. The best workaround is conversion to QVideoFrameFormat::Format_RGBX8888. Pick-to: 6.7 6.6 6.5 Change-Id: Ic84d47f62c379e4a476a868b2985b525c0ec7edb Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Apply API review comment: qmmetaobject.h => qobjectdefs.hArtem Dyomin2024-01-231-1/+1
| | | | | | Pick-to: 6.7 Change-Id: I2c5928a5ca8fe70d0bc0d04e2f3054c9a49699b0 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* QVideoWindow: Recreate swapchain if it was previously destroyedDoris Verria2024-01-171-1/+1
| | | | | | | | | | | | We release and destroy the swapChain on a PlatformSurface event. If the window is render()-ed again after this, we need to recreate the swapChain using QRhiSwapChain::createOrResize(). Fixes: QTBUG-113498 Pick-to: 6.5 6.6 6.7 Change-Id: Ibc8b369c41b9e2e49be4465d6e50e3a5a366e434 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QVideoWindow: Immediately render window on an Expose eventDoris Verria2024-01-171-1/+1
| | | | | | | | | | | | | | | | QWindow::requestUpdate() is used to signal that the window needs to be redrawn (typically because something changed), but the actual drawing will not happen until the next event loop iteration. On an Expose event, we need to immediately draw the window to avoid any delay. Replace the call to requestUpdate() on an Expose event with a direct call to render(), ensuring a prompt window rendering. Pick-to: 6.5 6.6 6.7 Change-Id: Ib74c1ca9706fdc6d92ae8ce659a4fc345edc77d5 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Apply API review comments: rename QVideo::RotationAngleArtem Dyomin2024-01-157-38/+50
| | | | | | | | | | | | | | | | | | | | API review: codereview.qt-project.org/c/qt/qtmultimedia/+/528314 We make the naming consisten with what we already have in another module: doc.qt.io/qt-6/qpdfdocumentrenderoptions.html#Rotation-enum Renamings: namespace QVideo -> namespace QtVideo RotationAngle -> Rotation Rotation::Rotation** -> Rotation::Clockwise** Pick-to: 6.7 Change-Id: Ie59c30e788478dc4bc21b68a18102aece046960e Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Apply API review comments: fix headersArtem Dyomin2024-01-152-2/+3
| | | | | | | | | | | | The API review: codereview.qt-project.org/c/qt/qtmultimedia/+/528314 Include <QtCore/qmetaobject.h> cannot be removed as the macros in the file use some QMetaObject functionality. Pick-to: 6.7 Change-Id: Iecf7585e32d0da1128577448b233e3d052b25d47 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix CodeChecker warning in qvideotexturehelperJøger Hansegård2024-01-091-2/+2
| | | | | | | | | | | | | | | | | CodeChecker reported warning in qvideotexturehelper.cpp line:638 after commit 70c4bf4c565c3ace547f5cbd0398953fcd1ff4f3 Passing result of std::move() as a const reference argument; no move will actually happen in file:src/multimedia/video/qvideotexturehelper.cpp line:638 col:32 subresDesc.setData(std::move(underlyingByteArray)); This patch fixes this issue by not calling std::move. Pick-to: 6.7 6.6 6.5 Change-Id: I04b1fcb4a3e0ce3436f184f4db6ed4b6b512f459 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Implement zero copy rendering of QMemoryVideoBufferArtem Dyomin2024-01-064-2/+29
| | | | | | | | | | | | We use QRhiTextureUploadEntry to create textures from memory. QRhiTextureUploadEntry takes QByteArray, let's pass there the array from QMemoryVideoBuffer to get round extra copying. Some of the added functionality is unit-tested in the next CR. Pick-to: 6.7 6.6 6.5 Change-Id: Iaa16cbceb189b38713e427eb76f72396ad0d759d Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Prettify QMemoryVideoBufferArtem Dyomin2024-01-062-12/+12
| | | | | | | | | Minor cleanup in QMemoryVideoBuffer. Pick-to: 6.7 6.6 6.5 Change-Id: I52a63519bc226bd70322c8e0b2071962bd5e023b Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Move QImageVideoBuffer to a separate fileArtem Dyomin2023-12-282-0/+80
| | | | | | | | | The class is to be resued in eglfs screen capture. Pick-to: 6.7 6.6 6.5 Change-Id: I3161757ce7590e4299f9f017d4be4d50a2560db0 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
* Reset RHI state on application suspendVolker Krause2023-12-211-0/+20
| | | | | | | | | | | | This fixes a crash on Android when mapping a QVideoFrame from the camera after the application has been resumed from suspension. Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-113616 Change-Id: If107c7e8b9595f638034ea0bb05995ce5f096c0d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Bartlomiej Moskal <bartlomiej.moskal@qt.io>
* Doc: Fix example file quoting and missing namespace documentationTopi Reinio2023-12-141-0/+7
| | | | | | | | | | | | | | | | | | | | Fixes the following documentation warnings: declarative-camera.qdoc:54: (qdoc) warning: Command '\printto' failed at end of file declarative-camera.qdoc:152: (qdoc) warning: Command '\printuntil' failed at end of file qvideo.cpp:8: (qdoc) warning: RotationAngle is documented, but namespace QVideo is not documented in any module. Mark the documentation project free of warnings. Pick-to: 6.7 6.6 Change-Id: I45153fa9f6ba29a9d636229ef0a0465916f0291f Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Add Q_NAMESPACE_EXPORT to recently added QVideo namespaceArtem Dyomin2023-11-242-0/+6
| | | | | | | | | This allows to apply qt meta macros to enums, QT_ENUM_NS. QT_ENUM_NS adds convenient output for enums and makes it possible to export to qml. Change-Id: I16c057465d3baeb65439bca6cab9eff7291e8107 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Add Correction Angle to QCameraDevice and QVideo namespaceSamuel Mira2023-11-236-19/+76
| | | | | | | | | | | | | Add a property called Correction Angle in QCameraDevice. The correction angle represents the rotation in degrees needed to match the mounted camera angle with the native orientation. Refactored to a QVideo namespace for the RotationAngle. Change-Id: Icfbd766e12ee1331de5235a535348b502ec158f0 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Fix BT2020 full range color transformation matrix and add testsJøger Hansegård2023-11-131-11/+14
| | | | | | | | | | | | | | | | | The color transformation matrices are hard to maintain. Having tests that demonstrates how they are calculated makes them easier to maintain. While writing these tests, we found that the matrices for BT2020 with full range YUV signal did not match the limited range version, giving too green images. Other coefficients were also adjusted to agree better with the reference, but these changes were insignificant. Task-number: QTBUG-117744 Pick-to: 6.5 6.6 Change-Id: I2207e4919bf7f8ff63cec995b866843354228364 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix full range color transform matrix for the 709 YCbCr to RGBChristian Strømme2023-11-101-5/+4
| | | | | | | | Fixes: QTBUG-117744 Pick-to: 6.6 6.5 Change-Id: I9f80add59986a6bd8aa1947a2804097e84eea2d5 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Avoid resource_name collisions in qt_add_shaders callsLaszlo Agocs2023-11-071-1/+1
| | | | | | | | | | | | | | | It has been pointed out that platforms with static builds can end up in symbol name clashes when a Qt library and an application uses the same resource_name in qt_add_shaders or qt_add_resources. Avoid this by using more unique resource_names for Multimedia's own qt_add_shaders calls. Pick-to: 6.6 6.5 Fixes: QTBUG-118624 Change-Id: Ie3cc65abe42be1ae6bc61a6e2951997b4c398b79 Reviewed-by: Lars Knoll <lars@knoll.priv.no> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QVideoTextureHelper: add missing QVideoFrame::unmap() callVladimir Belyavsky2023-10-301-0/+2
| | | | | | | | | | | | | In QVideoTextureHelper::updateTextureWithMap() we do frame.map(), but there is no corresponding frame.unmap() call, what may potentially lead to memory leaks and/or other side effects. So adding a scope guard to call frame.unmap() on any return from the function. Task-number: QTBUG-118587 Pick-to: 6.5 6.6 Change-Id: I04062cfcd23698872e825bd88044e30858e8d12a Reviewed-by: Lars Knoll <lars@knoll.priv.no> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Fix broken QVideoFrame::map with YUV422P pixel formatJøger Hansegård2023-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A regression in change-344586 caused the QVideoFrame::map function to set the incorrect strides for the YUV422P format. This caused QVideoFrame::bytesPerLine to return incorrect stride value, and thereby giving wrong sizes for frame allocations that disagree with FFmpeg. The YUV422P format is a planar format, where the Y, U, and V components are in separate color planes. The U and V planes are sub-sampled horizontally to half the width of the Y plane, but have the same height as the Y plane. +----------- Y_stride ------------+ | | | Y (8 bit) | height | | U_offset --> +--- U_stride ---+----------------+ | | | U (8 bit) | height | | V_offset --> +--- V_stride ---+ | | | V (8 bit) | height | | +----------------+ After this fix, the U and V strides are correctly calculated as U_stride = Y_stride / 2 and U_stride = Y_stride / 2 Thus we get the correct plane size as V_offset = Y_stride * height + Y_stride / 2 * height Fixes: QTBUG-116991 Pick-to: 6.5 6.6 Change-Id: Ifd9f83ee75e0d5f869675232d13d7e2b84a04c7b Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Fix x11 surface capture alpha channelArtem Dyomin2023-08-074-3/+158
| | | | | | | | | | | | | | | | We declare 0xFF alpha channel in formats XRGB, BGRX, etc, but on some linux systems it's 0xff in xImage. The patch fixes the problem and suggests SIMD optimizations for intel platforms that makes a difference with 4K displays. With the optimizations, the overhead is not so big comparing with memcpy. We have a test that covers the case, it failed on some machines. Pick-to: 6.6 6.5 Change-Id: I78927ea58159ae67bbf993f30b8dec45f617edc1 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Fix QVideoFrame::toImage thread-safetyArtem Dyomin2023-07-271-4/+9
| | | | | | | | | | | | | | * toImage is const and it's expected to be thread-safe * since video frames are often emitted from separate threads, there might be collisions with 2 images created in parallel. * Even though QImage assignment is thread safe, let's avoid possible parallel rendering to different images. Pick-to: 6.6 6.5 6.2 Task-number: QTBUG-111975 Change-Id: Ib26982e3a1df888dbf70c3c0ff73392d4dc81c80 Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Apply 6.6 API review commentsArtem Dyomin2023-06-091-11/+2
| | | | | | | | | | | | | | - export QCapturableWindow methods instead of the class - add Q_DECLARE_SHARED - use QT6_ONLY macro - make QCapturableWindow operators hidden friends API comparison: codereview.qt-project.org/c/qt/qtmultimedia/+/481755 Pick-to: 6.6 Change-Id: I90b8d58611208fccd2ce027d63b9cd15a9fe6d30 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Adapt to the RHI API conceptLaszlo Agocs2023-05-226-36/+7
| | | | | | Task-number: QTBUG-113331 Change-Id: I992f3cbc9e4ceff6e62452bf354e5c46dd8fa84b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QVideoTextureHelper: Fix color matrix calculationDoris Verria2023-04-261-1/+1
| | | | | | | | | | | | | | | | | | | The color matrix for BT709 video (limited) range, had a small mistake. From calculations based on the BT709 standard and for video range (16 - 235) values, the conversion equations are: R = Y * 1.1644 + V * 1.7928 + (-248.100994) G = Y * 1.1644 + U * -0.2132 + V * -0.5329 + 76.878080 B = Y * 1.1644 + U * 2.1124 + (-289.017566) So there was a missplacement between two of the coeficients in the matrix. Fixes: QTBUG-108083 Pick-to: 6.5 6.2 Change-Id: If58c7df8a9ad4d975a2ac0c90cd3692232210995 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Ensure thread-safe qInitConvertFuncsAsmArtem Dyomin2023-02-171-5/+5
| | | | | | Pick-to: 6.5 6.5 Change-Id: Ibce8162ff461a5798ecd5720e41f60077ad19ab4 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Disambiguate static constants, variables and functionsFriedemann Kleint2023-02-152-9/+9
| | | | | | | | | | They cause clashes in CMake Unity (Jumbo) builds. Task-number: QTBUG-109394 Pick-to: 6.5 Change-Id: I856ed6b5f511299845a49f989ccd74a3e5480e44 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Doris Verria <doris.verria@qt.io>