| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_BASE_UTIL_H_ | 5 #ifndef REMOTING_BASE_UTIL_H_ |
| 6 #define REMOTING_BASE_UTIL_H_ | 6 #define REMOTING_BASE_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| 11 #include "third_party/skia/include/core/SkRect.h" | 11 #include "third_party/skia/include/core/SkRect.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 | 14 |
| 15 // Return a string that contains the current date formatted as 'MMDD/HHMMSS:'. | 15 // Return a string that contains the current date formatted as 'MMDD/HHMMSS:'. |
| 16 std::string GetTimestampString(); | 16 std::string GetTimestampString(); |
| 17 | 17 |
| 18 // TODO(sergeyu): Move these methods to media. | 18 // TODO(sergeyu): Move these methods to media. |
| 19 int GetBytesPerPixel(media::VideoFrame::Format format); | 19 int GetBytesPerPixel(media::VideoFrame::Format format); |
| 20 | 20 |
| 21 // Convert YUV to RGB32 on a specific rectangle. | 21 // Convert and scale YUV to RGB32 on a specific rectangle. The source and |
| 22 void ConvertYUVToRGB32WithRect(const uint8* y_plane, | 22 // destination buffers are assumed to contain only |source_buffer_rect| and |
| 23 const uint8* u_plane, | 23 // |dest_buffer_rect| areas correspondingly. The scaling factor is determined |
| 24 const uint8* v_plane, | 24 // as ratio between |dest_size| and |source_size|. The target rectangle |
| 25 uint8* rgb_plane, | 25 // |dect_rect| is specified in the destination coordinates. |
| 26 const SkIRect& rect, | 26 // |
| 27 int y_stride, | 27 // |source_buffer_rect| and |dest_buffer_rect| must fall entirely within |
| 28 int uv_stride, | 28 // the source and destination dimensions, respectively. |dest_rect| must be |
| 29 int rgb_stride); | 29 // completely contained within the source and destinations buffers boundaries |
| 30 // including the case when scaling is requested. |
| 31 // |
| 32 // N.B. The top left corner coordinates of YUV buffer should have even X and Y |
| 33 // coordinates. |
| 34 void ConvertAndScaleYUVToRGB32Rect(const uint8* source_yplane, |
| 35 const uint8* source_uplane, |
| 36 const uint8* source_vplane, |
| 37 int source_ystride, |
| 38 int source_uvstride, |
| 39 const SkISize& source_size, |
| 40 const SkIRect& source_buffer_rect, |
| 41 uint8* dest_buffer, |
| 42 int dest_stride, |
| 43 const SkISize& dest_size, |
| 44 const SkIRect& dest_buffer_rect, |
| 45 const SkIRect& dest_rect); |
| 30 | 46 |
| 47 // Convert RGB32 to YUV on a specific rectangle. |
| 31 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane, | 48 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane, |
| 32 uint8* y_plane, | 49 uint8* y_plane, |
| 33 uint8* u_plane, | 50 uint8* u_plane, |
| 34 uint8* v_plane, | 51 uint8* v_plane, |
| 35 int x, | 52 int x, |
| 36 int y, | 53 int y, |
| 37 int width, | 54 int width, |
| 38 int height, | 55 int height, |
| 39 int rgb_stride, | 56 int rgb_stride, |
| 40 int y_stride, | 57 int y_stride, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 53 const SkISize& out_size); | 70 const SkISize& out_size); |
| 54 | 71 |
| 55 // Copy pixels in the rectangle from source to destination. | 72 // Copy pixels in the rectangle from source to destination. |
| 56 void CopyRect(const uint8* src_plane, | 73 void CopyRect(const uint8* src_plane, |
| 57 int src_plane_stride, | 74 int src_plane_stride, |
| 58 uint8* dest_plane, | 75 uint8* dest_plane, |
| 59 int dest_plane_stride, | 76 int dest_plane_stride, |
| 60 int bytes_per_pixel, | 77 int bytes_per_pixel, |
| 61 const SkIRect& rect); | 78 const SkIRect& rect); |
| 62 | 79 |
| 80 void CopyRGB32Rect(const uint8* source_buffer, |
| 81 int source_stride, |
| 82 const SkIRect& source_buffer_rect, |
| 83 uint8* dest_buffer, |
| 84 int dest_stride, |
| 85 const SkIRect& dest_buffer_rect, |
| 86 const SkIRect& dest_rect); |
| 87 |
| 63 } // namespace remoting | 88 } // namespace remoting |
| 64 | 89 |
| 65 #endif // REMOTING_BASE_UTIL_H_ | 90 #endif // REMOTING_BASE_UTIL_H_ |
| OLD | NEW |