| Index: cc/resources/video_resource_updater.cc
|
| diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc
|
| index 8d608bd6d6122961e09862fc9663d2962a2dd5e4..d8fbd44d4f91329f19702974a815bacbcfcaa26d 100644
|
| --- a/cc/resources/video_resource_updater.cc
|
| +++ b/cc/resources/video_resource_updater.cc
|
| @@ -67,6 +67,9 @@ VideoFrameExternalResources::ResourceType ResourceTypeForVideoFrame(
|
| break;
|
| }
|
| break;
|
| + case media::PIXEL_FORMAT_Y16:
|
| + return VideoFrameExternalResources::Y16_RESOURCE;
|
| + break;
|
| case media::PIXEL_FORMAT_YV12:
|
| case media::PIXEL_FORMAT_YV16:
|
| case media::PIXEL_FORMAT_YV24:
|
| @@ -281,18 +284,29 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
|
| case media::PIXEL_FORMAT_YUV444P10:
|
| bits_per_channel = 10;
|
| break;
|
| + case media::PIXEL_FORMAT_Y16:
|
| + bits_per_channel = 16;
|
| + break;
|
| }
|
|
|
| - // Only YUV software video frames are supported.
|
| - if (!media::IsYuvPlanar(input_frame_format)) {
|
| + // Only YUV and Y16 software video frames are supported.
|
| + const bool isYuvPlanar = media::IsYuvPlanar(input_frame_format);
|
| + if (!(isYuvPlanar || input_frame_format == media::PIXEL_FORMAT_Y16)) {
|
| NOTREACHED() << media::VideoPixelFormatToString(input_frame_format);
|
| return VideoFrameExternalResources();
|
| }
|
|
|
| const bool software_compositor = context_provider_ == NULL;
|
|
|
| - ResourceFormat output_resource_format =
|
| - resource_provider_->YuvResourceFormat(bits_per_channel);
|
| + if (input_frame_format == media::PIXEL_FORMAT_Y16 && software_compositor) {
|
| + // TODO(astojilj) Y16 software compositor support.
|
| + NOTREACHED() << "Software compositor is not supporting PIXEL_FORMAT_Y16";
|
| + return VideoFrameExternalResources();
|
| + }
|
| +
|
| + ResourceFormat output_resource_format = isYuvPlanar
|
| + ? resource_provider_->YuvResourceFormat(bits_per_channel)
|
| + : resource_provider_->Y16ResourceFormat(bits_per_channel);
|
|
|
| size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format);
|
|
|
| @@ -435,6 +449,8 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
|
| // Note that the current method of converting integers to half-floats
|
| // stops working if you have more than 10 bits of data.
|
| DCHECK_LE(bits_per_channel, 10);
|
| + } else if (plane_resource.resource_format() == RG_88) {
|
| + DCHECK_EQ(bits_per_channel, 16);
|
| } else if (bits_per_channel > 8) {
|
| // If bits_per_channel > 8 and we can't use LUMINANCE_F16, we need to
|
| // shift the data down and create an 8-bit texture.
|
| @@ -446,6 +462,13 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
|
| !needs_conversion) {
|
| pixels = video_frame->data(i);
|
| } else {
|
| + if (!isYuvPlanar) {
|
| + for (ResourceList::iterator resource_it : plane_resources)
|
| + resource_it->remove_ref();
|
| + NOTREACHED() << "Conversion not supported for :"
|
| + << media::VideoPixelFormatToString(input_frame_format);
|
| + return VideoFrameExternalResources();
|
| + }
|
| // Avoid malloc for each frame/plane if possible.
|
| size_t needed_size =
|
| upload_image_stride * resource_size_pixels.height();
|
| @@ -491,6 +514,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
|
| }
|
|
|
| if (plane_resource.resource_format() == LUMINANCE_F16) {
|
| + DCHECK(isYuvPlanar);
|
| // By OR-ing with 0x3800, 10-bit numbers become half-floats in the
|
| // range [0.5..1) and 9-bit numbers get the range [0.5..0.75).
|
| //
|
| @@ -521,7 +545,9 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
|
| &RecycleResource, AsWeakPtr(), plane_resource.resource_id()));
|
| }
|
|
|
| - external_resources.type = VideoFrameExternalResources::YUV_RESOURCE;
|
| + external_resources.type = (input_frame_format == media::PIXEL_FORMAT_Y16)
|
| + ? VideoFrameExternalResources::Y16_RESOURCE
|
| + : VideoFrameExternalResources::YUV_RESOURCE;
|
| return external_resources;
|
| }
|
|
|
|
|