summaryrefslogtreecommitdiffstats
path: root/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move the texture uploading code into Qt MultimediaLars Knoll2021-04-071-424/+0
| | | | | | | | | | Qt Multimedia has now some generic helper functions to upload the video data into textures. This way, we can greatly simplify the rendering code in qtmultimediaquicktools. Change-Id: I5b0e3eb96cbcf79fe5e9757697f11b0183132b17 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use the infra in QVideoSurfaceFormat to get shaders and uniformsLars Knoll2021-04-071-93/+30
| | | | | | | | | | frame mapping is still done in qtmultimediaquicktools, but once that's moved as well, we can radically simplify the rendering code there. Change-Id: Ia56c8b62c5726f1bfea0b0c4c46a81e103141e9e Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move the shaders from the quick tools into QtMultimediaLars Knoll2021-04-071-8/+8
| | | | | | | | | | | | | The shader layout is pretty generic, and QVideoSurfaceFormat can give us both the shaders and uniform data that we need to render the video. All the user needs to do then is to provide geometry with a 2D texture coordinate to render the video onto any surface. Change-Id: I95006eaf4a6f039006b8a5da0f53143da03e1ecb Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* More work to enable HW decoding for Qt QuickLars Knoll2021-04-071-10/+18
| | | | | | | | | | | | | | | | | Request GL textures from the pipeline for now. Some initial code to also use the texture upload meta functionality in gstreamer, but that will require some more work so we don't make the GL context current in the wrong thread. The gstreamer VAAPI elements on AMD hardware (or in general...) seem to have some bugs. Converting a VASurface to a GL texture using the texture upload meta doesn't create an ARGB texture as promised, but does write some YUV data into the texture. And trying to map a SW buffer received from the VAAPI decoders fails. Change-Id: I9b629eb84f3f32adc23ae2e2fd1cd3e42e6afbc0 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Start adding infrastructure to retrieve video frames as textureLars Knoll2021-04-061-8/+6
| | | | | | | | | | | | | | | We're using RHI here, as that's what we need for Qt Quick anyway. You can now set a QRhi object on QVideoSink. This can then be used internally to create textures of the required format instead of memory buffers. QVideoSurfaceFormat will now tell you how many planes are required for the format, and you can retrieve the textures for each plane from QVideoFrame. Change-Id: I86430db60a8f1aba07ec3b38e22b977cdaefaa0a Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add support for rendering P010 and P016 formats in QuickLars Knoll2021-04-061-1/+83
| | | | | | | | | | | | | Those are HDR formats with 10 bit color depth. But since our target surface has only 8 bits of color depth, we can simply ignore the two least significant bits when rendering. Fortunately, the format makes it rather easy to do that as it always uses 16bits per channel. Change-Id: I20490b4641715903797068b9af13ebbfcbea63e5 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Move the PixelFormat enum from QVideoFrame to QVideoSurfaceFormatLars Knoll2021-04-061-16/+16
| | | | | | Change-Id: Ifa888c74c397c640b19387a9ce624dfcf8269c2c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Remove the handle type from QVideoSurfaceFormatLars Knoll2021-04-061-11/+5
| | | | | | | | | This is a property of the individual QVideoFrame, and doesn't belong here. Change-Id: I85f180ff46023f6a48ef856a356d9c45c3f6be1b Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Move HandleType and MapMode from QAbstractVideoBuffer to QVideoFrameLars Knoll2021-03-161-8/+8
| | | | | | | | | | QAbstractVideoBuffer is a class that is only required inside our implementation, so we can make it private. This change prepares for it. Change-Id: I4ba4542c1eab742f2fc93231e2e5063dbc5d5e94 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Modernize code baseLars Knoll2021-03-021-3/+1
| | | | | | | | | | | Use clang-modernize to modernize the code base * Use = default where applicable * Use nullptr Change-Id: I88b307e76b7f7dde090354ff4b292cea76f5c60c Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Modernize code baseLars Knoll2021-01-211-3/+3
| | | | | | | | | Run clang-tidy over the code base with some code modernization options. Change-Id: I9e74d1225bce333e74224e3b92c02c7e9884d8f5 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* Quick: Introduce multiple textures for NV12/NV21 video framesVaL Doroshchuk2020-09-091-1/+23
| | | | | | | | | | | | | | | | | | | For QVideoFrame::Format_NV12 and Format_NV21 formats added a possibility to provide the video frames in QAbstractVideoBuffer::GLTextureHandle, MTLTextureHandle multiple textures. Currently QVideoFrame::handle() is used to have only one texture. Which limits the video frames only for RGBA format. NV12/NV21 requires 2 textures, one for chroma and for luma components. So QVideoFrane::handle() must return a list with 2 native handlers. The patch allows to render the video frames in NV12/NV21 formats with multiple textures, using current QSGTexture's to avoid uploading/downloading the data. Change-Id: I3e6e734948a43dc77bfd2dcacb69cf8ffefdb813 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Quick: Always create sg textures in ctor()VaL Doroshchuk2020-08-301-8/+4
| | | | | | | Since compare() can be called before updateUniformData() Change-Id: I7a1e0a08926cbf6d5629468b8bf64dcd7602b399 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Update dependencies on 'dev' in qt/qtmultimediaVaL Doroshchuk2020-06-301-1/+1
| | | | | Change-Id: I463d3a1541cee1fcf4a6b6d1e2e1eac85fbfc682 Reviewed-by: Val Doroshchuk <valentyn.doroshchuk@qt.io>
* Quick: Fix padded video frame when bytes per line > widthVaL Doroshchuk2020-06-151-7/+7
| | | | | Change-Id: I625bb06f81ce9860d49d7998cc49c304f2d6b848 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* RHI: Remove gl code from video nodesVaL Doroshchuk2020-06-041-395/+29
| | | | | | | | Now QSGMaterialShader handles rhi textures too. Task-number: QTBUG-78678 Change-Id: I410185c80bd104741fd5b52deeb87eb97531410a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Quick: Add support of RHI for video framesVaL Doroshchuk2020-05-291-2/+220
| | | | | | | | Added RHI shaders for RGB*, YUV* and opengl texture video frames. Task-number: QTBUG-78678 Change-Id: I045d6a806fea059a80b8e5d9817b6997af8d0f41 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Update qtbase dependencyFriedemann Kleint2020-03-251-1/+1
| | | | | | | | | - Adapt to QOpenGLWidgets split - Use new Q_MOC_INCLUDE directive where required - Fix QtConcurrent usage Change-Id: I9de650ae4fbbd397ef4fd4650c8aa5a0443d566f Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
* Add YUV422P format support to QVideoFrame and declarative rendererTomasz Olszak2019-05-101-8/+11
| | | | | | | | | [ChangeLog] Added QVideoFrame::Format_YUV422P. Change-Id: If7741db00cf0b628d7fc4b1cd3a6e424e0f8e2c0 Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix comment for YUV fragment shadersSamuel Gaist2019-01-291-2/+2
| | | | | | | | | The comment contains information which makes it misleading to understand how the components are passed. Change-Id: I29cdb5eec1e8014fa7f0ca3f1a0f54258fdb431f Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Add OpenGL core profile support to QtMultimediaQuickToolsMassimo Callegari2018-09-031-6/+41
| | | | | | | | | | | | When requesting a OGL Core profile via QSurfaceFormat::setDefaultFormat (e.g. to use Qt3D advanced features), it is no longer possible to render QML Video items. This is because the requested shaders should be _core versions. This patch adds the core shaders so QtMultimedia stops whining, and bind textures with the proper format, since GL_LUMINANCE and GL_LUMINANCE_ALPHA are no longer valid in OGL 4. Task-number: QTBUG-51064 Change-Id: I909e01e7dc7be07549e9ecf0a6425b309af38ea1 Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io> Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-201-13/+19
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm Change-Id: Ic43fb2a805ed9f0f2ea48993d47859716f1f11b4
| * Improve quality of YUVY and UYVY renderingTomasz Olszak2018-01-151-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Idea is to upload YUYV/UYVY data as 2 textures and use GL_LINEAR like in biplanar formats. Having proper interpolation of only one texture (using e.g. mix function) resulted in vertical and horizontal 1 pixel stripes depending on scale. The reason was float precision and unexpected value of fract function. Additionally branching in shader is expensive so this solution should be more performant. Task-number: QTBUG-62155 Change-Id: I7ceeb09b4a54eecd16640a626b499d638b52c127 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* | Replace Q_DECL_OVERRIDE with overrideKevin Funk2017-09-221-3/+3
|/ | | | | Change-Id: I17b3650a3df5688274151c1f2c4629e4a5062028 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add missing override and remove redundant virtualAlexander Volkov2016-12-121-8/+8
| | | | | Change-Id: Ifd439abf21877adff57080489324bea729ee5279 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* Implement YUV 4:2:2 8bit support for QtQuickSamuel Gaist2016-04-291-4/+95
| | | | | | | | | | | This patch implements support for rendering of UYVY and YUYV sources when using QtQuick for preview. [ChangeLog][QtQuick][Rendering] Support for YUV 4:2:2 8bit has been implemented for the QtQuick viewfinder. Change-Id: I4d98f3c44240ee53f7708bc6bd84e7fb83aac069 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* Updated license headersAntti Kokko2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I324f65c61171f36641472964d095d72e452afb3a Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix some private headers.Yoann Lopes2015-11-241-1/+1
| | | | | | | | | - Add missing "We mean it" comment - Add missing '_p' suffix for QtMultimediaQuick_p headers Task-number: QTBUG-49480 Change-Id: I1fd4f8b2fdffecebaebaedaf1b78e1da62c08156 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Fix video nodes material comparison.Yoann Lopes2015-07-201-0/+3
| | | | | | | | | Don't consider a material equal to another when their texture IDs are not available yet. Change-Id: Id4127d71abb2db33950a206dc722b24ab626e960 Task-number: QTBUG-47205 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Fix texture unit bug in the YUV video node.Yoann Lopes2015-05-121-1/+2
| | | | | | | | | | fe13f5bb introduced a bug which could leave the active texture unit set to GL_TEXTURE1 or GL_TEXTURE2. When the material is done updating its state, it needs to make sure the active texture unit is reset to 0 since other materials might assume that's the current value. Change-Id: I64a6a0cd9fcecdf0fa483909193f70045ff0e9fe Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Minor refactor of built-in QSGVideoNodes.v5.5.0-beta1Yoann Lopes2015-04-301-173/+105
| | | | | | | | | | | - Load shader source from resource files. - Correctly report material types: each material can use different shaders depending on the video pixel format but it was reporting a unique material type. This was causing the node to keep using the same shader even if its pixel format changed. Change-Id: Ib903ecd6e7dd1dd56d7cefe255ab7049933df17d Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Add NV12/NV21 support into SG videonode.Timur Pocheptsov2015-03-201-0/+460
Add new fragment shaders and update declarative render (video node) to support NV12/NV21 pixel format. Task-number: QTBUG-45021 Change-Id: I5d52007f0da56165752268d06efca156f7496b42 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>