RESOLVED FIXED 93430
incorrect transparent WebP image rendering
https://bugs.webkit.org/show_bug.cgi?id=93430
Summary incorrect transparent WebP image rendering
Pascal Massimino
Reported 2012-08-07 20:44:00 PDT
Hi, this is mostly a heads up for now. The best way to fix is still open and debated. Summary: * libwebp tree was updated in chromium to 0.2.0 with alpha support: http://codereview.chromium.org/10832153/ * WEBPImageDecoder.cpp now needs an update to correct handle compressed image with alpha we're setting "buffer.setHasAlpha(false);" always, at line 122 Rendering of webp-with-alpha is 'weird', as if values rgb values were not pre-multiplied. * But even when setting "setHasAlpha(true)" (when there's alpha channel only), we need to address the pre-multiplication of rgb values (cf m_premultiplyAlpha and line 79). * libwebp can now emit premultiplied values, using MODE_bgrA instead of MODE_BGRA as outputMode() i'll poke around the code further and try to get a patch, but any insight from Noel or others is welcome!
Attachments
example webp file (13.75 KB, image/webp)
2012-08-07 21:28 PDT, Pascal Massimino
no flags
expected decoded result (13.72 KB, image/png)
2012-08-07 21:42 PDT, Pascal Massimino
no flags
badly decoded result (19.91 KB, image/png)
2012-08-07 21:45 PDT, Pascal Massimino
no flags
Patch (4.62 KB, patch)
2012-08-09 09:56 PDT, Pascal Massimino
no flags
Patch (4.56 KB, patch)
2012-08-09 10:59 PDT, Pascal Massimino
no flags
Patch (8.83 KB, patch)
2012-08-10 01:59 PDT, Pascal Massimino
no flags
Archive of layout-test-results from gce-cr-linux-06 (308.59 KB, application/zip)
2012-08-10 02:40 PDT, WebKit Review Bot
no flags
Patch (8.83 KB, patch)
2012-08-16 14:18 PDT, Pascal Massimino
no flags
Pascal Massimino
Comment 1 2012-08-07 21:28:35 PDT
Created attachment 157103 [details] example webp file Lossless-coded original WebP file.
Pascal Massimino
Comment 2 2012-08-07 21:42:27 PDT
Created attachment 157106 [details] expected decoded result expected decoded result (decoded with 'dwebp' tool)
Pascal Massimino
Comment 3 2012-08-07 21:45:53 PDT
Created attachment 157108 [details] badly decoded result screen capture from chrome 22.0.1229.0 dev Looks like rgb values are not alpha-multiplied
Pascal Massimino
Comment 4 2012-08-09 09:56:56 PDT
Adam Barth
Comment 5 2012-08-09 10:53:49 PDT
Comment on attachment 157474 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=157474&action=review > Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp:59 > + , m_decoder(0), m_hasAlpha(false) This should be split on two lines.
Pascal Massimino
Comment 6 2012-08-09 10:59:39 PDT
Pascal Massimino
Comment 7 2012-08-10 01:59:47 PDT
Pascal Massimino
Comment 8 2012-08-10 02:00:47 PDT
New patch with Layout test update and new files for decoding tests
WebKit Review Bot
Comment 9 2012-08-10 02:40:50 PDT
Comment on attachment 157678 [details] Patch Attachment 157678 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13462770 New failing tests: fast/images/webp-image-decoding.html
WebKit Review Bot
Comment 10 2012-08-10 02:40:54 PDT
Created attachment 157692 [details] Archive of layout-test-results from gce-cr-linux-06 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-06 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Pascal Massimino
Comment 11 2012-08-10 03:00:55 PDT
chromium-ews was unable to decode the new images and displayed the broken-image icon instead (with size 20x20 instead of expected 64x64). I'm not sure why the decoding is broken...
jzern
Comment 12 2012-08-10 12:19:42 PDT
(In reply to comment #11) > chromium-ews was unable to decode the new images and displayed the broken-image icon instead (with size 20x20 instead of expected 64x64). I'm not sure why the decoding is broken... This same behavior will be seen if the resources (test2.webp, test3.webp) are missing. This works in a local build for me, not sure if it has something to do with how the chromium build applies the patch and whether those files are missing there, though. Is there a more detailed build log that shows the patch being applied?
noel gordon
Comment 13 2012-08-15 01:58:02 PDT
(In reply to comment #12) Needed a chromium DEPS roll.
noel gordon
Comment 14 2012-08-15 02:01:55 PDT
(In reply to comment #0) > i'll poke around the code further and try to get a patch, but any insight from Noel or others is welcome! Noted this part ... > * But even when setting "setHasAlpha(true)" (when there's alpha channel only), we need to > address the pre-multiplication of rgb values (cf m_premultiplyAlpha and line 79). and wondered if you intend to handle m_premultiplyAlpha for the alpha supporting formats? If so, file a bug about it and move on with this patch which otherwise looks fine to me.
Pascal Massimino
Comment 15 2012-08-16 14:18:31 PDT
Pascal Massimino
Comment 16 2012-08-16 15:24:00 PDT
(In reply to comment #15) > Created an attachment (id=158901) [details] > Patch re-uploaded the patch. It's likely that the updated DEPS will make the chrome-ews test pass this time.
noel gordon
Comment 17 2012-08-17 00:56:39 PDT
(In reply to comment #14) > (In reply to comment #0) > > > i'll poke around the code further and try to get a patch, but any insight from Noel or others is welcome! > > Noted this part ... > > > * But even when setting "setHasAlpha(true)" (when there's alpha channel only), we need to > > address the pre-multiplication of rgb values (cf m_premultiplyAlpha and line 79). > > and wondered if you intend to handle m_premultiplyAlpha for the alpha supporting formats? If so, file a bug about it and move on with this patch which otherwise looks fine to me. I should mention that browsers (moz, webkit, chrome) in general want a decoded row callback. This to control the decoded frame buffer color correction, alpha pre-multiplication (m_premultiplyAlpha = true|false), and the numerical stability when the frame buffer is used with other web content (the <canvas> element in particular). Perhaps a row callback is planned for a future version of libwebp.
WebKit Review Bot
Comment 18 2012-08-17 01:53:08 PDT
Comment on attachment 158901 [details] Patch Clearing flags on attachment: 158901 Committed r125869: <http://trac.webkit.org/changeset/125869>
WebKit Review Bot
Comment 19 2012-08-17 01:53:13 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.