Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
9303d428
Commit
9303d428
authored
Jul 07, 2016
by
Debargha Mukherjee
Committed by
Gerrit Code Review
Jul 07, 2016
Browse files
Merge "Add tests for vpx_sum_squares_i16." into nextgenv2
parents
c7a92f2c
471362f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/sum_squares_test.cc
View file @
9303d428
...
...
@@ -21,13 +21,16 @@
#include
"test/clear_system_state.h"
#include
"test/register_state_check.h"
#include
"test/util.h"
#include
"test/function_equivalence_test.h"
using
libvpx_test
::
ACMRandom
;
using
libvpx_test
::
FunctionEquivalenceTest
;
namespace
{
const
int
kNumIterations
=
10000
;
static
const
int16_t
kInt13Max
=
(
1
<<
12
)
-
1
;
typedef
uint64_t
(
*
SSI16Func
)(
const
int16_t
*
src
,
int
stride
,
int
size
);
...
...
@@ -130,4 +133,70 @@ INSTANTIATE_TEST_CASE_P(
)
);
#endif // HAVE_SSE2
//////////////////////////////////////////////////////////////////////////////
// 1D version
//////////////////////////////////////////////////////////////////////////////
typedef
uint64_t
(
*
F1D
)(
const
int16_t
*
src
,
uint32_t
N
);
class
SumSquares1DTest
:
public
FunctionEquivalenceTest
<
F1D
>
{
protected:
SumSquares1DTest
()
:
rng_
(
ACMRandom
::
DeterministicSeed
())
{}
static
const
int
kIterations
=
1000
;
static
const
int
kMaxSize
=
256
;
ACMRandom
rng_
;
};
TEST_P
(
SumSquares1DTest
,
RandomValues
)
{
DECLARE_ALIGNED
(
16
,
int16_t
,
src
[
kMaxSize
*
kMaxSize
]);
for
(
int
iter
=
0
;
iter
<
kIterations
&&
!
HasFatalFailure
();
++
iter
)
{
for
(
int
i
=
0
;
i
<
kMaxSize
*
kMaxSize
;
++
i
)
src
[
i
]
=
rng_
(
kInt13Max
*
2
+
1
)
-
kInt13Max
;
const
int
N
=
rng_
(
2
)
?
rng_
(
kMaxSize
*
kMaxSize
+
1
-
kMaxSize
)
+
kMaxSize
:
rng_
(
kMaxSize
)
+
1
;
const
uint64_t
ref_res
=
ref_func_
(
src
,
N
);
const
uint64_t
tst_res
=
tst_func_
(
src
,
N
);
ASSERT_EQ
(
ref_res
,
tst_res
);
}
}
TEST_P
(
SumSquares1DTest
,
ExtremeValues
)
{
DECLARE_ALIGNED
(
16
,
int16_t
,
src
[
kMaxSize
*
kMaxSize
]);
for
(
int
iter
=
0
;
iter
<
kIterations
&&
!
HasFatalFailure
();
++
iter
)
{
if
(
rng_
(
2
))
{
for
(
int
i
=
0
;
i
<
kMaxSize
*
kMaxSize
;
++
i
)
src
[
i
]
=
kInt13Max
;
}
else
{
for
(
int
i
=
0
;
i
<
kMaxSize
*
kMaxSize
;
++
i
)
src
[
i
]
=
-
kInt13Max
;
}
const
int
N
=
rng_
(
2
)
?
rng_
(
kMaxSize
*
kMaxSize
+
1
-
kMaxSize
)
+
kMaxSize
:
rng_
(
kMaxSize
)
+
1
;
const
uint64_t
ref_res
=
ref_func_
(
src
,
N
);
const
uint64_t
tst_res
=
tst_func_
(
src
,
N
);
ASSERT_EQ
(
ref_res
,
tst_res
);
}
}
using
std
::
tr1
::
make_tuple
;
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P
(
SSE2
,
SumSquares1DTest
,
::
testing
::
Values
(
make_tuple
(
&
vpx_sum_squares_i16_c
,
&
vpx_sum_squares_i16_sse2
)
)
);
#endif // HAVE_SSE2
}
// namespace
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment