summaryrefslogtreecommitdiffstats
path: root/remoting/base/util.h
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-09 19:00:51 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-09 19:00:51 +0000
commitb3ca1f55f4a1f0dd84c72e99e60a971cebe33b1f (patch)
tree5602448fb7a33a0d19f570f49a7cba13a6275b7c /remoting/base/util.h
parentbe2394928af63719c56cd97fb2725ab4123e10ce (diff)
downloadchromium_src-b3ca1f55f4a1f0dd84c72e99e60a971cebe33b1f.zip
chromium_src-b3ca1f55f4a1f0dd84c72e99e60a971cebe33b1f.tar.gz
chromium_src-b3ca1f55f4a1f0dd84c72e99e60a971cebe33b1f.tar.bz2
Introducing helper wrappers for copying a rectangle from a one partial buffer to another. YUV to RGB and RGB to RGB operations are supported. YUV to RGB allows down-scaling of re
This CL also adds a supression for Valgrind which otherwise falsely complains about accessing uninitialized memory. See 113076 for details. BUG=109938,113076 TEST=remoting_unittests.Yuv2Rgb Review URL: http://codereview.chromium.org/9371002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121258 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base/util.h')
-rw-r--r--remoting/base/util.h43
1 files changed, 34 insertions, 9 deletions
diff --git a/remoting/base/util.h b/remoting/base/util.h
index c05ef2f..c4621cc 100644
--- a/remoting/base/util.h
+++ b/remoting/base/util.h
@@ -18,16 +18,33 @@ std::string GetTimestampString();
// TODO(sergeyu): Move these methods to media.
int GetBytesPerPixel(media::VideoFrame::Format format);
-// Convert YUV to RGB32 on a specific rectangle.
-void ConvertYUVToRGB32WithRect(const uint8* y_plane,
- const uint8* u_plane,
- const uint8* v_plane,
- uint8* rgb_plane,
- const SkIRect& rect,
- int y_stride,
- int uv_stride,
- int rgb_stride);
+// Convert and scale YUV to RGB32 on a specific rectangle. The source and
+// destination buffers are assumed to contain only |source_buffer_rect| and
+// |dest_buffer_rect| areas correspondingly. The scaling factor is determined
+// as ratio between |dest_size| and |source_size|. The target rectangle
+// |dect_rect| is specified in the destination coordinates.
+//
+// |source_buffer_rect| and |dest_buffer_rect| must fall entirely within
+// the source and destination dimensions, respectively. |dest_rect| must be
+// completely contained within the source and destinations buffers boundaries
+// including the case when scaling is requested.
+//
+// N.B. The top left corner coordinates of YUV buffer should have even X and Y
+// coordinates.
+void ConvertAndScaleYUVToRGB32Rect(const uint8* source_yplane,
+ const uint8* source_uplane,
+ const uint8* source_vplane,
+ int source_ystride,
+ int source_uvstride,
+ const SkISize& source_size,
+ const SkIRect& source_buffer_rect,
+ uint8* dest_buffer,
+ int dest_stride,
+ const SkISize& dest_size,
+ const SkIRect& dest_buffer_rect,
+ const SkIRect& dest_rect);
+// Convert RGB32 to YUV on a specific rectangle.
void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane,
uint8* y_plane,
uint8* u_plane,
@@ -60,6 +77,14 @@ void CopyRect(const uint8* src_plane,
int bytes_per_pixel,
const SkIRect& rect);
+void CopyRGB32Rect(const uint8* source_buffer,
+ int source_stride,
+ const SkIRect& source_buffer_rect,
+ uint8* dest_buffer,
+ int dest_stride,
+ const SkIRect& dest_buffer_rect,
+ const SkIRect& dest_rect);
+
} // namespace remoting
#endif // REMOTING_BASE_UTIL_H_