Commit 45c6a9b6 authored by Miguel Casas-Sanchez's avatar Miguel Casas-Sanchez Committed by Commit Bot

GpuMemoryBufferVideoFramePool: correct color space correction

crrev.com/c/882081 landed a correction of the incoming VideoFrame
colorspace [1,2], to have a MatrixID::RGB matrix. This was (and is)
not needed and wrong, because we might lose container color space
information, and in reality what we want is to tell VideoResourceUpdater
to manipulate this resource as RGB, so this CL corrects this situation.

[1] https://cs.chromium.org/chromium/src/media/video/gpu_memory_buffer_video_frame_pool.cc?sq=package:chromium&dr=CSs&l=451
[2] https://cs.chromium.org/chromium/src/media/video/gpu_memory_buffer_video_frame_pool.cc?sq=package:chromium&dr=CSs&l=462

Bug: 797347
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: I3f22fdc82395ece5181cb2ce198ed2c838cf49a7
Reviewed-on: https://chromium-review.googlesource.com/885041Reviewed-by: default avatarccameron <ccameron@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531946}
parent 538bdbcc
...@@ -876,8 +876,12 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( ...@@ -876,8 +876,12 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
<< media::VideoPixelFormatToString(video_frame->format()); << media::VideoPixelFormatToString(video_frame->format());
return external_resources; return external_resources;
} }
if (external_resources.type == VideoFrameExternalResources::RGB_RESOURCE) if (external_resources.type == VideoFrameExternalResources::RGB_RESOURCE ||
external_resources.type == VideoFrameExternalResources::RGBA_RESOURCE ||
external_resources.type ==
VideoFrameExternalResources::RGBA_PREMULTIPLIED_RESOURCE) {
resource_color_space = resource_color_space.GetAsFullRangeRGB(); resource_color_space = resource_color_space.GetAsFullRangeRGB();
}
const size_t num_textures = video_frame->NumTextures(); const size_t num_textures = video_frame->NumTextures();
for (size_t i = 0; i < num_textures; ++i) { for (size_t i = 0; i < num_textures; ++i) {
......
...@@ -442,16 +442,11 @@ void CopyRowsToXR30Buffer(int first_row, ...@@ -442,16 +442,11 @@ void CopyRowsToXR30Buffer(int first_row,
const size_t u_plane_stride = source_frame->stride(VideoFrame::kUPlane) / 2; const size_t u_plane_stride = source_frame->stride(VideoFrame::kUPlane) / 2;
uint8_t* dest_ar30 = output + first_row * dest_stride; uint8_t* dest_ar30 = output + first_row * dest_stride;
// RGB textures need RGB as MatrixID.
switch (color_space) { switch (color_space) {
case COLOR_SPACE_HD_REC709: case COLOR_SPACE_HD_REC709:
libyuv::H010ToAR30(y_plane, y_plane_stride, v_plane, v_plane_stride, libyuv::H010ToAR30(y_plane, y_plane_stride, v_plane, v_plane_stride,
u_plane, u_plane_stride, dest_ar30, dest_stride, u_plane, u_plane_stride, dest_ar30, dest_stride,
width, rows); width, rows);
source_frame->set_color_space(gfx::ColorSpace(
gfx::ColorSpace::PrimaryID::BT709,
gfx::ColorSpace::TransferID::BT709, gfx::ColorSpace::MatrixID::RGB,
gfx::ColorSpace::RangeID::LIMITED));
break; break;
case COLOR_SPACE_UNSPECIFIED: case COLOR_SPACE_UNSPECIFIED:
case COLOR_SPACE_JPEG: case COLOR_SPACE_JPEG:
...@@ -459,10 +454,6 @@ void CopyRowsToXR30Buffer(int first_row, ...@@ -459,10 +454,6 @@ void CopyRowsToXR30Buffer(int first_row,
libyuv::I010ToAR30(y_plane, y_plane_stride, v_plane, v_plane_stride, libyuv::I010ToAR30(y_plane, y_plane_stride, v_plane, v_plane_stride,
u_plane, u_plane_stride, dest_ar30, dest_stride, u_plane, u_plane_stride, dest_ar30, dest_stride,
width, rows); width, rows);
source_frame->set_color_space(gfx::ColorSpace(
gfx::ColorSpace::PrimaryID::SMPTE170M,
gfx::ColorSpace::TransferID::SMPTE170M,
gfx::ColorSpace::MatrixID::RGB, gfx::ColorSpace::RangeID::LIMITED));
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment