Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9378948f645655b1eb35f0058adc14aecd566d32
      
https://github.com/WebKit/WebKit/commit/9378948f645655b1eb35f0058adc14aecd566d32
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-09-13 (Sun, 13 Sep 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/cv/CVUtilities.mm
    M Tools/TestWebKitAPI/Tests/WebCore/cocoa/ImageRotationSessionVT.cpp

  Log Message:
  -----------
  createBlackPixelBuffer produces super-black instead of legal black for 
video-range buffers
https://bugs.webkit.org/show_bug.cgi?id=324081
rdar://187309125

Reviewed by Jean-Yves Avenard.

createBlackPixelBuffer() zeroed the Y (luma) plane unconditionally for
both supported formats. That is correct for kCVPixelFormatType_420YpCbCr8-
BiPlanarFullRange, where black is Y=0, but wrong for the video-range
format kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange, whose legal luma
range is 16-235 and whose black is the luma floor Y=16. Writing Y=0 there
produces "super-black" / footroom below the legal floor. Video range is
the default format on macOS (preferedPixelBufferFormat()), so black frames
generated on macOS were out of range. The chroma fill (UV=128) was already
correct for both formats.

Fill the luma plane with the format-appropriate black: 16 for video range,
0 for full range.

Test: Tools/TestWebKitAPI/Tests/WebCore/cocoa/ImageRotationSessionVT.cpp

* Source/WebCore/platform/graphics/cv/CVUtilities.mm:
(WebCore::createBlackPixelBuffer): Select the luma value based on the
pixel format instead of always zeroing the Y plane.

* Tools/TestWebKitAPI/Tests/WebCore/cocoa/ImageRotationSessionVT.cpp:
(TestWebKitAPI::TEST(CVUtilities, CreateBlackPixelBuffer)): Verify the Y
plane matches the buffer's legal black for its actual pixel format and
that chroma is neutral (128).

Canonical link: https://commits.webkit.org/321040@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to