| 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 #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 12 matching lines...) Expand all Loading... |
| 23 // our LOG message handler. Bad things will happen. | 23 // our LOG message handler. Bad things will happen. |
| 24 std::string GetTimestampString() { | 24 std::string GetTimestampString() { |
| 25 base::Time t = base::Time::NowFromSystemTime(); | 25 base::Time t = base::Time::NowFromSystemTime(); |
| 26 base::Time::Exploded tex; | 26 base::Time::Exploded tex; |
| 27 t.LocalExplode(&tex); | 27 t.LocalExplode(&tex); |
| 28 return StringPrintf("%02d%02d/%02d%02d%02d:", | 28 return StringPrintf("%02d%02d/%02d%02d%02d:", |
| 29 tex.month, tex.day_of_month, | 29 tex.month, tex.day_of_month, |
| 30 tex.hour, tex.minute, tex.second); | 30 tex.hour, tex.minute, tex.second); |
| 31 } | 31 } |
| 32 | 32 |
| 33 // Helper methods to calculate plane offset given the coordinates. | 33 int CalculateRGBOffset(int x, int y, int stride) { |
| 34 static int CalculateRGBOffset(int x, int y, int stride) { | |
| 35 return stride * y + kBytesPerPixelRGB32 * x; | 34 return stride * y + kBytesPerPixelRGB32 * x; |
| 36 } | 35 } |
| 37 | 36 |
| 38 static int CalculateYOffset(int x, int y, int stride) { | 37 int CalculateYOffset(int x, int y, int stride) { |
| 39 DCHECK(((x & 1) == 0) && ((y & 1) == 0)); | 38 DCHECK(((x & 1) == 0) && ((y & 1) == 0)); |
| 40 return stride * y + x; | 39 return stride * y + x; |
| 41 } | 40 } |
| 42 | 41 |
| 43 static int CalculateUVOffset(int x, int y, int stride) { | 42 int CalculateUVOffset(int x, int y, int stride) { |
| 44 DCHECK(((x & 1) == 0) && ((y & 1) == 0)); | 43 DCHECK(((x & 1) == 0) && ((y & 1) == 0)); |
| 45 return stride * y / 2 + x / 2; | 44 return stride * y / 2 + x / 2; |
| 46 } | 45 } |
| 47 | 46 |
| 48 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane, | 47 void ConvertRGB32ToYUVWithRect(const uint8* rgb_plane, |
| 49 uint8* y_plane, | 48 uint8* y_plane, |
| 50 uint8* u_plane, | 49 uint8* u_plane, |
| 51 uint8* v_plane, | 50 uint8* v_plane, |
| 52 int x, | 51 int x, |
| 53 int y, | 52 int y, |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 ++in_p; | 296 ++in_p; |
| 298 } else { | 297 } else { |
| 299 *out_p++ = c; | 298 *out_p++ = c; |
| 300 } | 299 } |
| 301 } | 300 } |
| 302 out.resize(out_p - out_p_begin); | 301 out.resize(out_p - out_p_begin); |
| 303 return out; | 302 return out; |
| 304 } | 303 } |
| 305 | 304 |
| 306 } // namespace remoting | 305 } // namespace remoting |
| OLD | NEW |