Bug 1952603 Comment 3 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Hmm, for me, the video plays identically in Firefox and in Safari. Haven't checked Chrome yet. I'll hold off on taking the Bug until and unless I can reproduce it.

You can set the pref `gfx.core-animation.specialize-video.log` to true, and then launch Firefox from a Terminal command to see some additional logging when displaying a video.

When I set that pref, and load the video, I get this output:
```
2025-03-10 12:10:42.265 firefox[6243:7196493] VIDEO_LOG: LogSurface...
2025-03-10 12:10:42.265 firefox[6243:7196493] Surface values are {
    CreationProperties =     {
        IOSurfaceAllocSize = 1246144;
        IOSurfaceBytesPerElement = 1;
        IOSurfaceBytesPerRow = 2596;
        IOSurfaceElementHeight = 1;
        IOSurfaceElementWidth = 1;
        IOSurfaceHeight = 480;
        IOSurfaceIsGlobal = 1;
        IOSurfaceName = decode;
        IOSurfaceOffset = 0;
        IOSurfacePixelFormat = 2016686640;
        IOSurfacePixelSizeCastingAllowed = 1;
        IOSurfacePlaneInfo =         (
                        {
                IOSurfacePlaneBase = 512;
                IOSurfacePlaneBytesPerElement = 2;
                IOSurfacePlaneBytesPerRow = 1728;
                IOSurfacePlaneComponentBitDepths =                 (
                    10
                );
                IOSurfacePlaneComponentNames =                 (
                    5
                );
                IOSurfacePlaneComponentRanges =                 (
                    2
                );
                IOSurfacePlaneElementHeight = 1;
                IOSurfacePlaneElementWidth = 1;
                IOSurfacePlaneHeight = 480;
                IOSurfacePlaneOffset = 512;
                IOSurfacePlaneSize = 829440;
                IOSurfacePlaneWidth = 854;
            },
                        {
                IOSurfacePlaneBase = 829952;
                IOSurfacePlaneBytesPerElement = 4;
                IOSurfacePlaneBytesPerRow = 1728;
                IOSurfacePlaneComponentBitDepths =                 (
                    10,
                    10
                );
                IOSurfacePlaneComponentNames =                 (
                    7,
                    6
                );
                IOSurfacePlaneComponentRanges =                 (
                    2,
                    2
                );
                IOSurfacePlaneElementHeight = 1;
                IOSurfacePlaneElementWidth = 1;
                IOSurfacePlaneHeight = 240;
                IOSurfacePlaneOffset = 829952;
                IOSurfacePlaneSize = 414720;
                IOSurfacePlaneWidth = 427;
            }
        );
        IOSurfacePurgeWhenNotInUse = 1;
        IOSurfaceSubsampling = 3;
        IOSurfaceWidth = 854;
    };
    IOSurfaceChromaLocationBottomField = Left;
    IOSurfaceChromaLocationTopField = Left;
    IOSurfaceColorPrimaries = "ITU_R_2020";
    IOSurfaceColorSpace = kCGColorSpaceCoreMedia709;
    IOSurfaceColorSpaceID = 32;
    IOSurfaceName = decode;
    IOSurfaceTransferFunction = "SMPTE_ST_2084_PQ";
    IOSurfaceYCbCrMatrix = "ITU_R_2020";
    kIOSurfacePixelMetadata =     {
        kIOSurfaceLumaHistogramV1 = {length = 512, bytes = 0xfd0e0000 61050000 e5030000 7a030000 ... 00000000 00000000 };
        kIOSurfaceSessionCookie = 41519218688;
        kIOSurfaceSessionFrameNumber = 135;
    };
}.
2025-03-10 12:10:42.265 firefox[6243:7196493] ColorSpace is <CGColorSpace 0x125d18ac0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; HDTV).
2025-03-10 12:10:42.265 firefox[6243:7196493] Buffer attachments are {
    CGColorSpace = "<CGColorSpace 0x125d18ac0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; HDTV)";
    CVImageBufferChromaLocationBottomField = Left;
    CVImageBufferChromaLocationTopField = Left;
    CVImageBufferColorPrimaries = "ITU_R_2020";
    CVImageBufferTransferFunction = "SMPTE_ST_2084_PQ";
    CVImageBufferYCbCrMatrix = "ITU_R_2020";
}.
2025-03-10 12:10:42.265 firefox[6243:7196493] Codec is x420.
2025-03-10 12:10:42.265 firefox[6243:7196493] Format extensions are {
    CVBytesPerRow = 2596;
    CVImageBufferChromaLocationBottomField = Left;
    CVImageBufferChromaLocationTopField = Left;
    CVImageBufferColorPrimaries = "ITU_R_2020";
    CVImageBufferTransferFunction = "SMPTE_ST_2084_PQ";
    CVImageBufferYCbCrMatrix = "ITU_R_2020";
    Version = 2;
}.
```
That looks about right to me. Those color primaries, transfer function, and matrix look like values we should be handling correctly. The only strange bit is `  IOSurfaceColorSpace = kCGColorSpaceCoreMedia709;`. I would expect the colorspace to better match an HDR value, rather than the 709 value. I'll see if we're doing something strange there.
Hmm, for me, the video plays identically -- correctly -- in Firefox and in Safari. Haven't checked Chrome yet. I'll hold off on taking the Bug until and unless I can reproduce it.

