mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
ARGBBlend unaligned unittest
BUG=160 TEST=libyuvTest.ARGBBlend_Unaligned Review URL: https://webrtc-codereview.appspot.com/935019 git-svn-id: http://libyuv.googlecode.com/svn/trunk@498 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
b5491759b4
commit
dd3b137f5d
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 496
|
||||
Version: 497
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 496
|
||||
#define LIBYUV_VERSION 497
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -3580,8 +3580,8 @@ void ARGBBlendRow_SSSE3(const uint8* src_argb0, const uint8* src_argb1,
|
||||
|
||||
// 1 pixel loop until destination pointer is aligned.
|
||||
alignloop1:
|
||||
// test edx, 15 // aligned?
|
||||
// je alignloop1b
|
||||
test edx, 15 // aligned?
|
||||
je alignloop1b
|
||||
movd xmm3, [eax]
|
||||
lea eax, [eax + 4]
|
||||
movdqa xmm0, xmm3 // src argb
|
||||
|
||||
@ -786,7 +786,7 @@ TEST_F(libyuvTest, FMT_A##To##FMT_B##_Random) { \
|
||||
FMT_B, BPP_B, STRIDE_B, HEIGHT_B, DIFF) \
|
||||
TESTATOBI(FMT_A, BPP_A, STRIDE_A, \
|
||||
FMT_B, BPP_B, STRIDE_B, \
|
||||
benchmark_width_, DIFF, _Any, +, 0) \
|
||||
benchmark_width_ - 4, DIFF, _Any, +, 0) \
|
||||
TESTATOBI(FMT_A, BPP_A, STRIDE_A, \
|
||||
FMT_B, BPP_B, STRIDE_B, \
|
||||
benchmark_width_, DIFF, _Unaligned, +, 1) \
|
||||
|
||||
@ -646,42 +646,44 @@ TESTINTERPOLATE(128)
|
||||
TESTINTERPOLATE(192)
|
||||
TESTINTERPOLATE(255)
|
||||
|
||||
static int TestBlend(int kWidth, int kHeight, int benchmark_iterations,
|
||||
int NEG, int OFF) {
|
||||
static int TestBlend(int width, int height, int benchmark_iterations,
|
||||
int invert, int off) {
|
||||
const int BPP_A = 4;
|
||||
const int STRIDE_A = 1;
|
||||
const int BPP_B = 4;
|
||||
const int STRIDE_B = 1;
|
||||
const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A;
|
||||
const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B;
|
||||
align_buffer_64(src_argb_a, kStrideA * kHeight + OFF);
|
||||
align_buffer_64(src_argb_b, kStrideA * kHeight + OFF);
|
||||
align_buffer_64(dst_argb_c, kStrideB * kHeight);
|
||||
align_buffer_64(dst_argb_opt, kStrideB * kHeight);
|
||||
const int kStrideA = (width * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A;
|
||||
const int kStrideB = (width * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B;
|
||||
align_buffer_64(src_argb_a, kStrideA * height + off);
|
||||
align_buffer_64(src_argb_b, kStrideA * height + off);
|
||||
align_buffer_64(dst_argb_c, kStrideB * height);
|
||||
align_buffer_64(dst_argb_opt, kStrideB * height);
|
||||
srandom(time(NULL));
|
||||
for (int i = 0; i < kStrideA * kHeight; ++i) {
|
||||
src_argb_a[i + OFF] = (random() & 0xff);
|
||||
src_argb_b[i + OFF] = (random() & 0xff);
|
||||
for (int i = 0; i < kStrideA * height; ++i) {
|
||||
src_argb_a[i + off] = (random() & 0xff);
|
||||
src_argb_b[i + off] = (random() & 0xff);
|
||||
}
|
||||
ARGBAttenuate(src_argb_a, kStrideA, src_argb_a, kStrideA, kWidth, kHeight);
|
||||
ARGBAttenuate(src_argb_b, kStrideA, src_argb_b, kStrideA, kWidth, kHeight);
|
||||
memset(dst_argb_c, 255, kStrideB * kHeight);
|
||||
memset(dst_argb_opt, 255, kStrideB * kHeight);
|
||||
ARGBAttenuate(src_argb_a + off, kStrideA, src_argb_a + off, kStrideA, width,
|
||||
height);
|
||||
ARGBAttenuate(src_argb_b + off, kStrideA, src_argb_b + off, kStrideA, width,
|
||||
height);
|
||||
memset(dst_argb_c, 255, kStrideB * height);
|
||||
memset(dst_argb_opt, 255, kStrideB * height);
|
||||
|
||||
MaskCpuFlags(0);
|
||||
ARGBBlend(src_argb_a + OFF, kStrideA,
|
||||
src_argb_b + OFF, kStrideA,
|
||||
ARGBBlend(src_argb_a + off, kStrideA,
|
||||
src_argb_b + off, kStrideA,
|
||||
dst_argb_c, kStrideB,
|
||||
kWidth, NEG * kHeight);
|
||||
width, invert * height);
|
||||
MaskCpuFlags(-1);
|
||||
for (int i = 0; i < benchmark_iterations; ++i) {
|
||||
ARGBBlend(src_argb_a + OFF, kStrideA,
|
||||
src_argb_b + OFF, kStrideA,
|
||||
ARGBBlend(src_argb_a + off, kStrideA,
|
||||
src_argb_b + off, kStrideA,
|
||||
dst_argb_opt, kStrideB,
|
||||
kWidth, NEG * kHeight);
|
||||
width, invert * height);
|
||||
}
|
||||
int max_diff = 0;
|
||||
for (int i = 0; i < kStrideB * kHeight; ++i) {
|
||||
for (int i = 0; i < kStrideB * height; ++i) {
|
||||
int abs_diff =
|
||||
abs(static_cast<int>(dst_argb_c[i]) -
|
||||
static_cast<int>(dst_argb_opt[i]));
|
||||
@ -702,12 +704,11 @@ TEST_F(libyuvTest, ARGBBlend_Any) {
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
// TODO(fbarchard): Enable unaligned blend test.
|
||||
// TEST_F(libyuvTest, ARGBBlend_Unaligned) {
|
||||
// int max_diff = TestBlend(benchmark_width_, benchmark_height_,
|
||||
// benchmark_iterations_, +1, 1);
|
||||
// EXPECT_LE(max_diff, 1);
|
||||
// }
|
||||
TEST_F(libyuvTest, ARGBBlend_Unaligned) {
|
||||
int max_diff = TestBlend(benchmark_width_, benchmark_height_,
|
||||
benchmark_iterations_, +1, 1);
|
||||
EXPECT_LE(max_diff, 1);
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, ARGBBlend_Invert) {
|
||||
int max_diff = TestBlend(benchmark_width_, benchmark_height_,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user