Skip to content
GitLab
Menu
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
ea74959b
Commit
ea74959b
authored
Aug 12, 2016
by
James Zern
Committed by
Gerrit Code Review
Aug 12, 2016
Browse files
Merge "test/: apply clang-format" into nextgenv2
parents
79fa2f6e
3a826f1d
Changes
91
Expand all
Hide whitespace changes
Inline
Side-by-side
test/acm_random.h
View file @
ea74959b
...
...
@@ -23,9 +23,7 @@ class ACMRandom {
explicit
ACMRandom
(
int
seed
)
:
random_
(
seed
)
{}
void
Reset
(
int
seed
)
{
random_
.
Reseed
(
seed
);
}
void
Reset
(
int
seed
)
{
random_
.
Reseed
(
seed
);
}
uint16_t
Rand16
(
void
)
{
const
uint32_t
value
=
random_
.
Generate
(
testing
::
internal
::
Random
::
kMaxRange
);
...
...
@@ -52,17 +50,11 @@ class ACMRandom {
return
r
<
128
?
r
<<
4
:
r
>>
4
;
}
int
PseudoUniform
(
int
range
)
{
return
random_
.
Generate
(
range
);
}
int
PseudoUniform
(
int
range
)
{
return
random_
.
Generate
(
range
);
}
int
operator
()(
int
n
)
{
return
PseudoUniform
(
n
);
}
int
operator
()(
int
n
)
{
return
PseudoUniform
(
n
);
}
static
int
DeterministicSeed
(
void
)
{
return
0xbaba
;
}
static
int
DeterministicSeed
(
void
)
{
return
0xbaba
;
}
private:
testing
::
internal
::
Random
random_
;
...
...
test/active_map_refresh_test.cc
View file @
ea74959b
...
...
@@ -17,8 +17,8 @@
namespace
{
// Check if any pixel in a 16x16 macroblock varies between frames.
int
CheckMb
(
const
vpx_image_t
&
current
,
const
vpx_image_t
&
previous
,
int
mb_r
,
int
mb_c
)
{
int
CheckMb
(
const
vpx_image_t
&
current
,
const
vpx_image_t
&
previous
,
int
mb_r
,
int
mb_c
)
{
for
(
int
plane
=
0
;
plane
<
3
;
plane
++
)
{
int
r
=
16
*
mb_r
;
int
c0
=
16
*
mb_c
;
...
...
test/active_map_test.cc
View file @
ea74959b
...
...
@@ -39,6 +39,7 @@ class ActiveMapTest
encoder
->
Control
(
VP8E_SET_CPUUSED
,
cpu_used_
);
}
else
if
(
video
->
frame
()
==
3
)
{
vpx_active_map_t
map
=
vpx_active_map_t
();
/* clang-format off */
uint8_t
active_map
[
9
*
13
]
=
{
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
...
...
@@ -50,6 +51,7 @@ class ActiveMapTest
0
,
0
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
1
,
0
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
1
,
1
,
0
,
};
/* clang-format on */
map
.
cols
=
(
kWidth
+
15
)
/
16
;
map
.
rows
=
(
kHeight
+
15
)
/
16
;
ASSERT_EQ
(
map
.
cols
,
13u
);
...
...
@@ -82,15 +84,11 @@ class ActiveMapTest
int
cpu_used_
;
};
TEST_P
(
ActiveMapTest
,
Test
)
{
DoTest
();
}
TEST_P
(
ActiveMapTest
,
Test
)
{
DoTest
();
}
class
ActiveMapTestLarge
:
public
ActiveMapTest
{};
TEST_P
(
ActiveMapTestLarge
,
Test
)
{
DoTest
();
}
TEST_P
(
ActiveMapTestLarge
,
Test
)
{
DoTest
();
}
VP10_INSTANTIATE_TEST_CASE
(
ActiveMapTestLarge
,
::
testing
::
Values
(
::
libvpx_test
::
kRealTime
),
...
...
test/add_noise_test.cc
View file @
ea74959b
...
...
@@ -24,12 +24,9 @@ typedef void (*AddNoiseFunc)(unsigned char *start, char *noise,
char
bothclamp
[
16
],
unsigned
int
width
,
unsigned
int
height
,
int
pitch
);
class
AddNoiseTest
:
public
::
testing
::
TestWithParam
<
AddNoiseFunc
>
{
class
AddNoiseTest
:
public
::
testing
::
TestWithParam
<
AddNoiseFunc
>
{
public:
virtual
void
TearDown
()
{
libvpx_test
::
ClearSystemState
();
}
virtual
void
TearDown
()
{
libvpx_test
::
ClearSystemState
();
}
virtual
~
AddNoiseTest
()
{}
};
...
...
@@ -45,7 +42,7 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) {
DECLARE_ALIGNED
(
16
,
char
,
blackclamp
[
16
]);
DECLARE_ALIGNED
(
16
,
char
,
whiteclamp
[
16
]);
DECLARE_ALIGNED
(
16
,
char
,
bothclamp
[
16
]);
const
int
width
=
64
;
const
int
width
=
64
;
const
int
height
=
64
;
const
int
image_size
=
width
*
height
;
char
noise
[
3072
];
...
...
@@ -105,7 +102,7 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) {
DECLARE_ALIGNED
(
16
,
char
,
blackclamp
[
16
]);
DECLARE_ALIGNED
(
16
,
char
,
whiteclamp
[
16
]);
DECLARE_ALIGNED
(
16
,
char
,
bothclamp
[
16
]);
const
int
width
=
64
;
const
int
width
=
64
;
const
int
height
=
64
;
const
int
image_size
=
width
*
height
;
char
noise
[
3072
];
...
...
@@ -128,9 +125,8 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) {
ASM_REGISTER_STATE_CHECK
(
GetParam
()(
s
,
noise
,
blackclamp
,
whiteclamp
,
bothclamp
,
width
,
height
,
width
));
srand
(
0
);
ASM_REGISTER_STATE_CHECK
(
vpx_plane_add_noise_c
(
d
,
noise
,
blackclamp
,
whiteclamp
,
bothclamp
,
width
,
height
,
width
));
ASM_REGISTER_STATE_CHECK
(
vpx_plane_add_noise_c
(
d
,
noise
,
blackclamp
,
whiteclamp
,
bothclamp
,
width
,
height
,
width
));
for
(
int
i
=
0
;
i
<
image_size
;
++
i
)
{
EXPECT_EQ
(
static_cast
<
int
>
(
s
[
i
]),
static_cast
<
int
>
(
d
[
i
]))
<<
"i = "
<<
i
;
...
...
test/altref_test.cc
View file @
ea74959b
...
...
@@ -19,11 +19,8 @@ class AltRefForcedKeyTestLarge
public
::
libvpx_test
::
CodecTestWith2Params
<
libvpx_test
::
TestMode
,
int
>
{
protected:
AltRefForcedKeyTestLarge
()
:
EncoderTest
(
GET_PARAM
(
0
)),
encoding_mode_
(
GET_PARAM
(
1
)),
cpu_used_
(
GET_PARAM
(
2
)),
forced_kf_frame_num_
(
1
),
frame_num_
(
0
)
{}
:
EncoderTest
(
GET_PARAM
(
0
)),
encoding_mode_
(
GET_PARAM
(
1
)),
cpu_used_
(
GET_PARAM
(
2
)),
forced_kf_frame_num_
(
1
),
frame_num_
(
0
)
{}
virtual
~
AltRefForcedKeyTestLarge
()
{}
virtual
void
SetUp
()
{
...
...
@@ -38,8 +35,8 @@ class AltRefForcedKeyTestLarge
if
(
video
->
frame
()
==
0
)
{
encoder
->
Control
(
VP8E_SET_CPUUSED
,
cpu_used_
);
encoder
->
Control
(
VP8E_SET_ENABLEAUTOALTREF
,
1
);
// override test default for tile columns if necessary.
#if CONFIG_VP10_ENCODER
// override test default for tile columns if necessary.
if
(
GET_PARAM
(
0
)
==
&
libvpx_test
::
kVP10
)
{
encoder
->
Control
(
VP9E_SET_TILE_COLUMNS
,
6
);
}
...
...
@@ -91,9 +88,8 @@ TEST_P(AltRefForcedKeyTestLarge, ForcedFrameIsKey) {
}
}
VP10_INSTANTIATE_TEST_CASE
(
AltRefForcedKeyTestLarge
,
::
testing
::
Values
(
::
libvpx_test
::
kOnePassGood
),
::
testing
::
Range
(
0
,
9
));
VP10_INSTANTIATE_TEST_CASE
(
AltRefForcedKeyTestLarge
,
::
testing
::
Values
(
::
libvpx_test
::
kOnePassGood
),
::
testing
::
Range
(
0
,
9
));
}
// namespace
test/aq_segment_test.cc
View file @
ea74959b
...
...
@@ -49,8 +49,8 @@ class AqSegmentTest
cfg_
.
rc_buf_optimal_sz
=
500
;
cfg_
.
rc_buf_sz
=
1000
;
cfg_
.
rc_target_bitrate
=
300
;
::
libvpx_test
::
I420VideoSource
video
(
"hantro_collage_w352h288.yuv"
,
352
,
288
,
30
,
1
,
0
,
15
);
::
libvpx_test
::
I420VideoSource
video
(
"hantro_collage_w352h288.yuv"
,
352
,
288
,
30
,
1
,
0
,
15
);
ASSERT_NO_FATAL_FAILURE
(
RunLoop
(
&
video
));
}
...
...
@@ -60,36 +60,23 @@ class AqSegmentTest
// Validate that this AQ segmentation mode (AQ=1, variance_ap)
// encodes and decodes without a mismatch.
TEST_P
(
AqSegmentTest
,
TestNoMisMatchAQ1
)
{
DoTest
(
1
);
}
TEST_P
(
AqSegmentTest
,
TestNoMisMatchAQ1
)
{
DoTest
(
1
);
}
// Validate that this AQ segmentation mode (AQ=2, complexity_aq)
// encodes and decodes without a mismatch.
TEST_P
(
AqSegmentTest
,
TestNoMisMatchAQ2
)
{
DoTest
(
2
);
}
TEST_P
(
AqSegmentTest
,
TestNoMisMatchAQ2
)
{
DoTest
(
2
);
}
// Validate that this AQ segmentation mode (AQ=3, cyclic_refresh_aq)
// encodes and decodes without a mismatch.
TEST_P
(
AqSegmentTest
,
TestNoMisMatchAQ3
)
{
DoTest
(
3
);
}
TEST_P
(
AqSegmentTest
,
TestNoMisMatchAQ3
)
{
DoTest
(
3
);
}
class
AqSegmentTestLarge
:
public
AqSegmentTest
{};
TEST_P
(
AqSegmentTestLarge
,
TestNoMisMatchAQ1
)
{
DoTest
(
1
);
}
TEST_P
(
AqSegmentTestLarge
,
TestNoMisMatchAQ1
)
{
DoTest
(
1
);
}
TEST_P
(
AqSegmentTestLarge
,
TestNoMisMatchAQ2
)
{
DoTest
(
2
);
}
TEST_P
(
AqSegmentTestLarge
,
TestNoMisMatchAQ3
)
{
DoTest
(
3
);
}
TEST_P
(
AqSegmentTestLarge
,
TestNoMisMatchAQ2
)
{
DoTest
(
2
);
}
TEST_P
(
AqSegmentTestLarge
,
TestNoMisMatchAQ3
)
{
DoTest
(
3
);
}
VP10_INSTANTIATE_TEST_CASE
(
AqSegmentTest
,
::
testing
::
Values
(
::
libvpx_test
::
kRealTime
,
...
...
test/arf_freq_test.cc
View file @
ea74959b
...
...
@@ -22,8 +22,8 @@ namespace {
const
unsigned
int
kFrames
=
100
;
const
int
kBitrate
=
500
;
#define ARF_NOT_SEEN
1000001
#define ARF_SEEN_ONCE
1000000
#define ARF_NOT_SEEN 1000001
#define ARF_SEEN_ONCE 1000000
typedef
struct
{
const
char
*
filename
;
...
...
@@ -44,24 +44,20 @@ typedef struct {
const
TestVideoParam
kTestVectors
[]
=
{
// artificially increase framerate to trigger default check
{
"hantro_collage_w352h288.yuv"
,
352
,
288
,
5000
,
1
,
8
,
VPX_IMG_FMT_I420
,
VPX_BITS_8
,
0
},
{
"hantro_collage_w352h288.yuv"
,
352
,
288
,
30
,
1
,
8
,
VPX_IMG_FMT_I420
,
VPX_BITS_8
,
0
},
{
"rush_hour_444.y4m"
,
352
,
288
,
30
,
1
,
8
,
VPX_IMG_FMT_I444
,
VPX_BITS_8
,
1
},
{
"hantro_collage_w352h288.yuv"
,
352
,
288
,
5000
,
1
,
8
,
VPX_IMG_FMT_I420
,
VPX_BITS_8
,
0
},
{
"hantro_collage_w352h288.yuv"
,
352
,
288
,
30
,
1
,
8
,
VPX_IMG_FMT_I420
,
VPX_BITS_8
,
0
},
{
"rush_hour_444.y4m"
,
352
,
288
,
30
,
1
,
8
,
VPX_IMG_FMT_I444
,
VPX_BITS_8
,
1
},
#if CONFIG_VP9_HIGHBITDEPTH
// Add list of profile 2/3 test videos here ...
// Add list of profile 2/3 test videos here ...
#endif // CONFIG_VP9_HIGHBITDEPTH
};
const
TestEncodeParam
kEncodeVectors
[]
=
{
{
::
libvpx_test
::
kOnePassGood
,
2
},
{
::
libvpx_test
::
kOnePassGood
,
5
},
{
::
libvpx_test
::
kTwoPassGood
,
1
},
{
::
libvpx_test
::
kTwoPassGood
,
2
},
{
::
libvpx_test
::
kTwoPassGood
,
5
},
{
::
libvpx_test
::
kRealTime
,
5
},
{
::
libvpx_test
::
kOnePassGood
,
2
},
{
::
libvpx_test
::
kOnePassGood
,
5
},
{
::
libvpx_test
::
kTwoPassGood
,
1
},
{
::
libvpx_test
::
kTwoPassGood
,
2
},
{
::
libvpx_test
::
kTwoPassGood
,
5
},
{
::
libvpx_test
::
kRealTime
,
5
},
};
const
int
kMinArfVectors
[]
=
{
...
...
@@ -80,15 +76,12 @@ int is_extension_y4m(const char *filename) {
class
ArfFreqTestLarge
:
public
::
libvpx_test
::
EncoderTest
,
public
::
libvpx_test
::
CodecTestWith3Params
<
TestVideoParam
,
\
public
::
libvpx_test
::
CodecTestWith3Params
<
TestVideoParam
,
TestEncodeParam
,
int
>
{
protected:
ArfFreqTestLarge
()
:
EncoderTest
(
GET_PARAM
(
0
)),
test_video_param_
(
GET_PARAM
(
1
)),
test_encode_param_
(
GET_PARAM
(
2
)),
min_arf_requested_
(
GET_PARAM
(
3
))
{
}
:
EncoderTest
(
GET_PARAM
(
0
)),
test_video_param_
(
GET_PARAM
(
1
)),
test_encode_param_
(
GET_PARAM
(
2
)),
min_arf_requested_
(
GET_PARAM
(
3
))
{}
virtual
~
ArfFreqTestLarge
()
{}
...
...
@@ -114,17 +107,16 @@ class ArfFreqTestLarge
}
int
GetNumFramesInPkt
(
const
vpx_codec_cx_pkt_t
*
pkt
)
{
const
uint8_t
*
buffer
=
reinterpret_cast
<
uint8_t
*>
(
pkt
->
data
.
frame
.
buf
);
const
uint8_t
*
buffer
=
reinterpret_cast
<
uint8_t
*>
(
pkt
->
data
.
frame
.
buf
);
const
uint8_t
marker
=
buffer
[
pkt
->
data
.
frame
.
sz
-
1
];
const
int
mag
=
((
marker
>>
3
)
&
3
)
+
1
;
int
frames
=
(
marker
&
0x7
)
+
1
;
const
unsigned
int
index_sz
=
2
+
mag
*
frames
;
const
unsigned
int
index_sz
=
2
+
mag
*
frames
;
// Check for superframe or not.
// Assume superframe has only one visible frame, the rest being
// invisible. If superframe index is not found, then there is only
// one frame.
if
(
!
((
marker
&
0xe0
)
==
0xc0
&&
pkt
->
data
.
frame
.
sz
>=
index_sz
&&
if
(
!
((
marker
&
0xe0
)
==
0xc0
&&
pkt
->
data
.
frame
.
sz
>=
index_sz
&&
buffer
[
pkt
->
data
.
frame
.
sz
-
index_sz
]
==
marker
))
{
frames
=
1
;
}
...
...
@@ -132,8 +124,7 @@ class ArfFreqTestLarge
}
virtual
void
FramePktHook
(
const
vpx_codec_cx_pkt_t
*
pkt
)
{
if
(
pkt
->
kind
!=
VPX_CODEC_CX_FRAME_PKT
)
return
;
if
(
pkt
->
kind
!=
VPX_CODEC_CX_FRAME_PKT
)
return
;
const
int
frames
=
GetNumFramesInPkt
(
pkt
);
if
(
frames
==
1
)
{
run_of_visible_frames_
++
;
...
...
@@ -167,9 +158,7 @@ class ArfFreqTestLarge
}
}
int
GetMinVisibleRun
()
const
{
return
min_run_
;
}
int
GetMinVisibleRun
()
const
{
return
min_run_
;
}
int
GetMinArfDistanceRequested
()
const
{
if
(
min_arf_requested_
)
...
...
@@ -178,7 +167,7 @@ class ArfFreqTestLarge
return
vp10_rc_get_default_min_gf_interval
(
test_video_param_
.
width
,
test_video_param_
.
height
,
(
double
)
test_video_param_
.
framerate_num
/
test_video_param_
.
framerate_den
);
test_video_param_
.
framerate_den
);
}
TestVideoParam
test_video_param_
;
...
...
@@ -197,21 +186,18 @@ TEST_P(ArfFreqTestLarge, MinArfFreqTest) {
cfg_
.
g_input_bit_depth
=
test_video_param_
.
input_bit_depth
;
cfg_
.
g_bit_depth
=
test_video_param_
.
bit_depth
;
init_flags_
=
VPX_CODEC_USE_PSNR
;
if
(
cfg_
.
g_bit_depth
>
8
)
init_flags_
|=
VPX_CODEC_USE_HIGHBITDEPTH
;
if
(
cfg_
.
g_bit_depth
>
8
)
init_flags_
|=
VPX_CODEC_USE_HIGHBITDEPTH
;
testing
::
internal
::
scoped_ptr
<
libvpx_test
::
VideoSource
>
video
;
if
(
is_extension_y4m
(
test_video_param_
.
filename
))
{
video
.
reset
(
new
libvpx_test
::
Y4mVideoSource
(
test_video_param_
.
filename
,
0
,
kFrames
));
video
.
reset
(
new
libvpx_test
::
Y4mVideoSource
(
test_video_param_
.
filename
,
0
,
kFrames
));
}
else
{
video
.
reset
(
new
libvpx_test
::
YUVVideoSource
(
test_video_param_
.
filename
,
test_video_param_
.
fmt
,
test_video_param_
.
width
,
test_video_param_
.
height
,
test_video_param_
.
framerate_num
,
test_video_param_
.
framerate_den
,
0
,
kFrames
));
video
.
reset
(
new
libvpx_test
::
YUVVideoSource
(
test_video_param_
.
filename
,
test_video_param_
.
fmt
,
test_video_param_
.
width
,
test_video_param_
.
height
,
test_video_param_
.
framerate_num
,
test_video_param_
.
framerate_den
,
0
,
kFrames
));
}
ASSERT_NO_FATAL_FAILURE
(
RunLoop
(
video
.
get
()));
...
...
@@ -235,15 +221,12 @@ INSTANTIATE_TEST_CASE_P(
::
testing
::
Combine
(
::
testing
::
Values
(
static_cast
<
const
libvpx_test
::
CodecFactory
*>
(
&
libvpx_test
::
kVP10
)),
::
testing
::
ValuesIn
(
kTestVectors
),
::
testing
::
ValuesIn
(
kEncodeVectors
),
::
testing
::
ValuesIn
(
kTestVectors
),
::
testing
::
ValuesIn
(
kEncodeVectors
),
::
testing
::
ValuesIn
(
kMinArfVectors
)));
#endif // CONFIG_VP10_ENCODER
#else
VP10_INSTANTIATE_TEST_CASE
(
ArfFreqTestLarge
,
::
testing
::
ValuesIn
(
kTestVectors
),
::
testing
::
ValuesIn
(
kEncodeVectors
),
::
testing
::
ValuesIn
(
kMinArfVectors
));
VP10_INSTANTIATE_TEST_CASE
(
ArfFreqTestLarge
,
::
testing
::
ValuesIn
(
kTestVectors
),
::
testing
::
ValuesIn
(
kEncodeVectors
),
::
testing
::
ValuesIn
(
kMinArfVectors
));
#endif // CONFIG_VP9_HIGHBITDEPTH || CONFIG_EXT_REFS
}
// namespace
test/avg_test.cc
View file @
ea74959b
...
...
@@ -31,7 +31,7 @@ class AverageTestBase : public ::testing::Test {
AverageTestBase
(
int
width
,
int
height
)
:
width_
(
width
),
height_
(
height
)
{}
static
void
SetUpTestCase
()
{
source_data_
=
reinterpret_cast
<
uint8_t
*>
(
source_data_
=
reinterpret_cast
<
uint8_t
*>
(
vpx_memalign
(
kDataAlignment
,
kDataBlockSize
));
}
...
...
@@ -40,9 +40,7 @@ class AverageTestBase : public ::testing::Test {
source_data_
=
NULL
;
}
virtual
void
TearDown
()
{
libvpx_test
::
ClearSystemState
();
}
virtual
void
TearDown
()
{
libvpx_test
::
ClearSystemState
();
}
protected:
// Handle blocks up to 4 blocks 64x64 with stride up to 128
...
...
@@ -55,47 +53,44 @@ class AverageTestBase : public ::testing::Test {
}
// Sum Pixels
unsigned
int
ReferenceAverage8x8
(
const
uint8_t
*
source
,
int
pitch
)
{
unsigned
int
ReferenceAverage8x8
(
const
uint8_t
*
source
,
int
pitch
)
{
unsigned
int
average
=
0
;
for
(
int
h
=
0
;
h
<
8
;
++
h
)
for
(
int
w
=
0
;
w
<
8
;
++
w
)
average
+=
source
[
h
*
pitch
+
w
];
for
(
int
w
=
0
;
w
<
8
;
++
w
)
average
+=
source
[
h
*
pitch
+
w
];
return
((
average
+
32
)
>>
6
);
}
unsigned
int
ReferenceAverage4x4
(
const
uint8_t
*
source
,
int
pitch
)
{
unsigned
int
ReferenceAverage4x4
(
const
uint8_t
*
source
,
int
pitch
)
{
unsigned
int
average
=
0
;
for
(
int
h
=
0
;
h
<
4
;
++
h
)
for
(
int
w
=
0
;
w
<
4
;
++
w
)
average
+=
source
[
h
*
pitch
+
w
];
for
(
int
w
=
0
;
w
<
4
;
++
w
)
average
+=
source
[
h
*
pitch
+
w
];
return
((
average
+
8
)
>>
4
);
}
void
FillConstant
(
uint8_t
fill_constant
)
{
for
(
int
i
=
0
;
i
<
width_
*
height_
;
++
i
)
{
source_data_
[
i
]
=
fill_constant
;
source_data_
[
i
]
=
fill_constant
;
}
}
void
FillRandom
()
{
for
(
int
i
=
0
;
i
<
width_
*
height_
;
++
i
)
{
source_data_
[
i
]
=
rnd_
.
Rand8
();
source_data_
[
i
]
=
rnd_
.
Rand8
();
}
}
int
width_
,
height_
;
static
uint8_t
*
source_data_
;
static
uint8_t
*
source_data_
;
int
source_stride_
;
ACMRandom
rnd_
;
};
typedef
unsigned
int
(
*
AverageFunction
)(
const
uint8_t
*
s
,
int
pitch
);
typedef
unsigned
int
(
*
AverageFunction
)(
const
uint8_t
*
s
,
int
pitch
);
typedef
std
::
tr1
::
tuple
<
int
,
int
,
int
,
int
,
AverageFunction
>
AvgFunc
;
class
AverageTest
:
public
AverageTestBase
,
public
::
testing
::
WithParamInterface
<
AvgFunc
>
{
class
AverageTest
:
public
AverageTestBase
,
public
::
testing
::
WithParamInterface
<
AvgFunc
>
{
public:
AverageTest
()
:
AverageTestBase
(
GET_PARAM
(
0
),
GET_PARAM
(
1
))
{}
...
...
@@ -103,17 +98,17 @@ class AverageTest
void
CheckAverages
()
{
unsigned
int
expected
=
0
;
if
(
GET_PARAM
(
3
)
==
8
)
{
expected
=
ReferenceAverage8x8
(
source_data_
+
GET_PARAM
(
2
),
source_stride_
);
}
else
if
(
GET_PARAM
(
3
)
==
4
)
{
expected
=
ReferenceAverage4x4
(
source_data_
+
GET_PARAM
(
2
),
source_stride_
);
expected
=
ReferenceAverage8x8
(
source_data_
+
GET_PARAM
(
2
),
source_stride_
);
}
else
if
(
GET_PARAM
(
3
)
==
4
)
{
expected
=
ReferenceAverage4x4
(
source_data_
+
GET_PARAM
(
2
),
source_stride_
);
}
ASM_REGISTER_STATE_CHECK
(
GET_PARAM
(
4
)(
source_data_
+
GET_PARAM
(
2
),
source_stride_
));
unsigned
int
actual
=
GET_PARAM
(
4
)(
source_data_
+
GET_PARAM
(
2
),
source_stride_
);
ASM_REGISTER_STATE_CHECK
(
GET_PARAM
(
4
)(
source_data_
+
GET_PARAM
(
2
),
source_stride_
));
unsigned
int
actual
=
GET_PARAM
(
4
)(
source_data_
+
GET_PARAM
(
2
),
source_stride_
);
EXPECT_EQ
(
expected
,
actual
);
}
...
...
@@ -124,23 +119,20 @@ typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref,
typedef
std
::
tr1
::
tuple
<
int
,
IntProRowFunc
,
IntProRowFunc
>
IntProRowParam
;
class
IntProRowTest
:
public
AverageTestBase
,
public
::
testing
::
WithParamInterface
<
IntProRowParam
>
{
class
IntProRowTest
:
public
AverageTestBase
,
public
::
testing
::
WithParamInterface
<
IntProRowParam
>
{
public:
IntProRowTest
()
:
AverageTestBase
(
16
,
GET_PARAM
(
0
)),
hbuf_asm_
(
NULL
),
hbuf_c_
(
NULL
)
{
:
AverageTestBase
(
16
,
GET_PARAM
(
0
)),
hbuf_asm_
(
NULL
),
hbuf_c_
(
NULL
)
{
asm_func_
=
GET_PARAM
(
1
);
c_func_
=
GET_PARAM
(
2
);
}
protected:
virtual
void
SetUp
()
{
hbuf_asm_
=
reinterpret_cast
<
int16_t
*>
(
hbuf_asm_
=
reinterpret_cast
<
int16_t
*>
(
vpx_memalign
(
kDataAlignment
,
sizeof
(
*
hbuf_asm_
)
*
16
));
hbuf_c_
=
reinterpret_cast
<
int16_t
*>
(
hbuf_c_
=
reinterpret_cast
<
int16_t
*>
(
vpx_memalign
(
kDataAlignment
,
sizeof
(
*
hbuf_c_
)
*
16
));
}
...
...
@@ -169,9 +161,8 @@ typedef int16_t (*IntProColFunc)(uint8_t const *ref, const int width);
typedef
std
::
tr1
::
tuple
<
int
,
IntProColFunc
,
IntProColFunc
>
IntProColParam
;
class
IntProColTest
:
public
AverageTestBase
,
public
::
testing
::
WithParamInterface
<
IntProColParam
>
{
class
IntProColTest
:
public
AverageTestBase
,
public
::
testing
::
WithParamInterface
<
IntProColParam
>
{
public:
IntProColTest
()
:
AverageTestBase
(
GET_PARAM
(
0
),
1
),
sum_asm_
(
0
),
sum_c_
(
0
)
{
asm_func_
=
GET_PARAM
(
1
);
...
...
@@ -195,15 +186,14 @@ class IntProColTest
typedef
int
(
*
SatdFunc
)(
const
int16_t
*
coeffs
,
int
length
);
typedef
std
::
tr1
::
tuple
<
int
,
SatdFunc
>
SatdTestParam
;
class
SatdTest
:
public
::
testing
::
Test
,
public
::
testing
::
WithParamInterface
<
SatdTestParam
>
{
class
SatdTest
:
public
::
testing
::
Test
,
public
::
testing
::
WithParamInterface
<
SatdTestParam
>
{
protected:
virtual
void
SetUp
()
{
satd_size_
=
GET_PARAM
(
0
);
satd_func_
=
GET_PARAM
(
1
);
rnd_
.
Reset
(
ACMRandom
::
DeterministicSeed
());
src_
=
reinterpret_cast
<
int16_t
*>
(
src_
=
reinterpret_cast
<
int16_t
*>
(
vpx_memalign
(
16
,
sizeof
(
*
src_
)
*
satd_size_
));
ASSERT_TRUE
(
src_
!=
NULL
);
}
...
...
@@ -235,7 +225,7 @@ class SatdTest
ACMRandom
rnd_
;
};
uint8_t
*
AverageTestBase
::
source_data_
=
NULL
;
uint8_t
*
AverageTestBase
::
source_data_
=
NULL
;
TEST_P
(
AverageTest
,
MinValue
)
{
FillConstant
(
0
);
...
...
@@ -286,7 +276,6 @@ TEST_P(IntProColTest, Random) {
RunComparison
();
}
TEST_P
(
SatdTest
,
MinValue
)
{
const
int
kMin
=
-
32640
;
const
int
expected
=
-
kMin
*
satd_size_
;
...
...
@@ -320,92 +309,86 @@ using std::tr1::make_tuple;
INSTANTIATE_TEST_CASE_P
(
C
,
AverageTest
,
::
testing
::
Values
(
make_tuple
(
16
,
16
,
1
,
8
,
&
vpx_avg_8x8_c
),
make_tuple
(
16
,
16
,
1
,
4
,
&
vpx_avg_4x4_c
)));
::
testing
::
Values
(
make_tuple
(
16
,
16
,
1
,
8
,
&
vpx_avg_8x8_c
),
make_tuple
(
16
,
16
,
1
,
4
,
&
vpx_avg_4x4_c
)));
INSTANTIATE_TEST_CASE_P
(
C
,
SatdTest
,
::
testing
::
Values
(
make_tuple
(
16
,
&
vpx_satd_c
),
make_tuple
(
64
,
&
vpx_satd_c
),
make_tuple
(
256
,
&
vpx_satd_c
),
make_tuple
(
1024
,
&
vpx_satd_c
)));
INSTANTIATE_TEST_CASE_P
(
C
,
SatdTest
,
::
testing
::
Values
(
make_tuple
(
16
,
&
vpx_satd_c
),
make_tuple
(
64
,
&
vpx_satd_c
),
make_tuple
(
256
,
&
vpx_satd_c
),
make_tuple
(
1024
,
&
vpx_satd_c
)));
#if HAVE_SSE2
INSTANTIATE_TEST_CASE_P
(
SSE2
,
AverageTest
,
::
testing
::
Values
(
make_tuple
(
16
,
16
,
0
,
8
,
&
vpx_avg_8x8_sse2
),
make_tuple
(
16
,
16
,
5
,
8
,
&
vpx_avg_8x8_sse2
),
make_tuple
(
32
,
32
,
15
,
8
,
&
vpx_avg_8x8_sse2
),
make_tuple
(
16
,
16
,
0
,
4
,
&
vpx_avg_4x4_sse2
),
make_tuple
(
16
,
16
,
5
,
4
,
&
vpx_avg_4x4_sse2
),
make_tuple
(
32
,
32
,
15
,
4
,
&
vpx_avg_4x4_sse2
)));
::
testing
::
Values
(
make_tuple
(
16
,
16
,
0
,
8
,
&
vpx_avg_8x8_sse2
),
make_tuple
(
16
,
16
,
5
,
8
,
&
vpx_avg_8x8_sse2
),
make_tuple
(
32
,
32
,
15
,
8
,
&
vpx_avg_8x8_sse2
),
make_tuple
(
16
,
16
,
0
,
4
,
&
vpx_avg_4x4_sse2
),
make_tuple
(
16
,
16
,
5
,
4
,
&
vpx_avg_4x4_sse2
),
make_tuple
(
32
,
32
,
15
,
4
,
&
vpx_avg_4x4_sse2
)));
INSTANTIATE_TEST_CASE_P
(
SSE2
,
IntProRowTest
,
::
testing
::
Values
(
make_tuple
(
16
,
&
vpx_int_pro_row_sse2
,
&
vpx_int_pro_row_c
),
make_tuple
(
32
,
&
vpx_int_pro_row_sse2
,
&
vpx_int_pro_row_c
),
make_tuple
(
64
,
&
vpx_int_pro_row_sse2
,
&
vpx_int_pro_row_c
)));
SSE2
,
IntProRowTest
,
::
testing
::
Values
(
make_tuple
(
16
,
&
vpx_int_pro_row_sse2
,
&
vpx_int_pro_row_c
),
make_tuple
(
32
,
&
vpx_int_pro_row_sse2
,
&
vpx_int_pro_row_c
),
make_tuple
(
64
,
&
vpx_int_pro_row_sse2
,
&
vpx_int_pro_row_c
)));
INSTANTIATE_TEST_CASE_P
(
SSE2
,
IntProColTest
,
::
testing
::
Values
(
make_tuple
(
16
,
&
vpx_int_pro_col_sse2
,
&
vpx_int_pro_col_c
),