The results of the functions RenderWidgetHostView::CopyFromSurface and RenderWidgetHostView::CopyFromSurfaceToVideoFrame are impacted by the color space of the surface this is being copied from, but nowhere is the color space recorded or used.
This came up as a bug in issue 753320, where CopyFromSurface was used in the eyedropper color picker, and the result was affected by the output color space.
At the least, the callback from CopyFromSurface should report the backbuffer's color space (see the TODO in the fix for 753320).
Alternatively, both CopyFromSurface and CopyFromSurfaceToVideoFrame could take as arguments the expected output color space for the readback. This would involve more work.
The results of the functions RenderWidgetHostView::CopyFromSurface and RenderWidgetHostView::CopyFromSurfaceToVideoFrame are impacted by the color space of the surface this is being copied from, but nowhere is the color space recorded or used.
This came up as a bug in issue 756329 , where CopyFromSurface was used in the eyedropper color picker, and the result was affected by the output color space.
At the least, the callback from CopyFromSurface should report the backbuffer's color space (see the TODO in the fix for 753320).
Alternatively, both CopyFromSurface and CopyFromSurfaceToVideoFrame could take as arguments the expected output color space for the readback. This would involve more work.
My work on moving tab capture into VIZ is adding APIs/properties to pass color space information as well. The deeper issue, here, is what is happening in the GPU: The textures being copied are assumed to be in some RGB space (sRGB?) and mapped into BT.709. But, there is currently no code checking what the source RGB color space actually is, nor changing the color conversion matrix when the image format is changed to planar I420.
Blocking:884170 Summary: Screen capture (snapshot or video) needs to be color space aware, and do the right things. (was: RenderWidgetHostView::CopyFromSurface[ToVideoFrame] is color space unaware)
Status: Only remaining work on this is to clean-up the SetFormat() mojo API in viz::FrameSinkVideoCapturer. Meaning, remove color space from that because it is a better design to avoid color space conversion at all costs until the final display endpoint is reached (to avoid introducing excessive quantization and other rounding errors).
Comment 1 by ccameron@chromium.org
, Aug 23 2017