Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
0e734a63
Commit
0e734a63
authored
12 years ago
by
Daniel Kang
Committed by
On2 (Google) Code Review
12 years ago
Browse files
Options
Download
Plain Diff
Merge "Port Yaowu's 4x4 fDCT test." into experimental
parents
ff8b630c
58156f18
v1.14.0-linphone
1.4.X
experimental
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
forest
frame_parallel
highbitdepth
indianrunnerduck
javanwhistlingduck
khakicampbell
linphone
linphone-android
linphone-old
longtailedduck
m29-baseline
m31-baseline
m49-2623
m52-2743
m54-2840
m56-2924
m66-3359
m68-3440
mandarinduck
mcw
mcw2
nextgen
nextgenv2
pcs-2013
playground
sandbox/Jingning/experimental
sandbox/Jingning/transcode
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/debargha/playground
sandbox/hkuang/frame_parallel
sandbox/hkuang@google.com/decode
sandbox/jimbankoski@google.com/proposed-aom
sandbox/jingning@google.com/decoder_test_suite
sandbox/jingning@google.com/experimental
sandbox/jzern@google.com/test
sandbox/wangch@google.com/vp9
sandbox/yaowu@google.com/mergeaom
stable-vp9-decoder
v1.12.0-linphone
v1.6.1_linphone
v1.7.0-linphone
v1.9.0-linphone
vp9-preview
v1.9.0
v1.9.0-rc1
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.0
v1.3.0
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/fdct4x4_test.cc
+141
-0
test/fdct4x4_test.cc
test/test-data.sha1
+1
-0
test/test-data.sha1
test/test.mk
+3
-0
test/test.mk
with
145 additions
and
0 deletions
test/fdct4x4_test.cc
0 → 100644
+
141
−
0
View file @
0e734a63
/*
* Copyright (c) 2012 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include
<math.h>
#include
<stdlib.h>
#include
<string.h>
#include
"third_party/googletest/src/include/gtest/gtest.h"
extern
"C"
{
#include
"vp8/common/idct.h"
#include
"vp8/encoder/dct.h"
}
#include
"vpx/vpx_integer.h"
namespace
{
class
ACMRandom
{
public:
explicit
ACMRandom
(
int
seed
)
{
Reset
(
seed
);
}
void
Reset
(
int
seed
)
{
srand
(
seed
);
}
uint8_t
Rand8
(
void
)
{
return
(
rand
()
>>
8
)
&
0xff
;
}
int
PseudoUniform
(
int
range
)
{
return
(
rand
()
>>
8
)
%
range
;
}
int
operator
()(
int
n
)
{
return
PseudoUniform
(
n
);
}
static
int
DeterministicSeed
(
void
)
{
return
0xbaba
;
}
};
TEST
(
Vp8FdctTest
,
SignBiasCheck
)
{
ACMRandom
rnd
(
ACMRandom
::
DeterministicSeed
());
int16_t
test_input_block
[
16
];
int16_t
test_output_block
[
16
];
const
int
pitch
=
8
;
int
count_sign_block
[
16
][
2
];
const
int
count_test_block
=
1000000
;
memset
(
count_sign_block
,
0
,
sizeof
(
count_sign_block
));
for
(
int
i
=
0
;
i
<
count_test_block
;
++
i
)
{
// Initialize a test block with input range [-255, 255].
for
(
int
j
=
0
;
j
<
16
;
++
j
)
test_input_block
[
j
]
=
rnd
.
Rand8
()
-
rnd
.
Rand8
();
// TODO(Yaowu): this should be converted to a parameterized test
// to test optimized versions of this function.
vp8_short_fdct4x4_c
(
test_input_block
,
test_output_block
,
pitch
);
for
(
int
j
=
0
;
j
<
16
;
++
j
)
{
if
(
test_output_block
[
j
]
<
0
)
++
count_sign_block
[
j
][
0
];
else
if
(
test_output_block
[
j
]
>
0
)
++
count_sign_block
[
j
][
1
];
}
}
for
(
int
j
=
0
;
j
<
16
;
++
j
)
{
const
bool
bias_acceptable
=
(
abs
(
count_sign_block
[
j
][
0
]
-
count_sign_block
[
j
][
1
])
<
10000
);
EXPECT_TRUE
(
bias_acceptable
)
<<
"Error: 4x4 FDCT has a sign bias > 1%"
<<
" for input range [-255, 255] at index "
<<
j
;
}
memset
(
count_sign_block
,
0
,
sizeof
(
count_sign_block
));
for
(
int
i
=
0
;
i
<
count_test_block
;
++
i
)
{
// Initialize a test block with input range [-15, 15].
for
(
int
j
=
0
;
j
<
16
;
++
j
)
test_input_block
[
j
]
=
(
rnd
.
Rand8
()
>>
4
)
-
(
rnd
.
Rand8
()
>>
4
);
// TODO(Yaowu): this should be converted to a parameterized test
// to test optimized versions of this function.
vp8_short_fdct4x4_c
(
test_input_block
,
test_output_block
,
pitch
);
for
(
int
j
=
0
;
j
<
16
;
++
j
)
{
if
(
test_output_block
[
j
]
<
0
)
++
count_sign_block
[
j
][
0
];
else
if
(
test_output_block
[
j
]
>
0
)
++
count_sign_block
[
j
][
1
];
}
}
for
(
int
j
=
0
;
j
<
16
;
++
j
)
{
const
bool
bias_acceptable
=
(
abs
(
count_sign_block
[
j
][
0
]
-
count_sign_block
[
j
][
1
])
<
100000
);
EXPECT_TRUE
(
bias_acceptable
)
<<
"Error: 4x4 FDCT has a sign bias > 10%"
<<
" for input range [-15, 15] at index "
<<
j
;
}
};
TEST
(
Vp8FdctTest
,
RoundTripErrorCheck
)
{
ACMRandom
rnd
(
ACMRandom
::
DeterministicSeed
());
int
max_error
=
0
;
double
total_error
=
0
;
const
int
count_test_block
=
1000000
;
for
(
int
i
=
0
;
i
<
count_test_block
;
++
i
)
{
int16_t
test_input_block
[
16
];
int16_t
test_temp_block
[
16
];
int16_t
test_output_block
[
16
];
// Initialize a test block with input range [-255, 255].
for
(
int
j
=
0
;
j
<
16
;
++
j
)
test_input_block
[
j
]
=
rnd
.
Rand8
()
-
rnd
.
Rand8
();
// TODO(Yaowu): this should be converted to a parameterized test
// to test optimized versions of this function.
const
int
pitch
=
8
;
vp8_short_fdct4x4_c
(
test_input_block
,
test_temp_block
,
pitch
);
// Because the bitstream is not frozen yet, use the idct in the codebase.
vp8_short_idct4x4llm_c
(
test_temp_block
,
test_output_block
,
pitch
);
for
(
int
j
=
0
;
j
<
16
;
++
j
)
{
const
int
diff
=
test_input_block
[
j
]
-
test_output_block
[
j
];
const
int
error
=
diff
*
diff
;
if
(
max_error
<
error
)
max_error
=
error
;
total_error
+=
error
;
}
}
EXPECT_GE
(
1
,
max_error
)
<<
"Error: FDCT/IDCT has an individual roundtrip error > 1"
;
EXPECT_GE
(
count_test_block
,
total_error
)
<<
"Error: FDCT/IDCT has average roundtrip error > 1 per block"
;
};
}
// namespace
This diff is collapsed.
Click to expand it.
test/test-data.sha1
0 → 100644
+
1
−
0
View file @
0e734a63
d5dfb0151c9051f8c85999255645d7a23916d3c0 hantro_collage_w352h288.yuv
This diff is collapsed.
Click to expand it.
test/test.mk
+
3
−
0
View file @
0e734a63
LIBVPX_TEST_SRCS-yes
+=
test.mk
LIBVPX_TEST_SRCS-yes
+=
test.mk
LIBVPX_TEST_SRCS-yes
+=
boolcoder_test.cc
LIBVPX_TEST_SRCS-yes
+=
boolcoder_test.cc
LIBVPX_TEST_SRCS-yes
+=
fdct4x4_test.cc
LIBVPX_TEST_SRCS-yes
+=
test_libvpx.cc
LIBVPX_TEST_SRCS-yes
+=
test_libvpx.cc
LIBVPX_TEST_DATA-yes
+=
hantro_collage_w352h288.yuv
This diff is collapsed.
Click to expand it.
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!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets