Issue 531 in webp: some webp images downsample cause distortion and mosaic

9 views
Skip to first unread message

zjup… via monorail

unread,
Jul 10, 2021, 4:32:59 AMJul 10
to webp-d...@webmproject.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 531 by zjup...@gmail.com: some webp images downsample cause distortion and mosaic
https://bugs.chromium.org/p/webp/issues/detail?id=531

What steps will reproduce the problem?
1. a webp image at attachment with size 300*300
2. use libwebp to decode as 150*150 image, down sample size = 2
3. show the image/bitmap and it become distortion

What is the expected output? What do you see instead?
the image will show normal as 300*300 image.

What version of the product are you using? On what operating system?
1.2.0 version from https://github.com/webmproject/libwebp/tree/v1.2.0

Please provide any additional information below.

decode the image to 300*300, every thing is ok. libwebp usage in https://github.com/zjupure/GlideWebpDecoder/blob/master/webp_decoder/src/main/jni/webp.cpp#L540

relative issue: https://github.com/zjupure/GlideWebpDecoder/issues/83

usage code as follow, when config.options.use_scaling set to true and scaled_width/scale_height is smaller then original webp width/height

config.options.no_fancy_upsampling = 1;
if (width != spNativeWebPFrame->width || height != spNativeWebPFrame->height) {
config.options.use_scaling = true;
config.options.scaled_width = width;
config.options.scaled_height = height;
}

config.output.colorspace = MODE_rgbA;
config.output.is_external_memory = 1;
config.output.u.RGBA.rgba = pixels;
config.output.u.RGBA.stride = bitmapInfo.stride;
config.output.u.RGBA.size = bitmapInfo.stride * bitmapInfo.height;

ret = WebPDecode(pPayload, payloadSize, &config);
AndroidBitmap_unlockPixels(pEnv, bitmap);
if (ret != VP8_STATUS_OK) {
__android_log_print(ANDROID_LOG_WARN, "GLIDE_WEBP",
"Failed to decode frame, ret=%d", ret);
spNativeWebPFrame.reset();
throwIllegalStateException(pEnv, "Failed to decode frame. VP8StatusCode: %d", ret);

Attachments:
head.webp.zip 1.7 MB

--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

jz… via monorail

unread,
Jul 10, 2021, 8:26:49 PMJul 10
to webp-d...@webmproject.org

Comment #1 on issue 531 by jz...@google.com: some webp images downsample cause distortion and mosaic
https://bugs.chromium.org/p/webp/issues/detail?id=531#c1

Thanks for the report. There are a couple things that could be at play here. The first is that the offsets don't look like they're being updated to take into account the scaling. The second is that not every frame is 300x300 so you may get some additional skew or artifacts in those cases.
Reply all
Reply to author
Forward
0 new messages