| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/common_video/include/video_frame_buffer.h" | 11 #include "webrtc/common_video/include/video_frame_buffer.h" |
| 12 | 12 |
| 13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
| 14 #include "webrtc/base/keep_ref_until_done.h" | 14 #include "webrtc/base/keep_ref_until_done.h" |
| 15 #include "libyuv/convert.h" | 15 #include "libyuv/convert.h" |
| 16 #include "libyuv/scale.h" |
| 16 | 17 |
| 17 // Aligning pointer to 64 bytes for improved performance, e.g. use SIMD. | 18 // Aligning pointer to 64 bytes for improved performance, e.g. use SIMD. |
| 18 static const int kBufferAlignment = 64; | 19 static const int kBufferAlignment = 64; |
| 19 | 20 |
| 20 namespace webrtc { | 21 namespace webrtc { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 int I420DataSize(int height, int stride_y, int stride_u, int stride_v) { | 25 int I420DataSize(int height, int stride_y, int stride_u, int stride_v) { |
| 25 return stride_y * height + (stride_u + stride_v) * ((height + 1) / 2); | 26 return stride_y * height + (stride_u + stride_v) * ((height + 1) / 2); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 buffer->StrideV() * uv_offset_y + uv_offset_x; | 350 buffer->StrideV() * uv_offset_y + uv_offset_x; |
| 350 return new rtc::RefCountedObject<WrappedI420Buffer>( | 351 return new rtc::RefCountedObject<WrappedI420Buffer>( |
| 351 cropped_width, cropped_height, | 352 cropped_width, cropped_height, |
| 352 y_plane, buffer->StrideY(), | 353 y_plane, buffer->StrideY(), |
| 353 u_plane, buffer->StrideU(), | 354 u_plane, buffer->StrideU(), |
| 354 v_plane, buffer->StrideV(), | 355 v_plane, buffer->StrideV(), |
| 355 rtc::KeepRefUntilDone(buffer)); | 356 rtc::KeepRefUntilDone(buffer)); |
| 356 } | 357 } |
| 357 | 358 |
| 358 } // namespace webrtc | 359 } // namespace webrtc |
| OLD | NEW |