Delete method webrtc::VideoFrame::allocated_size and enum PlaneType.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2380623002
Cr-Commit-Position: refs/heads/master@{#14416}
diff --git a/webrtc/common_video/i420_video_frame_unittest.cc b/webrtc/common_video/i420_video_frame_unittest.cc
index f9d46ef..0ce2daa 100644
--- a/webrtc/common_video/i420_video_frame_unittest.cc
+++ b/webrtc/common_video/i420_video_frame_unittest.cc
@@ -21,12 +21,6 @@
namespace {
-int ExpectedSize(int plane_stride, int image_height, PlaneType type) {
- if (type == kYPlane)
- return plane_stride * image_height;
- return plane_stride * ((image_height + 1) / 2);
-}
-
rtc::scoped_refptr<I420Buffer> CreateGradient(int width, int height) {
rtc::scoped_refptr<I420Buffer> buffer(
I420Buffer::Create(width, height));
@@ -110,22 +104,6 @@
EXPECT_EQ(789, frame.render_time_ms());
}
-TEST(TestVideoFrame, SizeAllocation) {
- VideoFrame frame;
- frame. CreateEmptyFrame(10, 10, 12, 14, 220);
- int height = frame.height();
- int stride_y = frame.video_frame_buffer()->StrideY();
- int stride_u = frame.video_frame_buffer()->StrideU();
- int stride_v = frame.video_frame_buffer()->StrideV();
- // Verify that allocated size was computed correctly.
- EXPECT_EQ(ExpectedSize(stride_y, height, kYPlane),
- frame.allocated_size(kYPlane));
- EXPECT_EQ(ExpectedSize(stride_u, height, kUPlane),
- frame.allocated_size(kUPlane));
- EXPECT_EQ(ExpectedSize(stride_v, height, kVPlane),
- frame.allocated_size(kVPlane));
-}
-
TEST(TestVideoFrame, CopyFrame) {
uint32_t timestamp = 1;
int64_t ntp_time_ms = 2;
@@ -254,11 +232,6 @@
stride_uv, 8, 8));
EXPECT_TRUE(test::EqualPlane(buffer_v, frame2.video_frame_buffer()->DataV(),
stride_uv, 8, 8));
-
- // Compare size.
- EXPECT_LE(kSizeY, frame2.allocated_size(kYPlane));
- EXPECT_LE(kSizeUv, frame2.allocated_size(kUPlane));
- EXPECT_LE(kSizeUv, frame2.allocated_size(kVPlane));
}
TEST(TestVideoFrame, FailToReuseAllocation) {
diff --git a/webrtc/common_video/include/video_frame_buffer.h b/webrtc/common_video/include/video_frame_buffer.h
index ae7855f..fb867bc 100644
--- a/webrtc/common_video/include/video_frame_buffer.h
+++ b/webrtc/common_video/include/video_frame_buffer.h
@@ -23,13 +23,6 @@
namespace webrtc {
-enum PlaneType {
- kYPlane = 0,
- kUPlane = 1,
- kVPlane = 2,
- kNumOfPlanes = 3,
-};
-
// Interface of a simple frame buffer containing pixel data. This interface does
// not contain any frame metadata such as rotation, timestamp, pixel_width, etc.
class VideoFrameBuffer : public rtc::RefCountInterface {
diff --git a/webrtc/common_video/video_frame.cc b/webrtc/common_video/video_frame.cc
index 4b29be9..a9f0b4d 100644
--- a/webrtc/common_video/video_frame.cc
+++ b/webrtc/common_video/video_frame.cc
@@ -133,28 +133,6 @@
rotation_ = videoFrame.rotation_;
}
-// TODO(nisse): Delete. Besides test code, only one use, in
-// webrtcvideoengine2.cc:CreateBlackFrame.
-int VideoFrame::allocated_size(PlaneType type) const {
- const int plane_height = (type == kYPlane) ? height() : (height() + 1) / 2;
- int stride;
- switch (type) {
- case kYPlane:
- stride = video_frame_buffer_->StrideY();
- break;
- case kUPlane:
- stride = video_frame_buffer_->StrideU();
- break;
- case kVPlane:
- stride = video_frame_buffer_->StrideV();
- break;
- default:
- RTC_NOTREACHED();
- return 0;
- }
- return plane_height * stride;
-}
-
int VideoFrame::width() const {
return video_frame_buffer_ ? video_frame_buffer_->width() : 0;
}
diff --git a/webrtc/media/engine/webrtcvideoframe.cc b/webrtc/media/engine/webrtcvideoframe.cc
index 7b5a680..d13a6dc 100644
--- a/webrtc/media/engine/webrtcvideoframe.cc
+++ b/webrtc/media/engine/webrtcvideoframe.cc
@@ -16,10 +16,6 @@
#include "webrtc/media/base/videocommon.h"
#include "webrtc/video_frame.h"
-using webrtc::kYPlane;
-using webrtc::kUPlane;
-using webrtc::kVPlane;
-
namespace cricket {
WebRtcVideoFrame::WebRtcVideoFrame()
diff --git a/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
index 3cc08d2..d67a434 100644
--- a/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
+++ b/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
@@ -347,11 +347,11 @@
VideoFrame* video_frame = static_cast<VideoFrame*>(
av_buffer_get_opaque(av_frame_->buf[0]));
RTC_DCHECK(video_frame);
- RTC_CHECK_EQ(av_frame_->data[kYPlane],
+ RTC_CHECK_EQ(av_frame_->data[kYPlaneIndex],
video_frame->video_frame_buffer()->DataY());
- RTC_CHECK_EQ(av_frame_->data[kUPlane],
+ RTC_CHECK_EQ(av_frame_->data[kUPlaneIndex],
video_frame->video_frame_buffer()->DataU());
- RTC_CHECK_EQ(av_frame_->data[kVPlane],
+ RTC_CHECK_EQ(av_frame_->data[kVPlaneIndex],
video_frame->video_frame_buffer()->DataV());
video_frame->set_timestamp(input_image._timeStamp);
diff --git a/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h b/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h
index 22e8645..4aefb38 100644
--- a/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h
+++ b/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h
@@ -49,6 +49,13 @@
expected_values[2] = value2;
}
+enum PlaneType {
+ kYPlane = 0,
+ kUPlane = 1,
+ kVPlane = 2,
+ kNumOfPlanes = 3,
+};
+
class Vp8TestEncodedImageCallback : public EncodedImageCallback {
public:
Vp8TestEncodedImageCallback() : picture_id_(-1) {
diff --git a/webrtc/test/frame_generator_unittest.cc b/webrtc/test/frame_generator_unittest.cc
index 2cffdca..b375d04 100644
--- a/webrtc/test/frame_generator_unittest.cc
+++ b/webrtc/test/frame_generator_unittest.cc
@@ -60,15 +60,12 @@
// Check that frame is valid, has the correct color and timestamp are clean.
ASSERT_NE(nullptr, frame);
const uint8_t* buffer;
- ASSERT_EQ(y_size, frame->allocated_size(PlaneType::kYPlane));
buffer = frame->video_frame_buffer()->DataY();
for (int i = 0; i < y_size; ++i)
ASSERT_EQ(y, buffer[i]);
- ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kUPlane));
buffer = frame->video_frame_buffer()->DataU();
for (int i = 0; i < uv_size; ++i)
ASSERT_EQ(u, buffer[i]);
- ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kVPlane));
buffer = frame->video_frame_buffer()->DataV();
for (int i = 0; i < uv_size; ++i)
ASSERT_EQ(v, buffer[i]);
diff --git a/webrtc/video_frame.h b/webrtc/video_frame.h
index b99e60d..17dc496 100644
--- a/webrtc/video_frame.h
+++ b/webrtc/video_frame.h
@@ -100,13 +100,6 @@
// to the constructor.
void ShallowCopy(const VideoFrame& videoFrame);
- // Get allocated size per plane.
-
- // TODO(nisse): Deprecated. Should be deleted in the cricket::VideoFrame and
- // webrtc::VideoFrame merge. When used with memset, consider using
- // libyuv::I420Rect instead.
- int allocated_size(PlaneType type) const;
-
// Get frame width.
int width() const;