Closed Bug 1904471 Opened 5 months ago Closed 4 months ago

Properly convert color space for display-p3

Categories

(Core :: Audio/Video: Web Codecs, task, P3)

task

Tracking

()

RESOLVED FIXED
130 Branch
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);
}
No longer blocks: 1904470
Depends on: 1902115
Summary: Support color conversion to display-p3 → Properly convert color space for display-p3

Depends on D215225

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

visual test page

Attachment #9410192 - Attachment description: WIP: Bug 1904471 - Convert SRGB data to Display-P3 if needed → Bug 1904471 - Convert SRGB data to Display-P3 if needed
Attachment #9410193 - Attachment description: WIP: Bug 1904471 - Implement ConvertSRGBBufferToDisplayP3 → Bug 1904471 - Implement ConvertSRGBBufferToDisplayP3
Attachment #9410194 - Attachment description: WIP: Bug 1904471 - Update WPT expectations → Bug 1904471 - Update WPT expectations
Pushed by cchang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ce2a296e14f2 Convert SRGB data to Display-P3 if needed r=media-playback-reviewers,padenot https://hg.mozilla.org/integration/autoland/rev/4f35ae92d26a Implement ConvertSRGBBufferToDisplayP3 r=media-playback-reviewers,padenot https://hg.mozilla.org/integration/autoland/rev/26bd15d06477 Update WPT expectations r=media-playback-reviewers,padenot
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: