Commit ade85fb5 authored by Frank Barchard's avatar Frank Barchard

remove row.h from unittests

add SIMD_ALIGNED to unittest header.

BUG=libyuv:594
TESTED=local build passes with row.h removed from tests.
R=harryjin@google.com

Review URL: https://codereview.chromium.org/2001373002 .
parent 942db301
...@@ -1744,7 +1744,9 @@ int ARGBBlur(const uint8* src_argb, int src_stride_argb, ...@@ -1744,7 +1744,9 @@ int ARGBBlur(const uint8* src_argb, int src_stride_argb,
#if defined(HAS_CUMULATIVESUMTOAVERAGEROW_SSE2) #if defined(HAS_CUMULATIVESUMTOAVERAGEROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2)) { if (TestCpuFlag(kCpuHasSSE2)) {
ComputeCumulativeSumRow = ComputeCumulativeSumRow_SSE2; ComputeCumulativeSumRow = ComputeCumulativeSumRow_SSE2;
CumulativeSumToAverageRow = CumulativeSumToAverageRow_SSE2; if (IS_ALIGNED(dst_cumsum, 16)) {
CumulativeSumToAverageRow = CumulativeSumToAverageRow_SSE2;
}
} }
#endif #endif
// Compute enough CumulativeSum for first row to be blurred. After this // Compute enough CumulativeSum for first row to be blurred. After this
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
#include <stdlib.h> #include <stdlib.h>
#include "libyuv/basic_types.h"
#include "libyuv/convert.h" #include "libyuv/convert.h"
#include "libyuv/convert_argb.h" #include "libyuv/convert_argb.h"
#include "libyuv/convert_from.h" #include "libyuv/convert_from.h"
#include "libyuv/convert_from_argb.h" #include "libyuv/convert_from_argb.h"
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/row.h" // For Sobel
#include "../unit_test/unit_test.h" #include "../unit_test/unit_test.h"
namespace libyuv { namespace libyuv {
...@@ -41,15 +41,15 @@ namespace libyuv { ...@@ -41,15 +41,15 @@ namespace libyuv {
const int kPixels = benchmark_width_ * benchmark_height_; \ const int kPixels = benchmark_width_ * benchmark_height_; \
const int kHalfPixels = ((benchmark_width_ + 1) / 2) * \ const int kHalfPixels = ((benchmark_width_ + 1) / 2) * \
((benchmark_height_ + HS1) / HS); \ ((benchmark_height_ + HS1) / HS); \
align_buffer_64(orig_y, kPixels); \ align_buffer_page_end(orig_y, kPixels); \
align_buffer_64(orig_u, kHalfPixels); \ align_buffer_page_end(orig_u, kHalfPixels); \
align_buffer_64(orig_v, kHalfPixels); \ align_buffer_page_end(orig_v, kHalfPixels); \
align_buffer_64(orig_pixels, kPixels * 4); \ align_buffer_page_end(orig_pixels, kPixels * 4); \
align_buffer_64(temp_y, kPixels); \ align_buffer_page_end(temp_y, kPixels); \
align_buffer_64(temp_u, kHalfPixels); \ align_buffer_page_end(temp_u, kHalfPixels); \
align_buffer_64(temp_v, kHalfPixels); \ align_buffer_page_end(temp_v, kHalfPixels); \
align_buffer_64(dst_pixels_opt, kPixels * 4); \ align_buffer_page_end(dst_pixels_opt, kPixels * 4); \
align_buffer_64(dst_pixels_c, kPixels * 4); \ align_buffer_page_end(dst_pixels_c, kPixels * 4); \
\ \
MemRandomize(orig_pixels, kPixels * 4); \ MemRandomize(orig_pixels, kPixels * 4); \
MemRandomize(orig_y, kPixels); \ MemRandomize(orig_y, kPixels); \
...@@ -132,15 +132,15 @@ namespace libyuv { ...@@ -132,15 +132,15 @@ namespace libyuv {
static_cast<int>(dst_pixels_opt[i]), DIFF); \ static_cast<int>(dst_pixels_opt[i]), DIFF); \
} \ } \
\ \
free_aligned_buffer_64(orig_pixels); \ free_aligned_buffer_page_end(orig_pixels); \
free_aligned_buffer_64(orig_y); \ free_aligned_buffer_page_end(orig_y); \
free_aligned_buffer_64(orig_u); \ free_aligned_buffer_page_end(orig_u); \
free_aligned_buffer_64(orig_v); \ free_aligned_buffer_page_end(orig_v); \
free_aligned_buffer_64(temp_y); \ free_aligned_buffer_page_end(temp_y); \
free_aligned_buffer_64(temp_u); \ free_aligned_buffer_page_end(temp_u); \
free_aligned_buffer_64(temp_v); \ free_aligned_buffer_page_end(temp_v); \
free_aligned_buffer_64(dst_pixels_opt); \ free_aligned_buffer_page_end(dst_pixels_opt); \
free_aligned_buffer_64(dst_pixels_c); \ free_aligned_buffer_page_end(dst_pixels_c); \
} \ } \
TESTCS(TestI420, I420ToARGB, ARGBToI420, 1, 2, benchmark_width_, ERROR_FULL) TESTCS(TestI420, I420ToARGB, ARGBToI420, 1, 2, benchmark_width_, ERROR_FULL)
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include "libyuv/compare.h" #include "libyuv/compare.h"
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/row.h"
#include "libyuv/video_common.h" #include "libyuv/video_common.h"
namespace libyuv { namespace libyuv {
...@@ -34,8 +33,8 @@ static uint32 ReferenceHashDjb2(const uint8* src, uint64 count, uint32 seed) { ...@@ -34,8 +33,8 @@ static uint32 ReferenceHashDjb2(const uint8* src, uint64 count, uint32 seed) {
TEST_F(LibYUVBaseTest, Djb2_Test) { TEST_F(LibYUVBaseTest, Djb2_Test) {
const int kMaxTest = benchmark_width_ * benchmark_height_; const int kMaxTest = benchmark_width_ * benchmark_height_;
align_buffer_64(src_a, kMaxTest); align_buffer_page_end(src_a, kMaxTest);
align_buffer_64(src_b, kMaxTest); align_buffer_page_end(src_b, kMaxTest);
const char* fox = "The quick brown fox jumps over the lazy dog" const char* fox = "The quick brown fox jumps over the lazy dog"
" and feels as if he were in the seventh heaven of typography" " and feels as if he were in the seventh heaven of typography"
...@@ -112,13 +111,13 @@ TEST_F(LibYUVBaseTest, Djb2_Test) { ...@@ -112,13 +111,13 @@ TEST_F(LibYUVBaseTest, Djb2_Test) {
h2 = HashDjb2(src_a, kMaxTest / 2, 0); h2 = HashDjb2(src_a, kMaxTest / 2, 0);
EXPECT_EQ(h1, h2); EXPECT_EQ(h1, h2);
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
free_aligned_buffer_64(src_b); free_aligned_buffer_page_end(src_b);
} }
TEST_F(LibYUVBaseTest, BenchmarkDjb2_Opt) { TEST_F(LibYUVBaseTest, BenchmarkDjb2_Opt) {
const int kMaxTest = benchmark_width_ * benchmark_height_; const int kMaxTest = benchmark_width_ * benchmark_height_;
align_buffer_64(src_a, kMaxTest); align_buffer_page_end(src_a, kMaxTest);
for (int i = 0; i < kMaxTest; ++i) { for (int i = 0; i < kMaxTest; ++i) {
src_a[i] = i; src_a[i] = i;
...@@ -129,12 +128,12 @@ TEST_F(LibYUVBaseTest, BenchmarkDjb2_Opt) { ...@@ -129,12 +128,12 @@ TEST_F(LibYUVBaseTest, BenchmarkDjb2_Opt) {
h1 = HashDjb2(src_a, kMaxTest, 5381); h1 = HashDjb2(src_a, kMaxTest, 5381);
} }
EXPECT_EQ(h1, h2); EXPECT_EQ(h1, h2);
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
} }
TEST_F(LibYUVBaseTest, BenchmarkDjb2_Unaligned) { TEST_F(LibYUVBaseTest, BenchmarkDjb2_Unaligned) {
const int kMaxTest = benchmark_width_ * benchmark_height_; const int kMaxTest = benchmark_width_ * benchmark_height_;
align_buffer_64(src_a, kMaxTest + 1); align_buffer_page_end(src_a, kMaxTest + 1);
for (int i = 0; i < kMaxTest; ++i) { for (int i = 0; i < kMaxTest; ++i) {
src_a[i + 1] = i; src_a[i + 1] = i;
} }
...@@ -144,13 +143,13 @@ TEST_F(LibYUVBaseTest, BenchmarkDjb2_Unaligned) { ...@@ -144,13 +143,13 @@ TEST_F(LibYUVBaseTest, BenchmarkDjb2_Unaligned) {
h1 = HashDjb2(src_a + 1, kMaxTest, 5381); h1 = HashDjb2(src_a + 1, kMaxTest, 5381);
} }
EXPECT_EQ(h1, h2); EXPECT_EQ(h1, h2);
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
} }
TEST_F(LibYUVBaseTest, BenchmarkARGBDetect_Opt) { TEST_F(LibYUVBaseTest, BenchmarkARGBDetect_Opt) {
uint32 fourcc; uint32 fourcc;
const int kMaxTest = benchmark_width_ * benchmark_height_ * 4; const int kMaxTest = benchmark_width_ * benchmark_height_ * 4;
align_buffer_64(src_a, kMaxTest); align_buffer_page_end(src_a, kMaxTest);
for (int i = 0; i < kMaxTest; ++i) { for (int i = 0; i < kMaxTest; ++i) {
src_a[i] = 255; src_a[i] = 255;
} }
...@@ -172,13 +171,13 @@ TEST_F(LibYUVBaseTest, BenchmarkARGBDetect_Opt) { ...@@ -172,13 +171,13 @@ TEST_F(LibYUVBaseTest, BenchmarkARGBDetect_Opt) {
} }
EXPECT_EQ(0, fourcc); EXPECT_EQ(0, fourcc);
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
} }
TEST_F(LibYUVBaseTest, BenchmarkARGBDetect_Unaligned) { TEST_F(LibYUVBaseTest, BenchmarkARGBDetect_Unaligned) {
uint32 fourcc; uint32 fourcc;
const int kMaxTest = benchmark_width_ * benchmark_height_ * 4 + 1; const int kMaxTest = benchmark_width_ * benchmark_height_ * 4 + 1;
align_buffer_64(src_a, kMaxTest); align_buffer_page_end(src_a, kMaxTest);
for (int i = 1; i < kMaxTest; ++i) { for (int i = 1; i < kMaxTest; ++i) {
src_a[i] = 255; src_a[i] = 255;
} }
...@@ -200,12 +199,12 @@ TEST_F(LibYUVBaseTest, BenchmarkARGBDetect_Unaligned) { ...@@ -200,12 +199,12 @@ TEST_F(LibYUVBaseTest, BenchmarkARGBDetect_Unaligned) {
} }
EXPECT_EQ(0, fourcc); EXPECT_EQ(0, fourcc);
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
} }
TEST_F(LibYUVBaseTest, BenchmarkSumSquareError_Opt) { TEST_F(LibYUVBaseTest, BenchmarkSumSquareError_Opt) {
const int kMaxWidth = 4096 * 3; const int kMaxWidth = 4096 * 3;
align_buffer_64(src_a, kMaxWidth); align_buffer_page_end(src_a, kMaxWidth);
align_buffer_64(src_b, kMaxWidth); align_buffer_page_end(src_b, kMaxWidth);
memset(src_a, 0, kMaxWidth); memset(src_a, 0, kMaxWidth);
memset(src_b, 0, kMaxWidth); memset(src_b, 0, kMaxWidth);
...@@ -229,14 +228,14 @@ TEST_F(LibYUVBaseTest, BenchmarkSumSquareError_Opt) { ...@@ -229,14 +228,14 @@ TEST_F(LibYUVBaseTest, BenchmarkSumSquareError_Opt) {
EXPECT_EQ(0, h1); EXPECT_EQ(0, h1);
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
free_aligned_buffer_64(src_b); free_aligned_buffer_page_end(src_b);
} }
TEST_F(LibYUVBaseTest, SumSquareError) { TEST_F(LibYUVBaseTest, SumSquareError) {
const int kMaxWidth = 4096 * 3; const int kMaxWidth = 4096 * 3;
align_buffer_64(src_a, kMaxWidth); align_buffer_page_end(src_a, kMaxWidth);
align_buffer_64(src_b, kMaxWidth); align_buffer_page_end(src_b, kMaxWidth);
memset(src_a, 0, kMaxWidth); memset(src_a, 0, kMaxWidth);
memset(src_b, 0, kMaxWidth); memset(src_b, 0, kMaxWidth);
...@@ -269,13 +268,13 @@ TEST_F(LibYUVBaseTest, SumSquareError) { ...@@ -269,13 +268,13 @@ TEST_F(LibYUVBaseTest, SumSquareError) {
EXPECT_EQ(c_err, opt_err); EXPECT_EQ(c_err, opt_err);
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
free_aligned_buffer_64(src_b); free_aligned_buffer_page_end(src_b);
} }
TEST_F(LibYUVBaseTest, BenchmarkPsnr_Opt) { TEST_F(LibYUVBaseTest, BenchmarkPsnr_Opt) {
align_buffer_64(src_a, benchmark_width_ * benchmark_height_); align_buffer_page_end(src_a, benchmark_width_ * benchmark_height_);
align_buffer_64(src_b, benchmark_width_ * benchmark_height_); align_buffer_page_end(src_b, benchmark_width_ * benchmark_height_);
for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
src_a[i] = i; src_a[i] = i;
src_b[i] = i; src_b[i] = i;
...@@ -294,13 +293,13 @@ TEST_F(LibYUVBaseTest, BenchmarkPsnr_Opt) { ...@@ -294,13 +293,13 @@ TEST_F(LibYUVBaseTest, BenchmarkPsnr_Opt) {
EXPECT_EQ(0, 0); EXPECT_EQ(0, 0);
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
free_aligned_buffer_64(src_b); free_aligned_buffer_page_end(src_b);
} }
TEST_F(LibYUVBaseTest, BenchmarkPsnr_Unaligned) { TEST_F(LibYUVBaseTest, BenchmarkPsnr_Unaligned) {
align_buffer_64(src_a, benchmark_width_ * benchmark_height_ + 1); align_buffer_page_end(src_a, benchmark_width_ * benchmark_height_ + 1);
align_buffer_64(src_b, benchmark_width_ * benchmark_height_); align_buffer_page_end(src_b, benchmark_width_ * benchmark_height_);
for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
src_a[i + 1] = i; src_a[i + 1] = i;
src_b[i] = i; src_b[i] = i;
...@@ -319,8 +318,8 @@ TEST_F(LibYUVBaseTest, BenchmarkPsnr_Unaligned) { ...@@ -319,8 +318,8 @@ TEST_F(LibYUVBaseTest, BenchmarkPsnr_Unaligned) {
EXPECT_EQ(0, 0); EXPECT_EQ(0, 0);
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
free_aligned_buffer_64(src_b); free_aligned_buffer_page_end(src_b);
} }
TEST_F(LibYUVBaseTest, Psnr) { TEST_F(LibYUVBaseTest, Psnr) {
...@@ -329,8 +328,8 @@ TEST_F(LibYUVBaseTest, Psnr) { ...@@ -329,8 +328,8 @@ TEST_F(LibYUVBaseTest, Psnr) {
const int b = 128; const int b = 128;
const int kSrcPlaneSize = (kSrcWidth + b * 2) * (kSrcHeight + b * 2); const int kSrcPlaneSize = (kSrcWidth + b * 2) * (kSrcHeight + b * 2);
const int kSrcStride = 2 * b + kSrcWidth; const int kSrcStride = 2 * b + kSrcWidth;
align_buffer_64(src_a, kSrcPlaneSize); align_buffer_page_end(src_a, kSrcPlaneSize);
align_buffer_64(src_b, kSrcPlaneSize); align_buffer_page_end(src_b, kSrcPlaneSize);
memset(src_a, 0, kSrcPlaneSize); memset(src_a, 0, kSrcPlaneSize);
memset(src_b, 0, kSrcPlaneSize); memset(src_b, 0, kSrcPlaneSize);
...@@ -396,13 +395,13 @@ TEST_F(LibYUVBaseTest, Psnr) { ...@@ -396,13 +395,13 @@ TEST_F(LibYUVBaseTest, Psnr) {
EXPECT_EQ(opt_err, c_err); EXPECT_EQ(opt_err, c_err);
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
free_aligned_buffer_64(src_b); free_aligned_buffer_page_end(src_b);
} }
TEST_F(LibYUVBaseTest, DISABLED_BenchmarkSsim_Opt) { TEST_F(LibYUVBaseTest, DISABLED_BenchmarkSsim_Opt) {
align_buffer_64(src_a, benchmark_width_ * benchmark_height_); align_buffer_page_end(src_a, benchmark_width_ * benchmark_height_);
align_buffer_64(src_b, benchmark_width_ * benchmark_height_); align_buffer_page_end(src_b, benchmark_width_ * benchmark_height_);
for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
src_a[i] = i; src_a[i] = i;
src_b[i] = i; src_b[i] = i;
...@@ -421,8 +420,8 @@ TEST_F(LibYUVBaseTest, DISABLED_BenchmarkSsim_Opt) { ...@@ -421,8 +420,8 @@ TEST_F(LibYUVBaseTest, DISABLED_BenchmarkSsim_Opt) {
EXPECT_EQ(0, 0); // Pass if we get this far. EXPECT_EQ(0, 0); // Pass if we get this far.
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
free_aligned_buffer_64(src_b); free_aligned_buffer_page_end(src_b);
} }
TEST_F(LibYUVBaseTest, Ssim) { TEST_F(LibYUVBaseTest, Ssim) {
...@@ -431,8 +430,8 @@ TEST_F(LibYUVBaseTest, Ssim) { ...@@ -431,8 +430,8 @@ TEST_F(LibYUVBaseTest, Ssim) {
const int b = 128; const int b = 128;
const int kSrcPlaneSize = (kSrcWidth + b * 2) * (kSrcHeight + b * 2); const int kSrcPlaneSize = (kSrcWidth + b * 2) * (kSrcHeight + b * 2);
const int kSrcStride = 2 * b + kSrcWidth; const int kSrcStride = 2 * b + kSrcWidth;
align_buffer_64(src_a, kSrcPlaneSize); align_buffer_page_end(src_a, kSrcPlaneSize);
align_buffer_64(src_b, kSrcPlaneSize); align_buffer_page_end(src_b, kSrcPlaneSize);
memset(src_a, 0, kSrcPlaneSize); memset(src_a, 0, kSrcPlaneSize);
memset(src_b, 0, kSrcPlaneSize); memset(src_b, 0, kSrcPlaneSize);
...@@ -507,8 +506,8 @@ TEST_F(LibYUVBaseTest, Ssim) { ...@@ -507,8 +506,8 @@ TEST_F(LibYUVBaseTest, Ssim) {
EXPECT_EQ(opt_err, c_err); EXPECT_EQ(opt_err, c_err);
} }
free_aligned_buffer_64(src_a); free_aligned_buffer_page_end(src_a);
free_aligned_buffer_64(src_b); free_aligned_buffer_page_end(src_b);
} }
} // namespace libyuv } // namespace libyuv
This diff is collapsed.
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/row.h" // For HAS_ARGBSHUFFLEROW_AVX2.
#include "libyuv/version.h" #include "libyuv/version.h"
#include "../unit_test/unit_test.h" #include "../unit_test/unit_test.h"
...@@ -68,16 +67,9 @@ printf("_MSC_VER %d\n", _MSC_VER); ...@@ -68,16 +67,9 @@ printf("_MSC_VER %d\n", _MSC_VER);
#if !defined(LIBYUV_DISABLE_X86) && (defined(GCC_HAS_AVX2) || \ #if !defined(LIBYUV_DISABLE_X86) && (defined(GCC_HAS_AVX2) || \
defined(CLANG_HAS_AVX2) || defined(VISUALC_HAS_AVX2)) defined(CLANG_HAS_AVX2) || defined(VISUALC_HAS_AVX2))
printf("Has AVX2 1\n"); printf("Has AVX2 1\n");
// If compiler supports AVX2, the following function is expected to exist:
#if !defined(HAS_ARGBSHUFFLEROW_AVX2)
EXPECT_TRUE(0); // HAS_ARGBSHUFFLEROW_AVX2 was expected.
#endif
#else #else
printf("Has AVX2 0\n"); printf("Has AVX2 0\n");
// If compiler does not support AVX2, the following function not expected: // If compiler does not support AVX2, the following function not expected:
#if defined(HAS_ARGBSHUFFLEROW_AVX2)
EXPECT_TRUE(0); // HAS_ARGBSHUFFLEROW_AVX2 was not expected.
#endif
#endif #endif
} }
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/row.h"
#include "libyuv/scale.h" #include "libyuv/scale.h"
#include "libyuv/scale_row.h" #include "libyuv/scale_row.h"
#include "../unit_test/unit_test.h" #include "../unit_test/unit_test.h"
......
This diff is collapsed.
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/rotate_argb.h" #include "libyuv/rotate_argb.h"
#include "libyuv/row.h"
#include "../unit_test/unit_test.h" #include "../unit_test/unit_test.h"
namespace libyuv { namespace libyuv {
...@@ -38,15 +37,15 @@ void TestRotateBpp(int src_width, int src_height, ...@@ -38,15 +37,15 @@ void TestRotateBpp(int src_width, int src_height,
} }
int src_stride_argb = src_width * kBpp; int src_stride_argb = src_width * kBpp;
int src_argb_plane_size = src_stride_argb * abs(src_height); int src_argb_plane_size = src_stride_argb * abs(src_height);
align_buffer_64(src_argb, src_argb_plane_size); align_buffer_page_end(src_argb, src_argb_plane_size);
for (int i = 0; i < src_argb_plane_size; ++i) { for (int i = 0; i < src_argb_plane_size; ++i) {
src_argb[i] = fastrand() & 0xff; src_argb[i] = fastrand() & 0xff;
} }
int dst_stride_argb = dst_width * kBpp; int dst_stride_argb = dst_width * kBpp;
int dst_argb_plane_size = dst_stride_argb * dst_height; int dst_argb_plane_size = dst_stride_argb * dst_height;
align_buffer_64(dst_argb_c, dst_argb_plane_size); align_buffer_page_end(dst_argb_c, dst_argb_plane_size);
align_buffer_64(dst_argb_opt, dst_argb_plane_size); align_buffer_page_end(dst_argb_opt, dst_argb_plane_size);
memset(dst_argb_c, 2, dst_argb_plane_size); memset(dst_argb_c, 2, dst_argb_plane_size);
memset(dst_argb_opt, 3, dst_argb_plane_size); memset(dst_argb_opt, 3, dst_argb_plane_size);
...@@ -81,9 +80,9 @@ void TestRotateBpp(int src_width, int src_height, ...@@ -81,9 +80,9 @@ void TestRotateBpp(int src_width, int src_height,
EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]);
} }
free_aligned_buffer_64(dst_argb_c); free_aligned_buffer_page_end(dst_argb_c);
free_aligned_buffer_64(dst_argb_opt); free_aligned_buffer_page_end(dst_argb_opt);
free_aligned_buffer_64(src_argb); free_aligned_buffer_page_end(src_argb);
} }
static void ARGBTestRotate(int src_width, int src_height, static void ARGBTestRotate(int src_width, int src_height,
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/rotate.h" #include "libyuv/rotate.h"
#include "libyuv/row.h"
#include "../unit_test/unit_test.h" #include "../unit_test/unit_test.h"
namespace libyuv { namespace libyuv {
...@@ -37,7 +36,7 @@ static void I420TestRotate(int src_width, int src_height, ...@@ -37,7 +36,7 @@ static void I420TestRotate(int src_width, int src_height,
int src_i420_y_size = src_width * Abs(src_height); int src_i420_y_size = src_width * Abs(src_height);
int src_i420_uv_size = ((src_width + 1) / 2) * ((Abs(src_height) + 1) / 2); int src_i420_uv_size = ((src_width + 1) / 2) * ((Abs(src_height) + 1) / 2);
int src_i420_size = src_i420_y_size + src_i420_uv_size * 2; int src_i420_size = src_i420_y_size + src_i420_uv_size * 2;
align_buffer_64(src_i420, src_i420_size); align_buffer_page_end(src_i420, src_i420_size);
for (int i = 0; i < src_i420_size; ++i) { for (int i = 0; i < src_i420_size; ++i) {
src_i420[i] = fastrand() & 0xff; src_i420[i] = fastrand() & 0xff;
} }
...@@ -45,8 +44,8 @@ static void I420TestRotate(int src_width, int src_height, ...@@ -45,8 +44,8 @@ static void I420TestRotate(int src_width, int src_height,
int dst_i420_y_size = dst_width * dst_height; int dst_i420_y_size = dst_width * dst_height;
int dst_i420_uv_size = ((dst_width + 1) / 2) * ((dst_height + 1) / 2); int dst_i420_uv_size = ((dst_width + 1) / 2) * ((dst_height + 1) / 2);
int dst_i420_size = dst_i420_y_size + dst_i420_uv_size * 2; int dst_i420_size = dst_i420_y_size + dst_i420_uv_size * 2;
align_buffer_64(dst_i420_c, dst_i420_size); align_buffer_page_end(dst_i420_c, dst_i420_size);
align_buffer_64(dst_i420_opt, dst_i420_size); align_buffer_page_end(dst_i420_opt, dst_i420_size);
memset(dst_i420_c, 2, dst_i420_size); memset(dst_i420_c, 2, dst_i420_size);
memset(dst_i420_opt, 3, dst_i420_size); memset(dst_i420_opt, 3, dst_i420_size);
...@@ -78,9 +77,9 @@ static void I420TestRotate(int src_width, int src_height, ...@@ -78,9 +77,9 @@ static void I420TestRotate(int src_width, int src_height,
EXPECT_EQ(dst_i420_c[i], dst_i420_opt[i]); EXPECT_EQ(dst_i420_c[i], dst_i420_opt[i]);
} }
free_aligned_buffer_64(dst_i420_c); free_aligned_buffer_page_end(dst_i420_c);
free_aligned_buffer_64(dst_i420_opt); free_aligned_buffer_page_end(dst_i420_opt);
free_aligned_buffer_64(src_i420); free_aligned_buffer_page_end(src_i420);
} }
TEST_F(LibYUVRotateTest, I420Rotate0_Opt) { TEST_F(LibYUVRotateTest, I420Rotate0_Opt) {
...@@ -163,7 +162,7 @@ static void NV12TestRotate(int src_width, int src_height, ...@@ -163,7 +162,7 @@ static void NV12TestRotate(int src_width, int src_height,
int src_nv12_uv_size = int src_nv12_uv_size =
((src_width + 1) / 2) * ((Abs(src_height) + 1) / 2) * 2; ((src_width + 1) / 2) * ((Abs(src_height) + 1) / 2) * 2;
int src_nv12_size = src_nv12_y_size + src_nv12_uv_size; int src_nv12_size = src_nv12_y_size + src_nv12_uv_size;
align_buffer_64(src_nv12, src_nv12_size); align_buffer_page_end(src_nv12, src_nv12_size);
for (int i = 0; i < src_nv12_size; ++i) { for (int i = 0; i < src_nv12_size; ++i) {
src_nv12[i] = fastrand() & 0xff; src_nv12[i] = fastrand() & 0xff;
} }
...@@ -171,8 +170,8 @@ static void NV12TestRotate(int src_width, int src_height, ...@@ -171,8 +170,8 @@ static void NV12TestRotate(int src_width, int src_height,
int dst_i420_y_size = dst_width * dst_height; int dst_i420_y_size = dst_width * dst_height;
int dst_i420_uv_size = ((dst_width + 1) / 2) * ((dst_height + 1) / 2); int dst_i420_uv_size = ((dst_width + 1) / 2) * ((dst_height + 1) / 2);
int dst_i420_size = dst_i420_y_size + dst_i420_uv_size * 2; int dst_i420_size = dst_i420_y_size + dst_i420_uv_size * 2;
align_buffer_64(dst_i420_c, dst_i420_size); align_buffer_page_end(dst_i420_c, dst_i420_size);
align_buffer_64(dst_i420_opt, dst_i420_size); align_buffer_page_end(dst_i420_opt, dst_i420_size);
memset(dst_i420_c, 2, dst_i420_size); memset(dst_i420_c, 2, dst_i420_size);
memset(dst_i420_opt, 3, dst_i420_size); memset(dst_i420_opt, 3, dst_i420_size);
...@@ -201,9 +200,9 @@ static void NV12TestRotate(int src_width, int src_height, ...@@ -201,9 +200,9 @@ static void NV12TestRotate(int src_width, int src_height,
EXPECT_EQ(dst_i420_c[i], dst_i420_opt[i]); EXPECT_EQ(dst_i420_c[i], dst_i420_opt[i]);
} }
free_aligned_buffer_64(dst_i420_c); free_aligned_buffer_page_end(dst_i420_c);
free_aligned_buffer_64(dst_i420_opt); free_aligned_buffer_page_end(dst_i420_opt);
free_aligned_buffer_64(src_nv12); free_aligned_buffer_page_end(src_nv12);
} }
TEST_F(LibYUVRotateTest, NV12Rotate0_Opt) { TEST_F(LibYUVRotateTest, NV12Rotate0_Opt) {
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "libyuv/convert_argb.h" #include "libyuv/convert_argb.h"
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/row.h" // For align_buffer_64
#include "libyuv/scale_argb.h" #include "libyuv/scale_argb.h"
#include "libyuv/video_common.h" #include "libyuv/video_common.h"
#include "../unit_test/unit_test.h" #include "../unit_test/unit_test.h"
...@@ -156,7 +155,7 @@ static int ARGBClipTestFilter(int src_width, int src_height, ...@@ -156,7 +155,7 @@ static int ARGBClipTestFilter(int src_width, int src_height,
(Abs(src_height) + b * 2) * 4; (Abs(src_height) + b * 2) * 4;
int src_stride_argb = (b * 2 + Abs(src_width)) * 4; int src_stride_argb = (b * 2 + Abs(src_width)) * 4;
align_buffer_64(src_argb, src_argb_plane_size); align_buffer_page_end(src_argb, src_argb_plane_size);
if (!src_argb) { if (!src_argb) {
printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
return 0; return 0;
...@@ -173,8 +172,8 @@ static int ARGBClipTestFilter(int src_width, int src_height, ...@@ -173,8 +172,8 @@ static int ARGBClipTestFilter(int src_width, int src_height,
} }
} }
align_buffer_64(dst_argb_c, dst_argb_plane_size); align_buffer_page_end(dst_argb_c, dst_argb_plane_size);
align_buffer_64(dst_argb_opt, dst_argb_plane_size); align_buffer_page_end(dst_argb_opt, dst_argb_plane_size);
if (!dst_argb_c || !dst_argb_opt) { if (!dst_argb_c || !dst_argb_opt) {
printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
return 0; return 0;
...@@ -216,9 +215,9 @@ static int ARGBClipTestFilter(int src_width, int src_height, ...@@ -216,9 +215,9 @@ static int ARGBClipTestFilter(int src_width, int src_height,
} }
} }
free_aligned_buffer_64(dst_argb_c); free_aligned_buffer_page_end(dst_argb_c);
free_aligned_buffer_64(dst_argb_opt); free_aligned_buffer_page_end(dst_argb_opt);
free_aligned_buffer_64(src_argb); free_aligned_buffer_page_end(src_argb);
return max_diff; return max_diff;
} }
...@@ -322,8 +321,7 @@ int YUVToARGBScaleReference2(const uint8* src_y, int src_stride_y, ...@@ -322,8 +321,7 @@ int YUVToARGBScaleReference2(const uint8* src_y, int src_stride_y,
int clip_x, int clip_y, int clip_x, int clip_y,
int clip_width, int clip_height, int clip_width, int clip_height,
enum FilterMode filtering) { enum FilterMode filtering) {
uint8* argb_buffer = static_cast<uint8*>(malloc(src_width * src_height * 4));
uint8* argb_buffer = (uint8*)malloc(src_width * src_height * 4);
int r; int r;
I420ToARGB(src_y, src_stride_y, I420ToARGB(src_y, src_stride_y,
src_u, src_stride_u, src_u, src_stride_u,
......
...@@ -91,6 +91,16 @@ static inline double get_time() { ...@@ -91,6 +91,16 @@ static inline double get_time() {
} }
#endif #endif
#ifndef SIMD_ALIGNED
#if defined(_MSC_VER) && !defined(__CLR_VER)
#define SIMD_ALIGNED(var) __declspec(align(16)) var
#elif defined(__GNUC__) && !defined(__pnacl__)
#define SIMD_ALIGNED(var) var __attribute__((aligned(16)))
#else
#define SIMD_ALIGNED(var) var
#endif
#endif
extern unsigned int fastrand_seed; extern unsigned int fastrand_seed;
inline int fastrand() { inline int fastrand() {
fastrand_seed = fastrand_seed * 214013u + 2531011u; fastrand_seed = fastrand_seed * 214013u + 2531011u;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment