Add unit test for decoder test_vector_test
Got 61 test vectors from vp8-test-vectors.git
(http://git.chromium.org/gitweb/?p=webm/vp8-test-vectors.git)
Added decoder test vectors downloading in unit tests. Uploaded
the test vectors and their md5 files to WebM website.
$ gsutil cp *.* gs://downloads.webmproject.org/test_data/libvpx
Added their sha1sum to the test/test-data.sha1 file.
In unit tests, download the test vectors to LIBVPX_TEST_DATA_PATH.
Test_vector_test goes through the test vectors, decodes them, and
compute the md5 checksums. The checksums are compared with the
expected md5 checksums to tell if the decoder decodes correctly.
Change-Id: Ia1e84f9347ddf1d4a02e056c0fee7d28dccfae15
diff --git a/test/video_source.h b/test/video_source.h
index 688e185..ced0cae 100644
--- a/test/video_source.h
+++ b/test/video_source.h
@@ -10,11 +10,27 @@
#ifndef TEST_VIDEO_SOURCE_H_
#define TEST_VIDEO_SOURCE_H_
+#include <cstdio>
+#include <cstdlib>
+#include <string>
#include "test/acm_random.h"
#include "vpx/vpx_encoder.h"
namespace libvpx_test {
+static FILE *OpenTestDataFile(const std::string& file_name) {
+ std::string path_to_source = file_name;
+ const char *kDataPath = getenv("LIBVPX_TEST_DATA_PATH");
+
+ if (kDataPath) {
+ path_to_source = kDataPath;
+ path_to_source += "/";
+ path_to_source += file_name;
+ }
+
+ return fopen(path_to_source.c_str(), "rb");
+}
+
// Abstract base class for test video sources, which provide a stream of
// vpx_image_t images with associated timestamps and duration.
class VideoSource {
@@ -128,6 +144,27 @@
int seed_;
};
+// Abstract base class for test video sources, which provide a stream of
+// decompressed images to the decoder.
+class CompressedVideoSource {
+ public:
+ virtual ~CompressedVideoSource() {}
+
+ virtual void Init() = 0;
+
+ // Prepare the stream for reading, rewind/open as necessary.
+ virtual void Begin() = 0;
+
+ // Advance the cursor to the next frame
+ virtual void Next() = 0;
+
+ virtual const uint8_t *cxdata() const = 0;
+
+ virtual const unsigned int frame_size() const = 0;
+
+ virtual const unsigned int frame_number() const = 0;
+};
+
} // namespace libvpx_test
#endif // TEST_VIDEO_SOURCE_H_