summaryrefslogtreecommitdiffstats
path: root/libvpx/test/test_vector_test.cc
diff options
context:
space:
mode:
authorhkuang <hkuang@google.com>2013-06-19 15:33:45 -0700
committerhkuang <hkuang@google.com>2013-06-20 10:24:31 -0700
commitba164dffc5a6795bce97fae02b51ccf3330e15e4 (patch)
tree9b83fdf84e5bd8bb4d47ac37a7ea9ae3eef840b6 /libvpx/test/test_vector_test.cc
parentca15b5fc158a9df465aaf1acfe38d8cb5042c81b (diff)
downloadandroid_external_libvpx-ba164dffc5a6795bce97fae02b51ccf3330e15e4.tar.gz
android_external_libvpx-ba164dffc5a6795bce97fae02b51ccf3330e15e4.tar.bz2
android_external_libvpx-ba164dffc5a6795bce97fae02b51ccf3330e15e4.zip
Updates libvpx to enable the VP9 decoder.
This change enables VP9 decoder for all build configurations. Checkout is from master branch(hash:12180c8329d56d72e8d4424b8fd82b1b2f8e846a). Change-Id: Ieaba85d0bc54e1ecdf9596398dafa03c43182f8c
Diffstat (limited to 'libvpx/test/test_vector_test.cc')
-rw-r--r--libvpx/test/test_vector_test.cc128
1 files changed, 87 insertions, 41 deletions
diff --git a/libvpx/test/test_vector_test.cc b/libvpx/test/test_vector_test.cc
index 938457b..d7bd184 100644
--- a/libvpx/test/test_vector_test.cc
+++ b/libvpx/test/test_vector_test.cc
@@ -12,20 +12,19 @@
#include <cstdlib>
#include <string>
#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "test/codec_factory.h"
#include "test/decode_test_driver.h"
#include "test/ivf_video_source.h"
+#include "test/webm_video_source.h"
+#include "test/util.h"
+#include "test/md5_helper.h"
extern "C" {
-#include "./md5_utils.h"
#include "vpx_mem/vpx_mem.h"
}
-#if defined(_MSC_VER)
-#define snprintf sprintf_s
-#endif
-
namespace {
-// There are 61 test vectors in total.
-const char *kTestVectors[] = {
+#if CONFIG_VP8_DECODER
+const char *kVP8TestVectors[] = {
"vp80-00-comprehensive-001.ivf",
"vp80-00-comprehensive-002.ivf", "vp80-00-comprehensive-003.ivf",
"vp80-00-comprehensive-004.ivf", "vp80-00-comprehensive-005.ivf",
@@ -58,11 +57,71 @@ const char *kTestVectors[] = {
"vp80-05-sharpness-1438.ivf", "vp80-05-sharpness-1439.ivf",
"vp80-05-sharpness-1440.ivf", "vp80-05-sharpness-1443.ivf"
};
+#endif
+#if CONFIG_VP9_DECODER
+const char *kVP9TestVectors[] = {
+ "vp90-00-akiyo-200.webm", "vp90-00-akiyo-300.webm",
+ "vp90-00-akiyo-50.webm", "vp90-00-bowing-150.webm",
+ "vp90-00-bowing-25.webm", "vp90-00-bowing-400.webm",
+ "vp90-00-bus-100.webm", "vp90-00-bus-2000.webm",
+ "vp90-00-bus-300.webm", "vp90-00-bus-4400.webm",
+ "vp90-00-bus-800.webm", "vp90-00-cheer-1600.webm",
+ "vp90-00-cheer-2800.webm", "vp90-00-cheer-400.webm",
+ "vp90-00-cheer-600.webm", "vp90-00-city-1200.webm",
+ "vp90-00-city-2000.webm", "vp90-00-city-300.webm",
+ "vp90-00-city-600.webm", "vp90-00-coastguard-1200.webm",
+ "vp90-00-coastguard-200.webm", "vp90-00-coastguard-3600.webm",
+ "vp90-00-coastguard-5200.webm", "vp90-00-container-1000.webm",
+ "vp90-00-container-200.webm", "vp90-00-container-50.webm",
+ "vp90-00-deadline-1000.webm", "vp90-00-deadline-200.webm",
+ "vp90-00-deadline-50.webm", "vp90-00-flower-100.webm",
+ "vp90-00-flower-2000.webm", "vp90-00-flower-300.webm",
+ "vp90-00-flower-4400.webm", "vp90-00-flower-800.webm",
+ "vp90-00-football-1600.webm", "vp90-00-football-2800.webm",
+ "vp90-00-football-400.webm", "vp90-00-football-600.webm",
+ "vp90-00-foreman-1200.webm", "vp90-00-foreman-2000.webm",
+ "vp90-00-foreman-300.webm", "vp90-00-foreman-600.webm",
+ "vp90-00-hallmonitor-1200.webm", "vp90-00-hallmonitor-2000.webm",
+ "vp90-00-hallmonitor-300.webm", "vp90-00-hallmonitor-600.webm",
+ "vp90-00-harbour-1200.webm", "vp90-00-harbour-200.webm",
+ "vp90-00-harbour-3600.webm", "vp90-00-harbour-5200.webm",
+ "vp90-00-highway-100.webm", "vp90-00-highway-1600.webm",
+ "vp90-00-highway-2800.webm", "vp90-00-highway-50.webm",
+ "vp90-00-husky-100.webm", "vp90-00-husky-2000.webm",
+ "vp90-00-husky-300.webm", "vp90-00-husky-4400.webm",
+ "vp90-00-husky-800.webm", "vp90-00-ice-150.webm",
+ "vp90-00-ice-400.webm", "vp90-00-ice-800.webm",
+ "vp90-00-mobile-1600.webm", "vp90-00-mobile-2800.webm",
+ "vp90-00-mobile-400.webm", "vp90-00-mobile-600.webm",
+ "vp90-00-motherdaughter-100.webm", "vp90-00-motherdaughter-300.webm",
+ "vp90-00-motherdaughter-600.webm", "vp90-00-news-100.webm",
+ "vp90-00-news-300.webm", "vp90-00-news-600.webm",
+ "vp90-00-pamphlet-150.webm", "vp90-00-pamphlet-25.webm",
+ "vp90-00-pamphlet-400.webm", "vp90-00-paris-1000.webm",
+ "vp90-00-paris-200.webm", "vp90-00-paris-50.webm",
+ "vp90-00-signirene-1000.webm", "vp90-00-signirene-200.webm",
+ "vp90-00-signirene-50.webm", "vp90-00-silent-1000.webm",
+ "vp90-00-silent-200.webm", "vp90-00-silent-50.webm",
+ "vp90-00-soccer-100.webm", "vp90-00-soccer-2000.webm",
+ "vp90-00-soccer-300.webm", "vp90-00-soccer-4400.webm",
+ "vp90-00-soccer-800.webm", "vp90-00-stefan-1600.webm",
+ "vp90-00-stefan-2800.webm", "vp90-00-stefan-400.webm",
+ "vp90-00-stefan-600.webm", "vp90-00-students-100.webm",
+ "vp90-00-students-300.webm", "vp90-00-students-600.webm",
+ "vp90-00-tempete-1200.webm", "vp90-00-tempete-200.webm",
+ "vp90-00-tempete-3600.webm", "vp90-00-tempete-5200.webm",
+ "vp90-00-tennis-100.webm", "vp90-00-tennis-2000.webm",
+ "vp90-00-tennis-300.webm", "vp90-00-tennis-4400.webm",
+ "vp90-00-tennis-800.webm", "vp90-00-waterfall-150.webm",
+ "vp90-00-waterfall-200.webm", "vp90-00-waterfall-400.webm",
+ "vp90-00-waterfall-800.webm",
+};
+#endif
-class TestVectorTest : public libvpx_test::DecoderTest,
- public ::testing::TestWithParam<const char*> {
+class TestVectorTest : public ::libvpx_test::DecoderTest,
+ public ::libvpx_test::CodecTestWithParam<const char*> {
protected:
- TestVectorTest() : md5_file_(NULL) {}
+ TestVectorTest() : DecoderTest(GET_PARAM(0)), md5_file_(NULL) {}
virtual ~TestVectorTest() {
if (md5_file_)
@@ -85,30 +144,9 @@ class TestVectorTest : public libvpx_test::DecoderTest,
ASSERT_NE(res, EOF) << "Read md5 data failed";
expected_md5[32] = '\0';
- MD5Context md5;
- MD5Init(&md5);
-
- // Compute and update md5 for each raw in decompressed data.
- for (int plane = 0; plane < 3; ++plane) {
- uint8_t *buf = img.planes[plane];
-
- for (unsigned int y = 0; y < (plane ? (img.d_h + 1) >> 1 : img.d_h);
- ++y) {
- MD5Update(&md5, buf, (plane ? (img.d_w + 1) >> 1 : img.d_w));
- buf += img.stride[plane];
- }
- }
-
- uint8_t md5_sum[16];
- MD5Final(md5_sum, &md5);
-
- char actual_md5[33];
- // Convert to get the actual md5.
- for (int i = 0; i < 16; i++) {
- snprintf(&actual_md5[i * 2], sizeof(actual_md5) - i * 2, "%02x",
- md5_sum[i]);
- }
- actual_md5[32] = '\0';
+ ::libvpx_test::MD5 md5_res;
+ md5_res.Add(&img);
+ const char *actual_md5 = md5_res.Get();
// Check md5 match.
ASSERT_STREQ(expected_md5, actual_md5)
@@ -124,21 +162,29 @@ class TestVectorTest : public libvpx_test::DecoderTest,
// checksums match the correct md5 data, then the test is passed. Otherwise,
// the test failed.
TEST_P(TestVectorTest, MD5Match) {
- const std::string filename = GetParam();
- // Open compressed video file.
- libvpx_test::IVFVideoSource video(filename);
+ const std::string filename = GET_PARAM(1);
+ libvpx_test::CompressedVideoSource *video = NULL;
- video.Init();
+ // Open compressed video file.
+ if (filename.substr(filename.length() - 3, 3) == "ivf") {
+ video = new libvpx_test::IVFVideoSource(filename);
+ } else if (filename.substr(filename.length() - 4, 4) == "webm") {
+ video = new libvpx_test::WebMVideoSource(filename);
+ }
+ video->Init();
// Construct md5 file name.
const std::string md5_filename = filename + ".md5";
OpenMD5File(md5_filename);
// Decode frame, and check the md5 matching.
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+ ASSERT_NO_FATAL_FAILURE(RunLoop(video));
+ delete video;
}
-INSTANTIATE_TEST_CASE_P(TestVectorSequence, TestVectorTest,
- ::testing::ValuesIn(kTestVectors));
+VP8_INSTANTIATE_TEST_CASE(TestVectorTest,
+ ::testing::ValuesIn(kVP8TestVectors));
+VP9_INSTANTIATE_TEST_CASE(TestVectorTest,
+ ::testing::ValuesIn(kVP9TestVectors));
} // namespace