diff options
author | Yunqing Wang <yunqingwang@google.com> | 2012-10-04 12:59:36 -0700 |
---|---|---|
committer | Yunqing Wang <yunqingwang@google.com> | 2012-10-22 13:46:11 -0700 |
commit | 15dffcfefa34579194cb03fae3c7e5b9fb194e72 (patch) | |
tree | 374ab6834fdcf61ac806a3cef68805c427d09ae8 /test/video_source.h | |
parent | 9da8a344373bd2503a1274fd0e096b6c8d4d0f47 (diff) | |
download | libvpx-15dffcfefa34579194cb03fae3c7e5b9fb194e72.tar libvpx-15dffcfefa34579194cb03fae3c7e5b9fb194e72.tar.gz libvpx-15dffcfefa34579194cb03fae3c7e5b9fb194e72.tar.bz2 libvpx-15dffcfefa34579194cb03fae3c7e5b9fb194e72.zip |
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
Diffstat (limited to 'test/video_source.h')
-rw-r--r-- | test/video_source.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/video_source.h b/test/video_source.h index 688e185fd..ced0caed1 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 @@ class RandomVideoSource : public DummyVideoSource { 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_ |