Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9698)

Unified Diff: cc/resources/video_resource_updater.cc

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 8 bpp support added. R200 camera supported. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..6eab1c18922eef979445da234e0f64661ccf19b5 100644
--- a/cc/resources/video_resource_updater.cc
+++ b/cc/resources/video_resource_updater.cc
@@ -67,6 +67,10 @@ VideoFrameExternalResources::ResourceType ResourceTypeForVideoFrame(
break;
}
break;
+ case media::PIXEL_FORMAT_Y8:
+ case media::PIXEL_FORMAT_Y16:
+ return VideoFrameExternalResources::Y_RESOURCE;
+ break;
case media::PIXEL_FORMAT_YV12:
case media::PIXEL_FORMAT_YV16:
case media::PIXEL_FORMAT_YV24:
@@ -269,6 +273,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
case media::PIXEL_FORMAT_RGB32:
case media::PIXEL_FORMAT_MJPEG:
case media::PIXEL_FORMAT_MT21:
+ case media::PIXEL_FORMAT_Y8:
bits_per_channel = 8;
break;
case media::PIXEL_FORMAT_YUV420P9:
@@ -281,18 +286,33 @@ 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, Y8 and Y16 software video frames are supported.
+ const bool isYuvPlanar = media::IsYuvPlanar(input_frame_format);
+ if (!(isYuvPlanar || input_frame_format == media::PIXEL_FORMAT_Y16 ||
+ input_frame_format == media::PIXEL_FORMAT_Y8)) {
NOTREACHED() << media::VideoPixelFormatToString(input_frame_format);
return VideoFrameExternalResources();
}
const bool software_compositor = context_provider_ == NULL;
+ if ((input_frame_format == media::PIXEL_FORMAT_Y8 ||
+ input_frame_format == media::PIXEL_FORMAT_Y16) &&
+ software_compositor) {
+ // TODO(astojilj) Y8 and Y16 software compositor support.
+ NOTREACHED() << "Software compositor doesn't support PIXEL_FORMAT_Y8/Y16";
+ return VideoFrameExternalResources();
+ }
+
ResourceFormat output_resource_format =
- resource_provider_->YuvResourceFormat(bits_per_channel);
+ (input_frame_format == media::PIXEL_FORMAT_Y16)
+ ? resource_provider_->Y16ResourceFormat(bits_per_channel)
+ : resource_provider_->YuvResourceFormat(bits_per_channel);
size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format);
@@ -435,6 +455,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.
@@ -491,6 +513,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 +544,10 @@ 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 ||
+ input_frame_format == media::PIXEL_FORMAT_Y8)
+ ? VideoFrameExternalResources::Y_RESOURCE
+ : VideoFrameExternalResources::YUV_RESOURCE;
return external_resources;
}

Powered by Google App Engine
This is Rietveld 408576698