mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-17 15:47:53 +01:00

In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC from src/webrtc to src/ (in order to preserve an healthy git history). This CL takes care of fixing header guards, #include paths, etc... NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true TBR=tommi@webrtc.org Bug: chromium:611808 Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578 Reviewed-on: https://webrtc-review.googlesource.com/1561 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Henrik Kjellander <kjellander@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#19846}
79 lines
2.3 KiB
C++
79 lines
2.3 KiB
C++
/*
|
|
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "api/video/video_frame_buffer.h"
|
|
|
|
#include "libyuv/convert.h"
|
|
#include "api/video/i420_buffer.h"
|
|
#include "rtc_base/checks.h"
|
|
|
|
namespace webrtc {
|
|
|
|
rtc::scoped_refptr<I420BufferInterface> VideoFrameBuffer::GetI420() {
|
|
RTC_CHECK(type() == Type::kI420);
|
|
return static_cast<I420BufferInterface*>(this);
|
|
}
|
|
|
|
rtc::scoped_refptr<const I420BufferInterface> VideoFrameBuffer::GetI420()
|
|
const {
|
|
RTC_CHECK(type() == Type::kI420);
|
|
return static_cast<const I420BufferInterface*>(this);
|
|
}
|
|
|
|
I444BufferInterface* VideoFrameBuffer::GetI444() {
|
|
RTC_CHECK(type() == Type::kI444);
|
|
return static_cast<I444BufferInterface*>(this);
|
|
}
|
|
|
|
const I444BufferInterface* VideoFrameBuffer::GetI444() const {
|
|
RTC_CHECK(type() == Type::kI444);
|
|
return static_cast<const I444BufferInterface*>(this);
|
|
}
|
|
|
|
VideoFrameBuffer::Type I420BufferInterface::type() const {
|
|
return Type::kI420;
|
|
}
|
|
|
|
int I420BufferInterface::ChromaWidth() const {
|
|
return (width() + 1) / 2;
|
|
}
|
|
|
|
int I420BufferInterface::ChromaHeight() const {
|
|
return (height() + 1) / 2;
|
|
}
|
|
|
|
rtc::scoped_refptr<I420BufferInterface> I420BufferInterface::ToI420() {
|
|
return this;
|
|
}
|
|
|
|
VideoFrameBuffer::Type I444BufferInterface::type() const {
|
|
return Type::kI444;
|
|
}
|
|
|
|
int I444BufferInterface::ChromaWidth() const {
|
|
return width();
|
|
}
|
|
|
|
int I444BufferInterface::ChromaHeight() const {
|
|
return height();
|
|
}
|
|
|
|
rtc::scoped_refptr<I420BufferInterface> I444BufferInterface::ToI420() {
|
|
rtc::scoped_refptr<I420Buffer> i420_buffer =
|
|
I420Buffer::Create(width(), height());
|
|
libyuv::I444ToI420(DataY(), StrideY(), DataU(), StrideU(), DataV(), StrideV(),
|
|
i420_buffer->MutableDataY(), i420_buffer->StrideY(),
|
|
i420_buffer->MutableDataU(), i420_buffer->StrideU(),
|
|
i420_buffer->MutableDataV(), i420_buffer->StrideV(),
|
|
width(), height());
|
|
return i420_buffer;
|
|
}
|
|
|
|
} // namespace webrtc
|