You can set the pref `gfx.core-animation.specialize-video.log` to true, and then launch Firefox from a Terminal command to see some additional logging when displaying a video.

When I set that pref, and load the video, I get this output:
```
2025-03-10 12:10:42.265 firefox[6243:7196493] VIDEO_LOG: LogSurface...
2025-03-10 12:10:42.265 firefox[6243:7196493] Surface values are {
    CreationProperties =     {
        IOSurfaceAllocSize = 1246144;
        IOSurfaceBytesPerElement = 1;
        IOSurfaceBytesPerRow = 2596;
        IOSurfaceElementHeight = 1;
        IOSurfaceElementWidth = 1;
        IOSurfaceHeight = 480;
        IOSurfaceIsGlobal = 1;
        IOSurfaceName = decode;
        IOSurfaceOffset = 0;
        IOSurfacePixelFormat = 2016686640;
        IOSurfacePixelSizeCastingAllowed = 1;
        IOSurfacePlaneInfo =         (
                        {
                IOSurfacePlaneBase = 512;
                IOSurfacePlaneBytesPerElement = 2;
                IOSurfacePlaneBytesPerRow = 1728;
                IOSurfacePlaneComponentBitDepths =                 (
                    10
                );
                IOSurfacePlaneComponentNames =                 (
                    5
                );
                IOSurfacePlaneComponentRanges =                 (
                    2
                );
                IOSurfacePlaneElementHeight = 1;
                IOSurfacePlaneElementWidth = 1;
                IOSurfacePlaneHeight = 480;
                IOSurfacePlaneOffset = 512;
                IOSurfacePlaneSize = 829440;
                IOSurfacePlaneWidth = 854;
            },
                        {
                IOSurfacePlaneBase = 829952;
                IOSurfacePlaneBytesPerElement = 4;
                IOSurfacePlaneBytesPerRow = 1728;
                IOSurfacePlaneComponentBitDepths =                 (
                    10,
                    10
                );
                IOSurfacePlaneComponentNames =                 (
                    7,
                    6
                );
                IOSurfacePlaneComponentRanges =                 (
                    2,
                    2
                );
                IOSurfacePlaneElementHeight = 1;
                IOSurfacePlaneElementWidth = 1;
                IOSurfacePlaneHeight = 240;
                IOSurfacePlaneOffset = 829952;
                IOSurfacePlaneSize = 414720;
                IOSurfacePlaneWidth = 427;
            }
        );
        IOSurfacePurgeWhenNotInUse = 1;
        IOSurfaceSubsampling = 3;
        IOSurfaceWidth = 854;
    };
    IOSurfaceChromaLocationBottomField = Left;
    IOSurfaceChromaLocationTopField = Left;
    IOSurfaceColorPrimaries = "ITU_R_2020";
    IOSurfaceColorSpace = kCGColorSpaceCoreMedia709;
    IOSurfaceColorSpaceID = 32;
    IOSurfaceName = decode;
    IOSurfaceTransferFunction = "SMPTE_ST_2084_PQ";
    IOSurfaceYCbCrMatrix = "ITU_R_2020";
    kIOSurfacePixelMetadata =     {
        kIOSurfaceLumaHistogramV1 = {length = 512, bytes = 0xfd0e0000 61050000 e5030000 7a030000 ... 00000000 00000000 };
        kIOSurfaceSessionCookie = 41519218688;
        kIOSurfaceSessionFrameNumber = 135;
    };
}.
2025-03-10 12:10:42.265 firefox[6243:7196493] ColorSpace is <CGColorSpace 0x125d18ac0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; HDTV).
2025-03-10 12:10:42.265 firefox[6243:7196493] Buffer attachments are {
    CGColorSpace = "<CGColorSpace 0x125d18ac0> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; HDTV)";
    CVImageBufferChromaLocationBottomField = Left;
    CVImageBufferChromaLocationTopField = Left;
    CVImageBufferColorPrimaries = "ITU_R_2020";
    CVImageBufferTransferFunction = "SMPTE_ST_2084_PQ";
    CVImageBufferYCbCrMatrix = "ITU_R_2020";
}.
2025-03-10 12:10:42.265 firefox[6243:7196493] Codec is x420.
2025-03-10 12:10:42.265 firefox[6243:7196493] Format extensions are {
    CVBytesPerRow = 2596;
    CVImageBufferChromaLocationBottomField = Left;
    CVImageBufferChromaLocationTopField = Left;
    CVImageBufferColorPrimaries = "ITU_R_2020";
    CVImageBufferTransferFunction = "SMPTE_ST_2084_PQ";
    CVImageBufferYCbCrMatrix = "ITU_R_2020";
    Version = 2;
}.
```
That looks about right to me. Those color primaries, transfer function, and matrix look like values we should be handling correctly. The only strange bit is `  IOSurfaceColorSpace = kCGColorSpaceCoreMedia709;`. I would expect the colorspace to better match an HDR value, rather than the 709 value. I'll see if we're doing something strange there.

Back to Bug 1952603 Comment 3