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

Side by Side Diff: remoting/base/util.cc

Issue 261753013: Implement VP9/I444 encode support in the Chromoting host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix CreateVP9Codec bug and unit-test build. Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/base/util.h ('k') | remoting/base/util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "remoting/base/util.h" 5 #include "remoting/base/util.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 27 matching lines...) Expand all
38 int CalculateYOffset(int x, int y, int stride) { 38 int CalculateYOffset(int x, int y, int stride) {
39 DCHECK(((x & 1) == 0) && ((y & 1) == 0)); 39 DCHECK(((x & 1) == 0) && ((y & 1) == 0));
40 return stride * y + x; 40 return stride * y + x;
41 } 41 }
42 42
43 int CalculateUVOffset(int x, int y, int stride) { 43 int CalculateUVOffset(int x, int y, int stride) {
44 DCHECK(((x & 1) == 0) && ((y & 1) == 0)); 44 DCHECK(((x & 1) == 0) && ((y & 1) == 0));
45 return stride * y / 2 + x / 2; 45 return stride * y / 2 + x / 2;
46 } 46 }
47 47
48 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane,
49 uint8* y_plane,
50 uint8* u_plane,
51 uint8* v_plane,
52 int x,
53 int y,
54 int width,
55 int height,
56 int rgb_stride,
57 int y_stride,
58 int uv_stride) {
59 int rgb_offset = CalculateRGBOffset(x, y, rgb_stride);
60 int y_offset = CalculateYOffset(x, y, y_stride);
61 int uv_offset = CalculateUVOffset(x, y, uv_stride);;
62
63 libyuv::ARGBToI420(rgb_plane + rgb_offset, rgb_stride,
64 y_plane + y_offset, y_stride,
65 u_plane + uv_offset, uv_stride,
66 v_plane + uv_offset, uv_stride,
67 width, height);
68 }
69
70 void ConvertAndScaleYUVToRGB32Rect( 48 void ConvertAndScaleYUVToRGB32Rect(
71 const uint8* source_yplane, 49 const uint8* source_yplane,
72 const uint8* source_uplane, 50 const uint8* source_uplane,
73 const uint8* source_vplane, 51 const uint8* source_vplane,
74 int source_ystride, 52 int source_ystride,
75 int source_uvstride, 53 int source_uvstride,
76 const webrtc::DesktopSize& source_size, 54 const webrtc::DesktopSize& source_size,
77 const webrtc::DesktopRect& source_buffer_rect, 55 const webrtc::DesktopRect& source_buffer_rect,
78 uint8* dest_buffer, 56 uint8* dest_buffer,
79 int dest_stride, 57 int dest_stride,
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 286 }
309 287
310 bool DoesRectContain(const webrtc::DesktopRect& a, 288 bool DoesRectContain(const webrtc::DesktopRect& a,
311 const webrtc::DesktopRect& b) { 289 const webrtc::DesktopRect& b) {
312 webrtc::DesktopRect intersection(a); 290 webrtc::DesktopRect intersection(a);
313 intersection.IntersectWith(b); 291 intersection.IntersectWith(b);
314 return intersection.equals(b); 292 return intersection.equals(b);
315 } 293 }
316 294
317 } // namespace remoting 295 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/util.h ('k') | remoting/base/util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698