diff options
Diffstat (limited to 'src/multimedia/video/qvideotexturehelper.cpp')
-rw-r--r-- | src/multimedia/video/qvideotexturehelper.cpp | 84 |
1 files changed, 58 insertions, 26 deletions
diff --git a/src/multimedia/video/qvideotexturehelper.cpp b/src/multimedia/video/qvideotexturehelper.cpp index 706844022..77ad98f3e 100644 --- a/src/multimedia/video/qvideotexturehelper.cpp +++ b/src/multimedia/video/qvideotexturehelper.cpp @@ -45,135 +45,167 @@ namespace QVideoTextureHelper static const TextureDescription descriptions[QVideoFrameFormat::NPixelFormats] = { // Format_Invalid - { 0, + { 0, 0, + [](QSize) { return 0; }, { QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat}, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_ARGB32 - { 1, + { 1, 4, + [](QSize s) { return 4*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_ARGB32_Premultiplied - { 1, + { 1, 4, + [](QSize s) { return 4*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_RGB32 - { 1, + { 1, 4, + [](QSize s) { return 4*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_BGRA32 - { 1, + { 1, 4, + [](QSize s) { return 4*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_BGRA32_Premultiplied - { 1, + { 1, 4, + [](QSize s) { return 4*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_ABGR32 - { 1, + { 1, 4, + [](QSize s) { return 4*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_BGR32 - { 1, + { 1, 4, + [](QSize s) { return 4*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_AYUV444 - { 1, + { 1, 4, + [](QSize s) { return 4*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_AYUV444_Premultiplied - { 1, + { 1, 4, + [](QSize s) { return 4*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_YUV420P - { 3, + { 3, 1, + [](QSize s) { return 3*s.width()*s.height() / 2; }, { QRhiTexture::R8, QRhiTexture::R8, QRhiTexture::R8 }, { { 1, 1 }, { 2, 2 }, { 2, 2 } } }, // Format_YUV422P - { 3, + { 3, 1, + [](QSize s) { return 2*s.width()*s.height(); }, { QRhiTexture::R8, QRhiTexture::R8, QRhiTexture::R8 }, { { 1, 1 }, { 2, 1 }, { 2, 1 } } }, // Format_YV12 - { 3, + { 3, 1, + [](QSize s) { return 2*s.width()*s.height(); }, { QRhiTexture::R8, QRhiTexture::R8, QRhiTexture::R8 }, { { 1, 1 }, { 2, 2 }, { 2, 2 } } }, // Format_UYVY - { 1, + { 1, 2, + [](QSize s) { return 2*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 2, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_YUYV - { 1, + { 1, 2, + [](QSize s) { return 2*s.width()*s.height(); }, { QRhiTexture::BGRA8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 2, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_NV12 - { 2, + { 2, 1, + [](QSize s) { return 3*s.width()*s.height() / 2; }, { QRhiTexture::R8, QRhiTexture::RG8, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 2, 2 }, { 1, 1 } } }, // Format_NV21 - { 2, + { 2, 1, + [](QSize s) { return 3*s.width()*s.height() / 2; }, { QRhiTexture::R8, QRhiTexture::RG8, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 2, 2 }, { 1, 1 } } }, // Format_IMC1 - { 3, + { 3, 1, + [](QSize s) { + // IMC1 requires that U and V components are aligned on a multiple of 16 lines + return s.width()*((s.height()*3/2 + 15) & ~15 + s.height()/2); + }, { QRhiTexture::R8, QRhiTexture::R8, QRhiTexture::R8 }, { { 1, 1 }, { 2, 2 }, { 2, 2 } } }, // Format_IMC2 - { 2, + { 2, 1, + [](QSize s) { return 2*s.width()*s.height(); }, { QRhiTexture::R8, QRhiTexture::R8, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 2 }, { 1, 1 } } }, // Format_IMC3 - { 3, + { 3, 1, + [](QSize s) { + // IMC3 requires that U and V components are aligned on a multiple of 16 lines + return s.width()*((s.height()*3/2 + 15) & ~15 + s.height()/2); + }, { QRhiTexture::R8, QRhiTexture::R8, QRhiTexture::R8 }, { { 1, 1 }, { 2, 2 }, { 2, 2 } } }, // Format_IMC4 - { 2, + { 2, 1, + [](QSize s) { return 2*s.width()*s.height(); }, { QRhiTexture::R8, QRhiTexture::R8, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 2 }, { 1, 1 } } }, // Format_Y8 - { 1, + { 1, 1, + [](QSize s) { return s.width()*s.height(); }, { QRhiTexture::R8, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_Y16 - { 1, + { 1, 2, + [](QSize s) { return 2*s.width()*s.height(); }, { QRhiTexture::R16, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } }, // Format_P010 - { 2, + { 2, 2, + [](QSize s) { return 3*s.width()*s.height(); }, { QRhiTexture::R16, QRhiTexture::RG16, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 2, 2 }, { 1, 1 } } }, // Format_P016 - { 2, + { 2, 2, + [](QSize s) { return 3*s.width()*s.height(); }, { QRhiTexture::R16, QRhiTexture::RG16, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 2, 2 }, { 1, 1 } } }, // Format_Jpeg - { 1, + { 1, 0, + [](QSize) { return 0; }, { QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat, QRhiTexture::UnknownFormat }, { { 1, 1 }, { 1, 1 }, { 1, 1 } } } |