cxt / webp

Automatically exported from code.google.com/p/webp
0 stars 0 forks source link

libwebp decodes incorrectly to 565 #257

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I do not know how to reproduce this in dwebp, but I see it in Skia - see 
https://code.google.com/p/skia/issues/detail?id=4174. From that issue:

(check out Skia - https://skia.org/user/download)
What steps will reproduce the problem?
1. From Skia checkout: ./gyp_skia && ninja -C out/Debug dm
2. dm --src image --images 5.sm.webp --config 565 -w <out_dir>
3. Look at <out_dir>/565/image/decode/5.sm.webp.png

What is the expected output? What do you see instead?
I expect it to look like the original, but the colors are wrong (see 
5.sm-565-output.png)

Additional info:
Skia's code for using libwebp is here: 
https://skia.googlesource.com/skia/+/master/src/images/SkImageDecoder_libwebp.cp
p

In it, we set the WEBP_CSP_MODE to MODE_RGB_565 when the user requests 565 (on 
line 190)

Original issue reported on code.google.com by scro...@google.com on 6 Aug 2015 at 1:39

Attachments:

GoogleCodeExporter commented 8 years ago
Also, we are using libwebp version 0.4.3

Original comment by scro...@google.com on 6 Aug 2015 at 1:44

GoogleCodeExporter commented 8 years ago
I'm wondering if this is as simple as byte order being reversed. Can you try 
defining "WEBP_SWAP_16BIT_CSP" and see if you get correct output? [See line#58 
here: https://chromium.googlesource.com/webm/libwebp/+/master/makefile.unix]

Also:
- On which platform did you observe this issue?
- Does RGBA4444 mode work correctly, and colors look wrong on that too?

Original comment by urv...@chromium.org on 6 Aug 2015 at 4:07

GoogleCodeExporter commented 8 years ago
Yes, defining WEBP_SWAP_16BIT_CSP fixes the problem, so it sounds like this is 
a user error. I'll update Skia.

(FWIW, I am running on Ubuntu. I have not tried RGBA4444.)

Original comment by scro...@google.com on 6 Aug 2015 at 5:45

GoogleCodeExporter commented 8 years ago
Alright. Once you define WEBP_SWAP_16BIT_CSP, RGBA4444 should be correct as 
well.
Also, you should make sure that this works correctly on other platforms too -- 
especially Android.

Closing for now. Pls reopen if you still face issues.

Original comment by urv...@google.com on 6 Aug 2015 at 5:49

GoogleCodeExporter commented 8 years ago
Yeah, it is necessary on Android as well. (WEBP_SWAP_16BIT_CSP is defined in 
the Android makefile already. Whew!)

Original comment by scro...@google.com on 6 Aug 2015 at 6:25