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

Unified Diff: media/renderers/skcanvas_video_renderer.h

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: rebase Created 4 years, 2 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
« no previous file with comments | « media/renderers/mock_gpu_video_accelerator_factories.h ('k') | media/renderers/skcanvas_video_renderer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/skcanvas_video_renderer.h
diff --git a/media/renderers/skcanvas_video_renderer.h b/media/renderers/skcanvas_video_renderer.h
index 9323a82fed4d55c8160707d809c5fb6030186d33..2b25edbc0a3e24a6301c7cd641f75c1dafeb49db 100644
--- a/media/renderers/skcanvas_video_renderer.h
+++ b/media/renderers/skcanvas_video_renderer.h
@@ -23,7 +23,6 @@
#include "third_party/skia/include/core/SkXfermode.h"
class SkCanvas;
-class SkImage;
namespace gfx {
class RectF;
@@ -93,6 +92,29 @@ class MEDIA_EXPORT SkCanvasVideoRenderer {
bool premultiply_alpha,
bool flip_y);
+ // Method handles reinterpreting two components RG8 as 16 bit value for Y16
+ // format and optimizing upload-to-texture for some video frame and texture
+ // formats. If needed, there is a conversion followed by a tex(Sub)Image2D or
+ // tex(Sub)Image3D call.
+ // |format|, |internal_format|, |type| specify target texture |texture|.
+ // |xoffset|, |yoffset|, |zoffset| are used when functionID defines sub image
+ // calls.
+ // Returns false if there is no implementation for given parameters or if the
+ // call fails.
+ static bool TexImageImpl(const char* functionID,
+ unsigned target,
+ gpu::gles2::GLES2Interface* gl,
+ VideoFrame* video_frame,
+ int level,
+ int internalformat,
+ unsigned format,
+ unsigned type,
+ int xoffset,
+ int yoffset,
+ int zoffset,
+ bool flipY,
+ bool premultiplyAlpha);
+
// In general, We hold the most recently painted frame to increase the
// performance for the case that the same frame needs to be painted
// repeatedly. Call this function if you are sure the most recent frame will
@@ -110,6 +132,32 @@ class MEDIA_EXPORT SkCanvasVideoRenderer {
bool UpdateLastImage(const scoped_refptr<VideoFrame>& video_frame,
const Context3D& context_3d);
+ // Reinterpret the content of RG8 texture as R16 (normalized value) to float
+ // intermediate texture and then copy to texture. All the available RGB color
+ // components in the texture get the same value.
+ // Reinterpretting texture happens on canvas gl (context_3d) to enable caching
+ // resources for following calls. Target |texture| should live on |target_gl|
+ // after the call.
+ void CopyRG8ToTexture(const Context3D& context_3d,
+ gpu::gles2::GLES2Interface* target_gl,
+ VideoFrame* video_frame,
+ unsigned texture,
+ unsigned internal_format,
+ unsigned type,
+ bool flip_y);
+
+ // Helper method used by CopyRG8ToTexture. Target used for both
+ // |source_texture| and |target_texture| is GL_TEXTURE_2D.
+ void DoCopyRG8ToTexture(const Context3D& context_3d,
+ unsigned source_texture,
+ unsigned target_texture,
+ unsigned format,
+ unsigned internal_format,
+ unsigned type,
+ unsigned width,
+ unsigned height,
+ bool flip_y);
+
// Last image used to draw to the canvas.
sk_sp<SkImage> last_image_;
// Timestamp of the videoframe used to generate |last_image_|.
@@ -119,6 +167,13 @@ class MEDIA_EXPORT SkCanvasVideoRenderer {
// Used for DCHECKs to ensure method calls executed in the correct thread.
base::ThreadChecker thread_checker_;
+ // Resources rg8_to_texture_* are used for RG8 to float texture GPU
+ // conversion.
+ unsigned rg8_to_texture_program_ = 0;
+ unsigned rg8_to_texture_vertices_buffer_ = 0;
+ // Used for cached GL resources (e.g. rg8_to_texture_program) lifecycle
+ // management.
+ unsigned cached_gl_resources_gr_context_id_ = 0;
// Used for unit test.
SkISize last_image_dimensions_for_testing_;
« no previous file with comments | « media/renderers/mock_gpu_video_accelerator_factories.h ('k') | media/renderers/skcanvas_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698