Chromium Code Reviews| 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 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 RTC_NOTREACHED(); | 39 RTC_NOTREACHED(); |
| 40 return nullptr; | 40 return nullptr; |
| 41 } | 41 } |
| 42 uint8_t* VideoFrameBuffer::MutableDataV() { | 42 uint8_t* VideoFrameBuffer::MutableDataV() { |
| 43 RTC_NOTREACHED(); | 43 RTC_NOTREACHED(); |
| 44 return nullptr; | 44 return nullptr; |
| 45 } | 45 } |
| 46 | 46 |
| 47 VideoFrameBuffer::~VideoFrameBuffer() {} | 47 VideoFrameBuffer::~VideoFrameBuffer() {} |
| 48 | 48 |
| 49 // static | |
| 50 rtc::scoped_refptr<VideoFrameBuffer> VideoFrameBuffer::Rotate( | |
| 51 const rtc::scoped_refptr<VideoFrameBuffer>& src, | |
| 52 VideoRotation rotation) { | |
|
perkj_webrtc
2016/08/26 15:22:17
please dcheck that src->DataY and U and V returns
| |
| 53 if (rotation == webrtc::kVideoRotation_0) { | |
| 54 return src; | |
| 55 } | |
| 56 | |
| 57 int rotated_width = src->width(); | |
| 58 int rotated_height = src->height(); | |
| 59 if (rotation == webrtc::kVideoRotation_90 || | |
| 60 rotation == webrtc::kVideoRotation_270) { | |
| 61 std::swap(rotated_width, rotated_height); | |
| 62 } | |
| 63 | |
| 64 rtc::scoped_refptr<webrtc::I420Buffer> buffer = | |
| 65 I420Buffer::Create(rotated_width, rotated_height); | |
| 66 | |
| 67 int res = libyuv::I420Rotate( | |
| 68 src->DataY(), src->StrideY(), | |
| 69 src->DataU(), src->StrideU(), | |
| 70 src->DataV(), src->StrideV(), | |
| 71 buffer->MutableDataY(), buffer->StrideY(), buffer->MutableDataU(), | |
| 72 buffer->StrideU(), buffer->MutableDataV(), buffer->StrideV(), | |
| 73 src->width(), src->height(), | |
| 74 static_cast<libyuv::RotationMode>(rotation)); | |
| 75 RTC_DCHECK_EQ(res, 0); | |
| 76 | |
| 77 return buffer; | |
| 78 } | |
| 79 | |
| 49 I420Buffer::I420Buffer(int width, int height) | 80 I420Buffer::I420Buffer(int width, int height) |
| 50 : I420Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) { | 81 : I420Buffer(width, height, width, (width + 1) / 2, (width + 1) / 2) { |
| 51 } | 82 } |
| 52 | 83 |
| 53 I420Buffer::I420Buffer(int width, | 84 I420Buffer::I420Buffer(int width, |
| 54 int height, | 85 int height, |
| 55 int stride_y, | 86 int stride_y, |
| 56 int stride_u, | 87 int stride_u, |
| 57 int stride_v) | 88 int stride_v) |
| 58 : width_(width), | 89 : width_(width), |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 void* WrappedI420Buffer::native_handle() const { | 369 void* WrappedI420Buffer::native_handle() const { |
| 339 return nullptr; | 370 return nullptr; |
| 340 } | 371 } |
| 341 | 372 |
| 342 rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() { | 373 rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() { |
| 343 RTC_NOTREACHED(); | 374 RTC_NOTREACHED(); |
| 344 return nullptr; | 375 return nullptr; |
| 345 } | 376 } |
| 346 | 377 |
| 347 } // namespace webrtc | 378 } // namespace webrtc |
| OLD | NEW |