From d5bad0332828d3561dce549a6ad314450e2db252 Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Fri, 9 Aug 2013 14:02:39 -0700 Subject: [PATCH] Animated WebP: add "do no blend" option to spec Marking certain frames as "do not blend" helps avoiding alpha-blending at decode/render time. It also helps inserting I-frames (frames which can be independently decoded) into the animation. Change-Id: Iaa222805db88d2f1c81104ce9d882e7c7ff8cfdb --- NEWS | 1 + doc/webp-container-spec.txt | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 565ec09f..bc969cf7 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ time-to-first-decoded-pixel. * WebPIterator has a new member 'has_alpha' denoting whether the frame contains transparency. + * Container spec amended with new 'blending method' for animation. - 6/13/13: version 0.3.1 This is a binary compatible release. diff --git a/doc/webp-container-spec.txt b/doc/webp-container-spec.txt index c73db8f5..b1494d06 100644 --- a/doc/webp-container-spec.txt +++ b/doc/webp-container-spec.txt @@ -419,7 +419,7 @@ If the _Animation flag_ is not set, then this chunk SHOULD NOT be present. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ... | Frame Height Minus One | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Frame Duration | Reserved |D| + | Frame Duration | Reserved |B|D| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Frame Data | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -448,10 +448,24 @@ Frame Duration: 24 bits (_uint24_) In particular, frame duration of 0 is useful when one wants to update multiple areas of the canvas at once during the animation. -Reserved: 7 bits +Reserved: 6 bits : SHOULD be 0. +Blending method (B): 1 bit + +: Indicates how transparent pixels of _the current frame_ are to be blended with +corresponding pixels of the previous canvas: + + * `0`: Use alpha blending. After disposing of the previous frame, render the + current frame on the canvas using [alpha-blending](#alpha-blending). If the + current frame does not have an alpha channel, assume alpha value of 255, + effectively replacing the rectangle. + + * `1`: Do not blend. After disposing of the previous frame, render the + current frame on the canvas by overwriting the rectangle covered by the + current frame. + Disposal method (D): 1 bit : Indicates how _the current frame_ is to be treated after it has been displayed @@ -463,10 +477,6 @@ Disposal method (D): 1 bit by the _current frame_ with background color specified in the [ANIM chunk](#anim_chunk). -After disposing the current frame, render the next frame on the canvas using -[alpha-blending](#alpha-blending). If the next frame does not have an alpha -channel, assume alpha value of 255, effectively replacing the rectangle. - **Notes**: * The frame disposal only applies to the _frame rectangle_, that is, the