RESOLVED WONTFIX 49719
Qt should handle unmultiplied RGBA pixel arrays
https://bugs.webkit.org/show_bug.cgi?id=49719
Summary Qt should handle unmultiplied RGBA pixel arrays
Zoltan Herczeg
Reported 2010-11-18 01:57:53 PST
This is just a quick patch. Let Qt decide when it needs a unmultiplied / multiplied conversion, and do it in an effective way.
Attachments
patch (6.90 KB, patch)
2010-11-18 02:03 PST, Zoltan Herczeg
benjamin: review-
Zoltan Herczeg
Comment 1 2010-11-18 02:03:29 PST
Andreas Kling
Comment 2 2010-11-18 02:13:20 PST
Comment on attachment 74217 [details] patch The reason we're not doing this is because when using the "raster" graphics system, convertToFormat(ARGB32_PM) is a no-op. With that in mind, combining the RGB<->BGR and premultiplication into a single pass over the image is faster than anything Qt can do. This patch will regress performance, so is there any other reason to do this besides code cleanliness?
Zoltan Herczeg
Comment 3 2010-11-18 02:16:24 PST
I thought Qt may have an optimized assembly routine to convert the data, this is surprising. And what about non-raster modes?
Benjamin Poulain
Comment 4 2010-11-18 02:23:42 PST
Comment on attachment 74217 [details] patch This patch basically revert all the optimizations done recently by Andreas. You can add a ABGR format to QImage to optimize this further.
Balazs Kelemen
Comment 5 2010-11-18 02:35:40 PST
(In reply to comment #3) > I thought Qt may have an optimized assembly routine to convert the data, this is surprising. And what about non-raster modes? I think Qt has this for RGB -> RGB_PM, but not for RGB -> BGR_PM what we need there.
Benjamin Poulain
Comment 6 2010-11-18 02:48:23 PST
(In reply to comment #5) > I think Qt has this for RGB -> RGB_PM, but not for RGB -> BGR_PM what we need > there. That is why Andreas made those changes. CPU cache is more important than raw CPU power for those kind of basic conversion. By doing it at once instead of in two passes, you gain a lot of performance. To go further, you could implement this one pass conversion with SIMD, this should ideally be done in QtGui.
Benjamin Poulain
Comment 7 2010-11-19 06:59:00 PST
Closing the bug, we can reopen if you come with a better implementation.
Balazs Kelemen
Comment 8 2010-11-19 10:26:36 PST
As I heard from Zoltan the one pass approach hurts performance in SVG when you usually need the unmultiplied data, but this should be explained by him :)
Note You need to log in before you can comment on or make changes to this bug.