summaryrefslogtreecommitdiff
path: root/test/video_source.h
diff options
context:
space:
mode:
authorJohann <johannkoenig@google.com>2012-07-23 14:55:32 -0700
committerJohann <johannkoenig@google.com>2012-07-23 15:29:33 -0700
commite3e63fbcbae81c1244b638e74bde4f895fb92c58 (patch)
tree3936a13ae57a29a14ff6169f86fb3a67d138e3ee /test/video_source.h
parentc0e80959ce459e9dcef3a0bfd659c4544d25a448 (diff)
downloadlibvpx-e3e63fbcbae81c1244b638e74bde4f895fb92c58.tar
libvpx-e3e63fbcbae81c1244b638e74bde4f895fb92c58.tar.gz
libvpx-e3e63fbcbae81c1244b638e74bde4f895fb92c58.tar.bz2
libvpx-e3e63fbcbae81c1244b638e74bde4f895fb92c58.zip
Make random streams consistant
Reset the seed so the second pass stream matches the first Change-Id: Id0c0f73abb835b5ca92d76b14e0b02f6239a6ee3
Diffstat (limited to 'test/video_source.h')
-rw-r--r--test/video_source.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/video_source.h b/test/video_source.h
index 3507ef0cd..7347c8dd0 100644
--- a/test/video_source.h
+++ b/test/video_source.h
@@ -9,6 +9,8 @@
*/
#ifndef TEST_VIDEO_SOURCE_H_
#define TEST_VIDEO_SOURCE_H_
+
+#include "test/acm_random.h"
#include "vpx/vpx_encoder.h"
namespace libvpx_test {
@@ -99,16 +101,28 @@ class DummyVideoSource : public VideoSource {
class RandomVideoSource : public DummyVideoSource {
+ public:
+ RandomVideoSource() : rnd_(ACMRandom::DeterministicSeed()) {}
+
protected:
+ // Reset the RNG to get a matching stream for the second pass
+ virtual void Begin() {
+ frame_ = 0;
+ rnd_.Reset(ACMRandom::DeterministicSeed());
+ FillFrame();
+ }
+
// 15 frames of noise, followed by 15 static frames. Reset to 0 rather
// than holding previous frames to encourage keyframes to be thrown.
virtual void FillFrame() {
if (frame_ % 30 < 15)
for (size_t i = 0; i < raw_sz_; ++i)
- img_->img_data[i] = rand();
+ img_->img_data[i] = rnd_.Rand8();
else
memset(img_->img_data, 0, raw_sz_);
}
+
+ ACMRandom rnd_;
};
} // namespace libvpx_test