Properly convert color space for display-p3
Categories
(Core :: Audio/Video: Web Codecs, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox130 | --- | fixed |
People
(Reporter: chunmin, Assigned: chunmin)
References
(Blocks 1 open bug)
Details
Attachments
(4 files)
Investigate how to properly convert color for display-p3
in videoFrame-copyTo-rgb.any.js. The R, G, B ,A values converted in Gecko implemented in bug 1902115 is different from the values in Chrome. The conversion can probably be implemented via skia's APIs.
This is a visual test page that can help to compare the values between Firefox and Chrome. The online demo is here, which might be updated from times to times.
update: Here is an example of the conversion. I'll try this and submit the patch if it works.
void ConvertSRGBBufferToDisplayP3(uint8_t* srcBuffer, int width, int height, uint8_t* dstBuffer) {
auto srcColorSpace = SkColorSpace::MakeSRGB();
SkImageInfo srcInfo = SkImageInfo::Make(width, height, kRGBA_8888_SkColorType, kUnpremul_SkAlphaType, srcColorSpace);
SkBitmap srcBitmap;
srcBitmap.installPixels(srcInfo, srcBuffer, width * 4);
auto dstColorSpace = SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, SkNamedGamut::kDisplayP3);
SkBitmap dstBitmap;
dstBitmap.allocPixels(srcInfo.makeColorSpace(dstColorSpace));
srcBitmap.readPixels(dstBitmap.pixmap());
memcpy(dstBuffer, dstBitmap.getPixels(), width * height * 4);
}
Assignee | ||
Updated•5 months ago
|
Assignee | ||
Comment 1•5 months ago
|
||
Assignee | ||
Comment 2•5 months ago
|
||
Depends on D215225
Assignee | ||
Comment 3•5 months ago
|
||
The display-p3 color comparision failures are due to bug 1770258.
Currently, canvas's getImageData is unable to provide data in required
color space.
Depends on D215226
Assignee | ||
Comment 4•5 months ago
|
||
visual test page
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Comment 6•4 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ce2a296e14f2
https://hg.mozilla.org/mozilla-central/rev/4f35ae92d26a
https://hg.mozilla.org/mozilla-central/rev/26bd15d06477
Description
•