Index: webrtc/pc/planarfunctions_unittest.cc |
diff --git a/webrtc/pc/planarfunctions_unittest.cc b/webrtc/pc/planarfunctions_unittest.cc |
index bf14120bce5d509744bcaff3b4893a5f00dc7c37..af7e628cde349a9ccbb28132b8e287d719a83c56 100644 |
--- a/webrtc/pc/planarfunctions_unittest.cc |
+++ b/webrtc/pc/planarfunctions_unittest.cc |
@@ -8,6 +8,7 @@ |
* be found in the AUTHORS file in the root of the source tree. |
*/ |
+#include <memory> |
#include <string> |
#include "libyuv/convert.h" |
@@ -17,7 +18,6 @@ |
#include "libyuv/planar_functions.h" |
#include "webrtc/base/flags.h" |
#include "webrtc/base/gunit.h" |
-#include "webrtc/base/scoped_ptr.h" |
#include "webrtc/media/base/testutils.h" |
#include "webrtc/media/base/videocommon.h" |
@@ -469,12 +469,12 @@ class PlanarFunctionsTest : public testing::TestWithParam<int> { |
int repeat_; |
// Y, U, V and R, G, B channels of testing colors. |
- rtc::scoped_ptr<uint8_t[]> testing_color_y_; |
- rtc::scoped_ptr<uint8_t[]> testing_color_u_; |
- rtc::scoped_ptr<uint8_t[]> testing_color_v_; |
- rtc::scoped_ptr<uint8_t[]> testing_color_r_; |
- rtc::scoped_ptr<uint8_t[]> testing_color_g_; |
- rtc::scoped_ptr<uint8_t[]> testing_color_b_; |
+ std::unique_ptr<uint8_t[]> testing_color_y_; |
+ std::unique_ptr<uint8_t[]> testing_color_u_; |
+ std::unique_ptr<uint8_t[]> testing_color_v_; |
+ std::unique_ptr<uint8_t[]> testing_color_r_; |
+ std::unique_ptr<uint8_t[]> testing_color_g_; |
+ std::unique_ptr<uint8_t[]> testing_color_b_; |
}; |
TEST_F(PlanarFunctionsTest, I420Copy) { |
@@ -488,11 +488,11 @@ TEST_F(PlanarFunctionsTest, I420Copy) { |
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1); |
int block_size = 3; |
// Generate a fake input image. |
- rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage( |
+ std::unique_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage( |
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_pointer, u_pointer, |
v_pointer)); |
// Allocate space for the output image. |
- rtc::scoped_ptr<uint8_t[]> yuv_output( |
+ std::unique_ptr<uint8_t[]> yuv_output( |
new uint8_t[I420_SIZE(kHeight, kWidth) + kAlignment]); |
uint8_t* y_output_pointer = ALIGNP(yuv_output.get(), kAlignment); |
uint8_t* u_output_pointer = y_output_pointer + y_size; |
@@ -526,11 +526,11 @@ TEST_F(PlanarFunctionsTest, I422ToI420) { |
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1); |
int block_size = 2; |
// Generate a fake input image. |
- rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage( |
+ std::unique_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage( |
kHeight, kWidth, block_size, libyuv::kJpegYuv422, y_pointer, u_pointer, |
v_pointer)); |
// Allocate space for the output image. |
- rtc::scoped_ptr<uint8_t[]> yuv_output( |
+ std::unique_ptr<uint8_t[]> yuv_output( |
new uint8_t[I420_SIZE(kHeight, kWidth) + kAlignment]); |
uint8_t* y_output_pointer = ALIGNP(yuv_output.get(), kAlignment); |
uint8_t* u_output_pointer = y_output_pointer + y_size; |
@@ -539,7 +539,7 @@ TEST_F(PlanarFunctionsTest, I422ToI420) { |
uint8_t* y_expected_pointer = nullptr; |
uint8_t* u_expected_pointer = nullptr; |
uint8_t* v_expected_pointer = nullptr; |
- rtc::scoped_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage( |
+ std::unique_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage( |
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_expected_pointer, |
u_expected_pointer, v_expected_pointer)); |
@@ -574,10 +574,10 @@ TEST_P(PlanarFunctionsTest, M420ToI420) { |
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1); |
int block_size = 2; |
// Generate a fake input image. |
- rtc::scoped_ptr<uint8_t[]> yuv_input( |
+ std::unique_ptr<uint8_t[]> yuv_input( |
CreateFakeM420TestingImage(kHeight, kWidth, block_size, m420_pointer)); |
// Allocate space for the output image. |
- rtc::scoped_ptr<uint8_t[]> yuv_output( |
+ std::unique_ptr<uint8_t[]> yuv_output( |
new uint8_t[I420_SIZE(kHeight, kWidth) + kAlignment + unalignment]); |
uint8_t* y_output_pointer = |
ALIGNP(yuv_output.get(), kAlignment) + unalignment; |
@@ -587,7 +587,7 @@ TEST_P(PlanarFunctionsTest, M420ToI420) { |
uint8_t* y_expected_pointer = nullptr; |
uint8_t* u_expected_pointer = nullptr; |
uint8_t* v_expected_pointer = nullptr; |
- rtc::scoped_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage( |
+ std::unique_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage( |
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_expected_pointer, |
u_expected_pointer, v_expected_pointer)); |
@@ -620,10 +620,10 @@ TEST_P(PlanarFunctionsTest, NV12ToI420) { |
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1); |
int block_size = 2; |
// Generate a fake input image. |
- rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeNV12TestingImage( |
+ std::unique_ptr<uint8_t[]> yuv_input(CreateFakeNV12TestingImage( |
kHeight, kWidth, block_size, y_pointer, uv_pointer)); |
// Allocate space for the output image. |
- rtc::scoped_ptr<uint8_t[]> yuv_output( |
+ std::unique_ptr<uint8_t[]> yuv_output( |
new uint8_t[I420_SIZE(kHeight, kWidth) + kAlignment + unalignment]); |
uint8_t* y_output_pointer = |
ALIGNP(yuv_output.get(), kAlignment) + unalignment; |
@@ -633,7 +633,7 @@ TEST_P(PlanarFunctionsTest, NV12ToI420) { |
uint8_t* y_expected_pointer = nullptr; |
uint8_t* u_expected_pointer = nullptr; |
uint8_t* v_expected_pointer = nullptr; |
- rtc::scoped_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage( |
+ std::unique_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage( |
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_expected_pointer, |
u_expected_pointer, v_expected_pointer)); |
@@ -668,10 +668,10 @@ TEST_P(PlanarFunctionsTest, NV12ToI420) { |
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1); \ |
int block_size = 2; \ |
/* Generate a fake input image.*/ \ |
- rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeInterleaveYuvTestingImage( \ |
+ std::unique_ptr<uint8_t[]> yuv_input(CreateFakeInterleaveYuvTestingImage( \ |
kHeight, kWidth, BLOCK_SIZE, yuv_pointer, FOURCC_##SRC_NAME)); \ |
/* Allocate space for the output image.*/ \ |
- rtc::scoped_ptr<uint8_t[]> yuv_output( \ |
+ std::unique_ptr<uint8_t[]> yuv_output( \ |
new uint8_t[I420_SIZE(kHeight, kWidth) + kAlignment + unalignment]); \ |
uint8_t* y_output_pointer = \ |
ALIGNP(yuv_output.get(), kAlignment) + unalignment; \ |
@@ -681,7 +681,7 @@ TEST_P(PlanarFunctionsTest, NV12ToI420) { |
uint8_t* y_expected_pointer = nullptr; \ |
uint8_t* u_expected_pointer = nullptr; \ |
uint8_t* v_expected_pointer = nullptr; \ |
- rtc::scoped_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage( \ |
+ std::unique_ptr<uint8_t[]> yuv_output_expected(CreateFakeYuvTestingImage( \ |
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_expected_pointer, \ |
u_expected_pointer, v_expected_pointer)); \ |
for (int i = 0; i < repeat_; ++i) { \ |
@@ -715,15 +715,15 @@ TEST_YUVTOI420(UYVY, 1.e-6, 2); |
int u_pitch = (kWidth + 1) >> 1; \ |
int v_pitch = (kWidth + 1) >> 1; \ |
/* Generate a fake input image.*/ \ |
- rtc::scoped_ptr<uint8_t[]> yuv_input( \ |
+ std::unique_ptr<uint8_t[]> yuv_input( \ |
CreateFakeYuvTestingImage(kHeight, kWidth, BLOCK_SIZE, JPG_TYPE, \ |
y_pointer, u_pointer, v_pointer)); \ |
/* Generate the expected output.*/ \ |
- rtc::scoped_ptr<uint8_t[]> argb_expected( \ |
+ std::unique_ptr<uint8_t[]> argb_expected( \ |
CreateFakeArgbTestingImage(kHeight, kWidth, BLOCK_SIZE, \ |
argb_expected_pointer, FOURCC_##DST_NAME)); \ |
/* Allocate space for the output.*/ \ |
- rtc::scoped_ptr<uint8_t[]> argb_output( \ |
+ std::unique_ptr<uint8_t[]> argb_output( \ |
new uint8_t[kHeight * kWidth * 4 + kAlignment]); \ |
uint8_t* argb_pointer = ALIGNP(argb_expected.get(), kAlignment); \ |
for (int i = 0; i < repeat_; ++i) { \ |
@@ -760,21 +760,21 @@ TEST_F(PlanarFunctionsTest, I400ToARGB_Reference) { |
int v_pitch = (kWidth + 1) >> 1; |
int block_size = 3; |
// Generate a fake input image. |
- rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage( |
+ std::unique_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage( |
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_pointer, u_pointer, |
v_pointer)); |
// As the comparison standard, we convert a grayscale image (by setting both |
// U and V channels to be 128) using an I420 converter. |
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1); |
- rtc::scoped_ptr<uint8_t[]> uv(new uint8_t[uv_size + kAlignment]); |
+ std::unique_ptr<uint8_t[]> uv(new uint8_t[uv_size + kAlignment]); |
u_pointer = v_pointer = ALIGNP(uv.get(), kAlignment); |
memset(u_pointer, 128, uv_size); |
// Allocate space for the output image and generate the expected output. |
- rtc::scoped_ptr<uint8_t[]> argb_expected( |
+ std::unique_ptr<uint8_t[]> argb_expected( |
new uint8_t[kHeight * kWidth * 4 + kAlignment]); |
- rtc::scoped_ptr<uint8_t[]> argb_output( |
+ std::unique_ptr<uint8_t[]> argb_output( |
new uint8_t[kHeight * kWidth * 4 + kAlignment]); |
uint8_t* argb_expected_pointer = ALIGNP(argb_expected.get(), kAlignment); |
uint8_t* argb_pointer = ALIGNP(argb_output.get(), kAlignment); |
@@ -807,7 +807,7 @@ TEST_P(PlanarFunctionsTest, I400ToARGB) { |
int v_pitch = (kWidth + 1) >> 1; |
int block_size = 3; |
// Generate a fake input image. |
- rtc::scoped_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage( |
+ std::unique_ptr<uint8_t[]> yuv_input(CreateFakeYuvTestingImage( |
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_pointer, u_pointer, |
v_pointer)); |
// As the comparison standard, we convert a grayscale image (by setting both |
@@ -815,17 +815,17 @@ TEST_P(PlanarFunctionsTest, I400ToARGB) { |
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1); |
// 1 byte extra if in the unaligned mode. |
- rtc::scoped_ptr<uint8_t[]> uv(new uint8_t[uv_size * 2 + kAlignment]); |
+ std::unique_ptr<uint8_t[]> uv(new uint8_t[uv_size * 2 + kAlignment]); |
u_pointer = ALIGNP(uv.get(), kAlignment); |
v_pointer = u_pointer + uv_size; |
memset(u_pointer, 128, uv_size); |
memset(v_pointer, 128, uv_size); |
// Allocate space for the output image and generate the expected output. |
- rtc::scoped_ptr<uint8_t[]> argb_expected( |
+ std::unique_ptr<uint8_t[]> argb_expected( |
new uint8_t[kHeight * kWidth * 4 + kAlignment]); |
// 1 byte extra if in the misalinged mode. |
- rtc::scoped_ptr<uint8_t[]> argb_output( |
+ std::unique_ptr<uint8_t[]> argb_output( |
new uint8_t[kHeight * kWidth * 4 + kAlignment + unalignment]); |
uint8_t* argb_expected_pointer = ALIGNP(argb_expected.get(), kAlignment); |
uint8_t* argb_pointer = ALIGNP(argb_output.get(), kAlignment) + unalignment; |
@@ -856,14 +856,14 @@ TEST_P(PlanarFunctionsTest, ARGBToI400) { |
uint8_t* argb_pointer = NULL; |
int block_size = 3; |
// Generate a fake input image. |
- rtc::scoped_ptr<uint8_t[]> argb_input(CreateFakeArgbTestingImage( |
+ std::unique_ptr<uint8_t[]> argb_input(CreateFakeArgbTestingImage( |
kHeight, kWidth, block_size, argb_pointer, FOURCC_ARGB)); |
// Generate the expected output. Only Y channel is used |
- rtc::scoped_ptr<uint8_t[]> yuv_expected(CreateFakeYuvTestingImage( |
+ std::unique_ptr<uint8_t[]> yuv_expected(CreateFakeYuvTestingImage( |
kHeight, kWidth, block_size, libyuv::kJpegYuv420, y_pointer, u_pointer, |
v_pointer)); |
// Allocate space for the Y output. |
- rtc::scoped_ptr<uint8_t[]> y_output( |
+ std::unique_ptr<uint8_t[]> y_output( |
new uint8_t[kHeight * kWidth + kAlignment + unalignment]); |
uint8_t* y_output_pointer = ALIGNP(y_output.get(), kAlignment) + unalignment; |
@@ -884,15 +884,15 @@ TEST_P(PlanarFunctionsTest, ARGBToI400) { |
#define TEST_ARGB(SRC_NAME, FC_ID, BPP, BLOCK_SIZE) \ |
TEST_P(PlanarFunctionsTest, SRC_NAME##ToARGB) { \ |
int unalignment = GetParam(); /* Get the unalignment offset.*/ \ |
- uint8_t* argb_expected_pointer = NULL, * src_pointer = NULL; \ |
+ uint8_t *argb_expected_pointer = NULL, *src_pointer = NULL; \ |
/* Generate a fake input image.*/ \ |
- rtc::scoped_ptr<uint8_t[]> src_input(CreateFakeArgbTestingImage( \ |
+ std::unique_ptr<uint8_t[]> src_input(CreateFakeArgbTestingImage( \ |
kHeight, kWidth, BLOCK_SIZE, src_pointer, FOURCC_##FC_ID)); \ |
/* Generate the expected output.*/ \ |
- rtc::scoped_ptr<uint8_t[]> argb_expected(CreateFakeArgbTestingImage( \ |
+ std::unique_ptr<uint8_t[]> argb_expected(CreateFakeArgbTestingImage( \ |
kHeight, kWidth, BLOCK_SIZE, argb_expected_pointer, FOURCC_ARGB)); \ |
/* Allocate space for the output; 1 byte extra if in the unaligned mode.*/ \ |
- rtc::scoped_ptr<uint8_t[]> argb_output( \ |
+ std::unique_ptr<uint8_t[]> argb_output( \ |
new uint8_t[kHeight * kWidth * 4 + kAlignment + unalignment]); \ |
uint8_t* argb_pointer = \ |
ALIGNP(argb_output.get(), kAlignment) + unalignment; \ |