Merge "webp-container-spec: clarify background clear on loop"

This commit is contained in:
pascal massimino 2015-02-05 14:44:27 -08:00 committed by Gerrit Code Review
commit 4b9fa5d0e2

View File

@ -378,6 +378,9 @@ color is also used when disposal method is `1`.
* Viewer applications SHOULD treat the background color value as a hint, and * Viewer applications SHOULD treat the background color value as a hint, and
are not required to use it. are not required to use it.
* The canvas is cleared at the start of each loop. The background color MAY be
used to achieve this.
Loop Count: 16 bits (_uint16_) Loop Count: 16 bits (_uint16_)
: The number of times to loop the animation. `0` means infinitely. : The number of times to loop the animation. `0` means infinitely.
@ -719,33 +722,37 @@ pseudocode:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
assert VP8X.flags.hasAnimation assert VP8X.flags.hasAnimation
canvas ← new image of size VP8X.canvasWidth x VP8X.canvasHeight with canvas ← new image of size VP8X.canvasWidth x VP8X.canvasHeight with
background color ANIM.background_color. background color ANIM.background_color.
loop_count ← ANIM.loopCount loop_count ← ANIM.loopCount
dispose_method ← ANIM.disposeMethod dispose_method ← ANIM.disposeMethod
if loop_count == 0: if loop_count == 0:
loop_count = ∞ loop_count = ∞
frame_params ← nil frame_params ← nil
for loop = 0, ..., loop_count - 1 assert next chunk in image_data is ANMF
assert next chunk in image_data is ANMF for loop = 0..loop_count - 1
frame_params.frameX = Frame X clear canvas to ANIM.background_color or application defined color
frame_params.frameY = Frame Y until eof or non-ANMF chunk
frame_params.frameWidth = Frame Width Minus One + 1 frame_params.frameX = Frame X
frame_params.frameHeight = Frame Height Minus One + 1 frame_params.frameY = Frame Y
frame_params.frameDuration = Frame Duration frame_params.frameWidth = Frame Width Minus One + 1
assert VP8X.canvasWidth >= frame_params.frameX + frame_params.frameWidth frame_params.frameHeight = Frame Height Minus One + 1
assert VP8X.canvasHeight >= frame_params.frameY + frame_params.frameHeight frame_params.frameDuration = Frame Duration
for subchunk in 'Frame Data': frame_right = frame_params.frameX + frame_params.frameWidth
if subchunk.tag == "ALPH": frame_bottom = frame_params.frameY + frame_params.frameHeight
assert alpha subchunks not found in 'Frame Data' earlier assert VP8X.canvasWidth >= frame_right
frame_params.alpha = alpha_data assert VP8X.canvasHeight >= frame_bottom
else if subchunk.tag == "VP8 " OR subchunk.tag == "VP8L": for subchunk in 'Frame Data':
assert bitstream subchunks not found in 'Frame Data' earlier if subchunk.tag == "ALPH":
frame_params.bitstream = bitstream_data assert alpha subchunks not found in 'Frame Data' earlier
render frame with frame_params.alpha and frame_params.bitstream on canvas frame_params.alpha = alpha_data
with top-left corner in (frame_params.frameX, frame_params.frameY), using else if subchunk.tag == "VP8 " OR subchunk.tag == "VP8L":
dispose method dispose_method. assert bitstream subchunks not found in 'Frame Data' earlier
Show the contents of the image for frame_params.frameDuration * 1ms. frame_params.bitstream = bitstream_data
canvas contains the decoded canvas. render frame with frame_params.alpha and frame_params.bitstream on
canvas with top-left corner at (frame_params.frameX,
frame_params.frameY), using dispose method dispose_method.
canvas contains the decoded image.
Show the contents of the canvas for frame_params.frameDuration * 1ms.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Example file layouts Example file layouts