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

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

Issue 9138050: Merge 117748 - Linear sub-rectangle scaler for use in Chromoting. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/963/src/
Patch Set: Created 8 years, 11 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') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 v_plane + uv_offset, 70 v_plane + uv_offset,
71 rgb_plane + rgb_offset, 71 rgb_plane + rgb_offset,
72 rect.width(), 72 rect.width(),
73 rect.height(), 73 rect.height(),
74 y_stride, 74 y_stride,
75 uv_stride, 75 uv_stride,
76 rgb_stride, 76 rgb_stride,
77 media::YV12); 77 media::YV12);
78 } 78 }
79 79
80 void ScaleYUVToRGB32WithRect(const uint8* y_plane,
81 const uint8* u_plane,
82 const uint8* v_plane,
83 uint8* rgb_plane,
84 const SkIRect& source_rect,
85 const SkIRect& dest_rect,
86 int y_stride,
87 int uv_stride,
88 int rgb_stride) {
89 int rgb_offset = CalculateRGBOffset(dest_rect.fLeft,
90 dest_rect.fTop,
91 rgb_stride);
92 int y_offset = CalculateYOffset(source_rect.fLeft,
93 source_rect.fTop,
94 y_stride);
95 int uv_offset = CalculateUVOffset(source_rect.fLeft,
96 source_rect.fTop,
97 uv_stride);
98
99 media::ScaleYUVToRGB32(y_plane + y_offset,
100 u_plane + uv_offset,
101 v_plane + uv_offset,
102 rgb_plane + rgb_offset,
103 source_rect.width(),
104 source_rect.height(),
105 dest_rect.width(),
106 dest_rect.height(),
107 y_stride,
108 uv_stride,
109 rgb_stride,
110 media::YV12,
111 media::ROTATE_0,
112 media::FILTER_NONE);
113 }
114
115 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane, 80 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane,
116 uint8* y_plane, 81 uint8* y_plane,
117 uint8* u_plane, 82 uint8* u_plane,
118 uint8* v_plane, 83 uint8* v_plane,
119 int x, 84 int x,
120 int y, 85 int y,
121 int width, 86 int width,
122 int height, 87 int height,
123 int rgb_stride, 88 int rgb_stride,
124 int y_stride, 89 int y_stride,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const int bytes_per_line = bytes_per_pixel * rect.width(); 142 const int bytes_per_line = bytes_per_pixel * rect.width();
178 const int height = rect.height(); 143 const int height = rect.height();
179 for (int i = 0 ; i < height; ++i) { 144 for (int i = 0 ; i < height; ++i) {
180 memcpy(dest_plane, src_plane, bytes_per_line); 145 memcpy(dest_plane, src_plane, bytes_per_line);
181 src_plane += src_plane_stride; 146 src_plane += src_plane_stride;
182 dest_plane += dest_plane_stride; 147 dest_plane += dest_plane_stride;
183 } 148 }
184 } 149 }
185 150
186 } // namespace remoting 151 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698