summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2012-06-13 11:59:12 -0700
committerJames Zern <jzern@google.com>2012-06-13 14:06:34 -0700
commit7b0b6a2c414a7e8947d37c817d5b312a7ec844f7 (patch)
treefa6a24c52a6b5fc743c04eaf158239d1b4950efe /test
parent0164a1cc5b13909407587109effabea92e487986 (diff)
downloadlibvpx-7b0b6a2c414a7e8947d37c817d5b312a7ec844f7.tar
libvpx-7b0b6a2c414a7e8947d37c817d5b312a7ec844f7.tar.gz
libvpx-7b0b6a2c414a7e8947d37c817d5b312a7ec844f7.tar.bz2
libvpx-7b0b6a2c414a7e8947d37c817d5b312a7ec844f7.zip
disable lagged encoding in one-pass
This currently has no effect and can create an artificial lag in e.g., realtime. Change-Id: Ia1c7c6dbe7c6fe82a944f087f1b0d1dbbc0aa1b6
Diffstat (limited to 'test')
-rw-r--r--test/config_test.cc61
-rw-r--r--test/test.mk1
2 files changed, 62 insertions, 0 deletions
diff --git a/test/config_test.cc b/test/config_test.cc
new file mode 100644
index 000000000..e595786e5
--- /dev/null
+++ b/test/config_test.cc
@@ -0,0 +1,61 @@
+/*
+ * 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 "third_party/googletest/src/include/gtest/gtest.h"
+#include "test/encode_test_driver.h"
+#include "test/video_source.h"
+
+namespace {
+
+class ConfigTest : public ::libvpx_test::EncoderTest,
+ public ::testing::TestWithParam<enum libvpx_test::TestMode> {
+ public:
+ ConfigTest() : frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {}
+
+ protected:
+ virtual void SetUp() {
+ InitializeConfig();
+ SetMode(GetParam());
+ }
+
+ virtual void BeginPassHook(unsigned int /*pass*/) {
+ frame_count_in_ = 0;
+ frame_count_out_ = 0;
+ }
+
+ virtual void PreEncodeFrameHook(libvpx_test::VideoSource* /*video*/) {
+ ++frame_count_in_;
+ abort_ |= (frame_count_in_ >= frame_count_max_);
+ }
+
+ virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {
+ ++frame_count_out_;
+ }
+
+ virtual bool Continue() {
+ return !HasFatalFailure() && !abort_;
+ }
+
+ unsigned int frame_count_in_;
+ unsigned int frame_count_out_;
+ unsigned int frame_count_max_;
+};
+
+TEST_P(ConfigTest, LagIsDisabled) {
+ frame_count_max_ = 2;
+ cfg_.g_lag_in_frames = 15;
+
+ libvpx_test::DummyVideoSource video;
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+
+ EXPECT_EQ(frame_count_in_, frame_count_out_);
+}
+
+INSTANTIATE_TEST_CASE_P(OnePassModes, ConfigTest, ONE_PASS_TEST_MODES);
+} // namespace
diff --git a/test/test.mk b/test/test.mk
index ac500fe4d..d58beb41e 100644
--- a/test/test.mk
+++ b/test/test.mk
@@ -1,5 +1,6 @@
LIBVPX_TEST_SRCS-yes += test.mk
LIBVPX_TEST_SRCS-yes += boolcoder_test.cc
+LIBVPX_TEST_SRCS-yes += config_test.cc
LIBVPX_TEST_SRCS-yes += encode_test_driver.cc
LIBVPX_TEST_SRCS-yes += encode_test_driver.h
LIBVPX_TEST_SRCS-yes += idctllm_test.cc