[wpt-sync] Sync PR 62475 - Avoid precision loss when encoding linear float16 canvases
Categories
(Core :: Graphics: Canvas2D, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 62475 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/62475
Details from upstream follow.
Christopher Cameron <ccameron@google.com> wrote:
Avoid precision loss when encoding linear float16 canvases
When encoding images from a linear float16 canvas (using toBlob,
toDataURL, or convertToBlob), converting directly to 8-bit linear
integers produces quantization artifacts at dark values (e.g. an
sRGB-value gradient with 256 stops will only produce 183 unique output
values).Add ImageEncoderUtils::GetColorInfoForEncoder to select an
appropriate non-linear encoding color space (sRGB transfer function)
when serializing linear float16 canvases, and ensure premultiplied alpha
is converted to unpremultiplied alpha upfront. Include a gfx::HDRMetadata
parameter which we can use, in the future, to select between sRGB and PQ.Apply this conversion in CanvasAsyncBlobCreator and ImageDataBuffer's
StaticBitmapImage constructor. Log a warning in ImageDataBuffer(SkPixmap)
if callers higher in the stack have not already performed any necessary
conversion.Add WPT tests for toBlob, toDataURL, and convertToBlob with both JPEG
and PNG formats across HTMLCanvasElement and OffscreenCanvas.TAG=agy
CONV=6afb9a4e-b9e1-4c5a-9273-c80de68abad8Bug: 454152417
Change-Id: Ifb6a25195e0cb39c80cabf00fab2ee39f6db8fcf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8342747
Reviewed-by: Florin Malita \<fmalita@chromium.org>
Commit-Queue: ccameron chromium \<ccameron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1692722}
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 1•2 months ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/#/jobs?repo=try&revision=b6789e069a8960c0384eaf8ad3be3c051296a7f0
| Assignee | ||
Comment 2•2 months ago
|
||
CI Results
Ran 4 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 24 tests and 2 subtests
Status Summary
Firefox
OK : 4[GitHub] 24[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 8
FAIL: 12[GitHub] 24[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
Chrome
OK : 4
FAIL: 12
Safari
OK : 4
FAIL: 12
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
New Tests That Don't Pass
- /html/canvas/element/wide-gamut-canvas/2d.color.space.display-p3-linear.html [wpt.fyi]
- test getImageData color conversion with a display-p3-linear uint8 canvas:
FAIL
- test getImageData color conversion with a display-p3-linear uint8 canvas:
- /html/canvas/element/wide-gamut-canvas/2d.color.space.p3.fillText.html [wpt.fyi]
- Test if fillText can be used with a solid display-p3 color:
FAIL
- Test if fillText can be used with a solid display-p3 color:
- /html/canvas/element/wide-gamut-canvas/2d.color.space.p3.fillText.shadow.html [wpt.fyi]
- Test if fillText can be used with a display-p3 shadow color:
FAIL
- Test if fillText can be used with a display-p3 shadow color:
- /html/canvas/element/wide-gamut-canvas/2d.color.space.p3.strokeText.html [wpt.fyi]
- Test if strokeText can be used with a solid display-p3 color:
FAIL
- Test if strokeText can be used with a solid display-p3 color:
- /html/canvas/element/wide-gamut-canvas/2d.color.space.p3.to.p3.html [wpt.fyi]
- test getImageData with display-p3 and uint8 from display p3 uint8 canvas:
FAIL
- test getImageData with display-p3 and uint8 from display p3 uint8 canvas:
- /html/canvas/element/wide-gamut-canvas/2d.color.space.srgb-linear.html [wpt.fyi]
- test getImageData color conversion with a srgb-linear uint8 canvas:
FAIL
- test getImageData color conversion with a srgb-linear uint8 canvas:
- /html/canvas/element/wide-gamut-canvas/2d.color.space.toBlob.toDataURL.jpeg.linear.float.html [wpt.fyi]
- Test toBlob creates a jpeg image using an appropriate encoding to not lose precision from a srgb-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL) - Test toBlob creates a jpeg image using an appropriate encoding to not lose precision from a display-p3-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL) - Test toDataURL creates a jpeg image using an appropriate encoding to not lose precision from a srgb-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL) - Test toDataURL creates a jpeg image using an appropriate encoding to not lose precision from a display-p3-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL)
- Test toBlob creates a jpeg image using an appropriate encoding to not lose precision from a srgb-linear float16 canvas:
- /html/canvas/element/wide-gamut-canvas/2d.color.space.toBlob.toDataURL.png.linear.float.html [wpt.fyi]
- Test toBlob creates a png image using an appropriate encoding to not lose precision from a srgb-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL) - Test toBlob creates a png image using an appropriate encoding to not lose precision from a display-p3-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL) - Test toDataURL creates a png image using an appropriate encoding to not lose precision from a srgb-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL) - Test toDataURL creates a png image using an appropriate encoding to not lose precision from a display-p3-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL)
- Test toBlob creates a png image using an appropriate encoding to not lose precision from a srgb-linear float16 canvas:
- /html/canvas/offscreen/wide-gamut-canvas/2d.color.space.display-p3-linear.html [wpt.fyi]
- test getImageData color conversion with a display-p3-linear uint8 canvas:
FAIL
- test getImageData color conversion with a display-p3-linear uint8 canvas:
- /html/canvas/offscreen/wide-gamut-canvas/2d.color.space.display-p3-linear.worker.html [wpt.fyi]
- test getImageData color conversion with a display-p3-linear uint8 canvas:
FAIL
- test getImageData color conversion with a display-p3-linear uint8 canvas:
- /html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.html [wpt.fyi]
- test getImageData with display-p3 and uint8 from display p3 uint8 canvas:
FAIL
- test getImageData with display-p3 and uint8 from display p3 uint8 canvas:
- /html/canvas/offscreen/wide-gamut-canvas/2d.color.space.p3.to.p3.worker.html [wpt.fyi]
- test getImageData with display-p3 and uint8 from display p3 uint8 canvas:
FAIL
- test getImageData with display-p3 and uint8 from display p3 uint8 canvas:
- /html/canvas/offscreen/wide-gamut-canvas/2d.color.space.srgb-linear.html [wpt.fyi]
- test getImageData color conversion with a srgb-linear uint8 canvas:
FAIL
- test getImageData color conversion with a srgb-linear uint8 canvas:
- /html/canvas/offscreen/wide-gamut-canvas/2d.color.space.srgb-linear.worker.html [wpt.fyi]
- test getImageData color conversion with a srgb-linear uint8 canvas:
FAIL
- test getImageData color conversion with a srgb-linear uint8 canvas:
- /html/canvas/offscreen/wide-gamut-canvas/2d.color.space.toBlob.toDataURL.jpeg.linear.float.html [wpt.fyi]
- Test convertToBlob creates a jpeg image using an appropriate encoding to not lose precision from a srgb-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL) - Test convertToBlob creates a jpeg image using an appropriate encoding to not lose precision from a display-p3-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL)
- Test convertToBlob creates a jpeg image using an appropriate encoding to not lose precision from a srgb-linear float16 canvas:
- /html/canvas/offscreen/wide-gamut-canvas/2d.color.space.toBlob.toDataURL.png.linear.float.html [wpt.fyi]
- Test convertToBlob creates a png image using an appropriate encoding to not lose precision from a srgb-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL) - Test convertToBlob creates a png image using an appropriate encoding to not lose precision from a display-p3-linear float16 canvas:
FAIL(Chrome:FAIL, Safari:FAIL)
- Test convertToBlob creates a png image using an appropriate encoding to not lose precision from a srgb-linear float16 canvas:
Comment 4•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/2c31783f3a6b
https://hg.mozilla.org/mozilla-central/rev/114bcb9adcee
Description
•