OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
Wez
2012/02/07 01:56:31
This changes in this and util.cc look to be ones I
| |
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_clip| and |dest_clip| |
23 const uint8* u_plane, | 23 // areas correspondingly. The scaling factor is determined as ratio between |
24 const uint8* v_plane, | 24 // |dest_size| and |source_size|. The target rectangle |dect_rect| is specified |
25 uint8* rgb_plane, | 25 // in the destination coordinates. |
26 const SkIRect& rect, | 26 // |
27 int y_stride, | 27 // The routine DCHECKs that clipping boundaries are completely contained within |
28 int uv_stride, | 28 // the corresponding images. It also DCHECKs that the source and target |
29 int rgb_stride); | 29 // rectangle fits the corresponding clipping areas. |
30 // | |
31 // N.B. The function requires the top left corner of |dect_rect| to have even | |
32 // X and Y coordinates. | |
33 void ConvertAndScaleYUVToRGB32Rect(const uint8* source_yplane, | |
34 const uint8* source_uplane, | |
35 const uint8* source_vplane, | |
36 int source_ystride, | |
37 int source_uvstride, | |
38 const SkISize& source_size, | |
39 const SkIRect& source_clip, | |
40 uint8* dest_buffer, | |
41 int dest_stride, | |
42 const SkISize& dest_size, | |
43 const SkIRect& dest_clip, | |
44 const SkIRect& dest_rect); | |
30 | 45 |
46 // Convert RGB32 to YUV on a specific rectangle. | |
31 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane, | 47 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane, |
32 uint8* y_plane, | 48 uint8* y_plane, |
33 uint8* u_plane, | 49 uint8* u_plane, |
34 uint8* v_plane, | 50 uint8* v_plane, |
35 int x, | 51 int x, |
36 int y, | 52 int y, |
37 int width, | 53 int width, |
38 int height, | 54 int height, |
39 int rgb_stride, | 55 int rgb_stride, |
40 int y_stride, | 56 int y_stride, |
(...skipping 12 matching lines...) Expand all Loading... | |
53 const SkISize& out_size); | 69 const SkISize& out_size); |
54 | 70 |
55 // Copy pixels in the rectangle from source to destination. | 71 // Copy pixels in the rectangle from source to destination. |
56 void CopyRect(const uint8* src_plane, | 72 void CopyRect(const uint8* src_plane, |
57 int src_plane_stride, | 73 int src_plane_stride, |
58 uint8* dest_plane, | 74 uint8* dest_plane, |
59 int dest_plane_stride, | 75 int dest_plane_stride, |
60 int bytes_per_pixel, | 76 int bytes_per_pixel, |
61 const SkIRect& rect); | 77 const SkIRect& rect); |
62 | 78 |
79 void CopyRGB32Rect(const uint8* source_buffer, | |
80 int source_stride, | |
81 const SkIRect& source_clip, | |
82 uint8* dest_buffer, | |
83 int dest_stride, | |
84 const SkIRect& dest_clip, | |
85 const SkIRect& dest_rect); | |
86 | |
63 } // namespace remoting | 87 } // namespace remoting |
64 | 88 |
65 #endif // REMOTING_BASE_UTIL_H_ | 89 #endif // REMOTING_BASE_UTIL_H_ |
OLD | NEW |