diff options
author | Artem Dyomin <artem.dyomin@qt.io> | 2024-01-09 16:47:10 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-01-12 12:14:53 +0000 |
commit | ce71734b05be582f91e90fa459e81f92f4539a39 (patch) | |
tree | 2588623bb85f28bcb002859f9c071ca2c75af026 /src | |
parent | d24853e091f904739e89c7025dc3c8594142c07c (diff) |
Fix conversion of premultiplied rgb formats to ffmpeg formats
FFmpeg doesn't have premultiplied rgb formats, it has
0RGB formats, were alpha component is undefined.
In premultiplied components r/g/b components are ready to use,
alpha component is supposed to be multiplied with the background.
In the light of the above, QtMM premultiplied formats
match better 0RGB ffmpeg formats (at least, color components
are proper)
Pick-to: 6.6 6.5
Change-Id: I6b2810117c7b9d002d7032f905be57962b29e6c5
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 1708bfc413e968683ae2e1d532562ee4e6f29a1b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp b/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp index e1bd93537..f6317dd83 100644 --- a/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp +++ b/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp @@ -324,13 +324,13 @@ AVPixelFormat QFFmpegVideoBuffer::toAVPixelFormat(QVideoFrameFormat::PixelFormat // We're using the data from the converted QImage here, which is in BGRA. return AV_PIX_FMT_BGRA; case QVideoFrameFormat::Format_ARGB8888: - case QVideoFrameFormat::Format_ARGB8888_Premultiplied: return AV_PIX_FMT_ARGB; + case QVideoFrameFormat::Format_ARGB8888_Premultiplied: case QVideoFrameFormat::Format_XRGB8888: return AV_PIX_FMT_0RGB; case QVideoFrameFormat::Format_BGRA8888: - case QVideoFrameFormat::Format_BGRA8888_Premultiplied: return AV_PIX_FMT_BGRA; + case QVideoFrameFormat::Format_BGRA8888_Premultiplied: case QVideoFrameFormat::Format_BGRX8888: return AV_PIX_FMT_BGR0; case QVideoFrameFormat::Format_ABGR8888: @@ -339,6 +339,8 @@ AVPixelFormat QFFmpegVideoBuffer::toAVPixelFormat(QVideoFrameFormat::PixelFormat return AV_PIX_FMT_0BGR; case QVideoFrameFormat::Format_RGBA8888: return AV_PIX_FMT_RGBA; + // to be added in 6.8: + // case QVideoFrameFormat::Format_RGBA8888_Premultiplied: case QVideoFrameFormat::Format_RGBX8888: return AV_PIX_FMT_RGB0; |