Issue 399 in webp: Webpmux -get frame n : Does not handle "Features present: animation transparency" properly

110 views
Skip to first unread message

honestab… via monorail

unread,
Sep 28, 2018, 2:13:59 AM9/28/18
to webp-d...@webmproject.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 399 by honestab...@gmail.com: Webpmux -get frame n : Does not handle "Features present: animation transparency" properly
https://bugs.chromium.org/p/webp/issues/detail?id=399

What steps will reproduce the problem?
1. call webpmux -get frame 2 input.webp -o output.webp
2. inspect output.webp in chrome or other webp compatible app to see the missing pixel

What is the expected output? What do you see instead?
Expected :
Receive the full size frame, in this case 320w 180h, without missing pixel data.

Current Results :
A smaller frame, 234w 247h, along with missing pixel data (blacked out sections of the output frame)

What version of the product are you using? On what operating system?
libwebp-1.0.0-windows-x86
Windows 10

Please provide any additional information below.

How I corrected the issue :
It appears to me that alpha is being used to store a binary mask for where pixel data should be copied from the previous frame.

currentframe = decodeframe()

if currentframe.has_alpha :
x_offset,y_offset,width,height = currentframe.bounds

# setup masks for copying new and previous frame data separately
mask = currentframe.getAlpha() # get only the A channel from the currentframe, the bit mask is 1 where new frame data is
n_mask = bitwise_not(currentframe.getAlpha()) # not the bitmask so we have a 1 where old frame data is

# get the missing frame data
missingFrameData = previousFrame.cropped(x_offset, y_offset, width, height)
missingFrameData = bitwise_and(missingFrameData, n_mask)

# zero out anywhere that isn't new frame data
rgb_currentFrame = currentFrame.rgb()
rgb_currentFrame = bitwise_and(rgb_currentFrame, mask)

#merge
compositeFrame = missingFrameData + rgb_currentFrame
fullFrame = previousFrame.setArea(compositeFrame, x_offset, y_offset, width, height)

previouseFrame = fullFrame
else :
...

The first decoded frame is output properly, ie webpmux -get frame 1 input.webp -o output.webp

Webp files with animations without "Features present: animation transparency" appear to output just fine.
It is in Webp files with the feature "animation transparency" enabled that the issues appear

Only frames encoding an alpha seem to be having issues.

Calling webpmux -info input.webp can be used to test if issue will occur

input.webp
Canvas size: 320 x 180
Features present: animation transparency
Background color : 0xFFFFFFFF Loop Count : 0
Number of frames: 24
...

Thanks for your time

Attachments:
input.webp 117 KB

--
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,
Sep 28, 2018, 3:13:53 AM9/28/18
to webp-d...@webmproject.org
Updates:
Labels: Needs-Feedback

Comment #1 on issue 399 by jz...@google.com: Webpmux -get frame n : Does not handle "Features present: animation transparency" properly
https://bugs.chromium.org/p/webp/issues/detail?id=399#c1

Thanks for the report. This sounds like it's working as expected. webpmux doesn't do full reconstruction of the frames, it will extract partial frames from the animation which may not be the same size as the canvas.

On the command line try the anim_dump utility. In code you'll want the WebPAnimDecoder [1].

[1] https://developers.google.com/speed/webp/docs/container-api#webpanimdecoder_api

honestab… via monorail

unread,
Sep 28, 2018, 11:48:56 AM9/28/18
to webp-d...@webmproject.org

Comment #2 on issue 399 by honest...@gmail.com: Webpmux -get frame n : Does not handle "Features present: animation transparency" properly
https://bugs.chromium.org/p/webp/issues/detail?id=399#c2

Thanks for the clarification. Both code and the dump utility work just fine :)

Thanks again for your time

jz… via monorail

unread,
Oct 1, 2018, 8:34:10 PM10/1/18
to webp-d...@webmproject.org
Updates:
Status: Invalid

Comment #3 on issue 399 by jz...@google.com: Webpmux -get frame n : Does not handle "Features present: animation transparency" properly
https://bugs.chromium.org/p/webp/issues/detail?id=399#c3

I'm glad it's working for you now. I'm going to close this bug for now, if you run into any new issues please feel free to file another one.
Reply all
Reply to author
Forward
0 new messages