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

Skip to first unread message

zjup… via monorail

Jul 10, 2021, 4:32:59 AMJul 10
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 531 by some webp images downsample cause distortion and mosaic

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

Please provide any additional information below.

decode the image to 300*300, every thing is ok. libwebp usage in

relative issue:

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);
throwIllegalStateException(pEnv, "Failed to decode frame. VP8StatusCode: %d", ret);

Attachments: 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:

jz… via monorail

Jul 10, 2021, 8:26:49 PMJul 10

Comment #1 on issue 531 by some webp images downsample cause distortion and mosaic

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
0 new messages