Issue 548 in webp: Different values from WebPAnimDecoderGetNext on big endian?

61 views
Skip to first unread message

radar… via monorail

unread,
Dec 22, 2021, 2:28:57 AM12/22/21
to webp-d...@webmproject.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 548 by radar...@gmail.com: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548

Is it possible that WebPAnimDecoderGetNext is returning different values based on endianness?

What steps will reproduce the problem?

My output can be seen at https://github.com/radarhere/Pillow/runs/4603882840, where https://github.com/radarhere/Pillow/tree/demo is run in different environments.
However, the interaction with webp on that branch is in https://github.com/radarhere/Pillow/blob/dbc9a5269d9740c1e26eaf467b8f867764bbca05/src/_webp.c#L11-L29. I would hope that this highlighted code is independent enough for you to replicate without worrying about my surrounding Python code. Let me know if it is not.
The webp file that is written out as `webp[]` is https://raw.githubusercontent.com/radarhere/Pillow/demo/Tests/test.webp

What is the expected output? What do you see instead?

Running that highlighted code in 4 little endian environments and 1 big endian environment, I expected the same output. Instead, big endian returns 254 while little endian returns 255.

What version of the product are you using? On what operating system?

libwebp 1.2.1. The aberrant behaviour is happening on a Ubuntu 20.04 Docker image using QEMU to perform s390x operations.

Please provide any additional information below.

Thanks for any help you can give.

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

pasca… via monorail

unread,
Dec 22, 2021, 10:13:37 AM12/22/21
to webp-d...@webmproject.org

Comment #1 on issue 548 by pasca...@gmail.com: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548#c1

Hi,

did you check that there are actually at least two frames in the bitstream?
You should check that WebPAnimDecoderHasMoreFrames(dec) before calling WebPAnimDecoderGetNext().

jz… via monorail

unread,
Dec 22, 2021, 1:16:32 PM12/22/21
to webp-d...@webmproject.org

Comment #2 on issue 548 by jz...@google.com: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548#c2

WebPAnimDecoderGetNext() should return false if there are no more frames, otherwise that would be a bug.

jz… via monorail

unread,
Dec 22, 2021, 2:50:44 PM12/22/21
to webp-d...@webmproject.org
Updates:
Owner: jz...@google.com
Status: Accepted

Comment #3 on issue 548 by jz...@google.com: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548#c3

Canvas size: 82 x 82
Features present: animation transparency
Background color : 0xFFFFFFFF Loop Count : 0
Number of frames: 2
No.: width height alpha x_offset y_offset duration dispose blend image_size compression
1: 82 82 no 0 0 0 none no 3170 lossless
2: 82 48 yes 0 32 0 none yes 2132 lossless

I can reproduce the problem with the sample. The individual frames extracted with webpmux decode the same, but the output from anim_dump (and in the sample) differs, so it may have something to do with the blending. I noticed webpinfo is broken for big-endian too, I've got a fix for that.

Git Watcher via monorail

unread,
Dec 22, 2021, 8:01:51 PM12/22/21
to webp-d...@webmproject.org

Comment #4 on issue 548 by Git Watcher: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548#c4

The following revision refers to this bug:
https://chromium.googlesource.com/webm/libwebp/+/e3cb052ca5172e02641e8211ab1701bfa20d4c7d

commit e3cb052ca5172e02641e8211ab1701bfa20d4c7d
Author: James Zern <jz...@google.com>
Date: Wed Dec 22 21:42:50 2021

webpinfo: fix fourcc comparison w/big-endian

store the recognized fourccs in little-endian order to match how the
fourcc is being read from the file

Bug: webp:548
Change-Id: I9de77db92208709d5e711846908a51e563102fa5

[modify] https://crrev.com/e3cb052ca5172e02641e8211ab1701bfa20d4c7d/examples/webpinfo.c

Git Watcher via monorail

unread,
Dec 22, 2021, 9:37:12 PM12/22/21
to webp-d...@webmproject.org

Comment #5 on issue 548 by Git Watcher: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548#c5


The following revision refers to this bug:
https://chromium.googlesource.com/webm/libwebp/+/e4886716d3bde3cc67e74ad956e5bd50112cd8f0

commit e4886716d3bde3cc67e74ad956e5bd50112cd8f0
Author: James Zern <jz...@google.com>
Date: Wed Dec 22 21:46:21 2021

anim_decode: fix alpha blending with big-endian

images are decoded in RGBA/BGRA, but represented as uint32_t during the
blend process; this fixes the channel extraction

Bug: webp:548
Change-Id: Ie74aa43d8f87d3552d5afc0abba466335f5d1617

[modify] https://crrev.com/e4886716d3bde3cc67e74ad956e5bd50112cd8f0/src/demux/anim_decode.c

jz… via monorail

unread,
Dec 23, 2021, 9:47:42 AM12/23/21
to webp-d...@webmproject.org
Updates:
Labels: v1.2.2

Comment #6 on issue 548 by jz...@google.com: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548#c6

This should be working correctly now. Thanks again for the report and if you run into any other issues please let us know.

Git Watcher via monorail

unread,
Jan 10, 2022, 9:02:07 PM1/10/22
to webp-d...@webmproject.org
Updates:
Labels: merge-merged-1.2.2

Comment #7 on issue 548 by Git Watcher: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548#c7


The following revision refers to this bug:

Author: James Zern <jz...@google.com>
Date: Wed Dec 22 21:46:21 2021

anim_decode: fix alpha blending with big-endian

images are decoded in RGBA/BGRA, but represented as uint32_t during the
blend process; this fixes the channel extraction

Bug: webp:548
Change-Id: Ie74aa43d8f87d3552d5afc0abba466335f5d1617
(cherry picked from commit e4886716d3bde3cc67e74ad956e5bd50112cd8f0)

[modify] https://crrev.com/f084244d9f8156055521517e60e87036a74634b2/src/demux/anim_decode.c

Git Watcher via monorail

unread,
Jan 10, 2022, 9:02:09 PM1/10/22
to webp-d...@webmproject.org

Comment #8 on issue 548 by Git Watcher: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548#c8


The following revision refers to this bug:

Date: Wed Dec 22 21:42:50 2021

webpinfo: fix fourcc comparison w/big-endian

store the recognized fourccs in little-endian order to match how the
fourcc is being read from the file

Bug: webp:548
Change-Id: I9de77db92208709d5e711846908a51e563102fa5
(cherry picked from commit e3cb052ca5172e02641e8211ab1701bfa20d4c7d)

[modify] https://crrev.com/b217b4fff7196888f7f79663bb35d6d331cb575b/examples/webpinfo.c

jz… via monorail

unread,
Jan 11, 2022, 9:43:49 PM1/11/22
to webp-d...@webmproject.org
Updates:
Status: Fixed

Comment #9 on issue 548 by jz...@google.com: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548#c9

(No comment was entered for this change.)

radar… via monorail

unread,
Jan 23, 2022, 4:07:52 PM1/23/22
to webp-d...@webmproject.org

Comment #10 on issue 548 by radar...@gmail.com: Different values from WebPAnimDecoderGetNext on big endian?
https://bugs.chromium.org/p/webp/issues/detail?id=548#c10

Thanks very much for the fix!
Reply all
Reply to author
Forward
0 new messages