summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Grange <agrange@google.com>2012-10-04 10:37:38 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2012-10-04 10:37:38 -0700
commit85b27a1271b7db73509c74a6daae8b121d930db0 (patch)
treea36a30fd9e2b8099735bc3e7911fe3e1cf5a0e46
parent0e213fb999665b382b3937cb7ab1ff2385cd5265 (diff)
parent4206c6dd01c33ff19b8eedc595aaac9b72105172 (diff)
downloadlibvpx-85b27a1271b7db73509c74a6daae8b121d930db0.tar
libvpx-85b27a1271b7db73509c74a6daae8b121d930db0.tar.gz
libvpx-85b27a1271b7db73509c74a6daae8b121d930db0.tar.bz2
libvpx-85b27a1271b7db73509c74a6daae8b121d930db0.zip
Merge "Add initialization and per frame flag members"
-rw-r--r--test/encode_test_driver.cc15
-rw-r--r--test/encode_test_driver.h16
-rw-r--r--test/keyframe_test.cc2
3 files changed, 19 insertions, 14 deletions
diff --git a/test/encode_test_driver.cc b/test/encode_test_driver.cc
index 43e99187d..182d1eaba 100644
--- a/test/encode_test_driver.cc
+++ b/test/encode_test_driver.cc
@@ -16,9 +16,9 @@
#include "third_party/googletest/src/include/gtest/gtest.h"
namespace libvpx_test {
-void Encoder::EncodeFrame(VideoSource *video, unsigned long flags) {
+void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
if (video->img())
- EncodeFrameInternal(*video, flags);
+ EncodeFrameInternal(*video, frame_flags);
else
Flush();
@@ -34,7 +34,7 @@ void Encoder::EncodeFrame(VideoSource *video, unsigned long flags) {
}
void Encoder::EncodeFrameInternal(const VideoSource &video,
- unsigned long flags) {
+ const unsigned long frame_flags) {
vpx_codec_err_t res;
const vpx_image_t *img = video.img();
@@ -44,7 +44,8 @@ void Encoder::EncodeFrameInternal(const VideoSource &video,
cfg_.g_h = img->d_h;
cfg_.g_timebase = video.timebase();
cfg_.rc_twopass_stats_in = stats_->buf();
- res = vpx_codec_enc_init(&encoder_, &vpx_codec_vp8_cx_algo, &cfg_, 0);
+ res = vpx_codec_enc_init(&encoder_, &vpx_codec_vp8_cx_algo, &cfg_,
+ init_flags_);
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
}
@@ -59,7 +60,7 @@ void Encoder::EncodeFrameInternal(const VideoSource &video,
// Encode the frame
res = vpx_codec_encode(&encoder_,
video.img(), video.pts(), video.duration(),
- flags, deadline_);
+ frame_flags, deadline_);
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
}
@@ -140,7 +141,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
cfg_.g_pass = VPX_RC_LAST_PASS;
BeginPassHook(pass);
- Encoder encoder(cfg_, deadline_, &stats_);
+ Encoder encoder(cfg_, deadline_, init_flags_, &stats_);
#if CONFIG_VP8_DECODER
Decoder decoder(dec_cfg);
bool has_cxdata = false;
@@ -151,7 +152,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
PreEncodeFrameHook(video);
PreEncodeFrameHook(video, &encoder);
- encoder.EncodeFrame(video, flags_);
+ encoder.EncodeFrame(video, frame_flags_);
CxDataIterator iter = encoder.GetCxData();
diff --git a/test/encode_test_driver.h b/test/encode_test_driver.h
index f06549268..7b95a8da4 100644
--- a/test/encode_test_driver.h
+++ b/test/encode_test_driver.h
@@ -82,8 +82,8 @@ class TwopassStatsStore {
class Encoder {
public:
Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
- TwopassStatsStore *stats)
- : cfg_(cfg), deadline_(deadline), stats_(stats) {
+ const unsigned long init_flags, TwopassStatsStore *stats)
+ : cfg_(cfg), deadline_(deadline), init_flags_(init_flags), stats_(stats) {
memset(&encoder_, 0, sizeof(encoder_));
}
@@ -100,7 +100,7 @@ class Encoder {
}
// This is a thin wrapper around vpx_codec_encode(), so refer to
// vpx_encoder.h for its semantics.
- void EncodeFrame(VideoSource *video, unsigned long flags);
+ void EncodeFrame(VideoSource *video, const unsigned long frame_flags);
// Convenience wrapper for EncodeFrame()
void EncodeFrame(VideoSource *video) {
@@ -123,7 +123,8 @@ class Encoder {
}
// Encode an image
- void EncodeFrameInternal(const VideoSource &video, unsigned long flags);
+ void EncodeFrameInternal(const VideoSource &video,
+ const unsigned long frame_flags);
// Flush the encoder on EOS
void Flush();
@@ -131,6 +132,7 @@ class Encoder {
vpx_codec_ctx_t encoder_;
vpx_codec_enc_cfg_t cfg_;
unsigned long deadline_;
+ unsigned long init_flags_;
TwopassStatsStore *stats_;
};
@@ -143,7 +145,8 @@ class Encoder {
// classes directly, so that tests can be parameterized differently.
class EncoderTest {
protected:
- EncoderTest() : abort_(false), flags_(0), last_pts_(0) {}
+ EncoderTest() : abort_(false), init_flags_(0), frame_flags_(0),
+ last_pts_(0) {}
virtual ~EncoderTest() {}
@@ -181,7 +184,8 @@ class EncoderTest {
unsigned int passes_;
unsigned long deadline_;
TwopassStatsStore stats_;
- unsigned long flags_;
+ unsigned long init_flags_;
+ unsigned long frame_flags_;
vpx_codec_pts_t last_pts_;
};
diff --git a/test/keyframe_test.cc b/test/keyframe_test.cc
index 9925daea7..d0c81df99 100644
--- a/test/keyframe_test.cc
+++ b/test/keyframe_test.cc
@@ -34,7 +34,7 @@ class KeyframeTest : public ::libvpx_test::EncoderTest,
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) {
if (kf_do_force_kf_)
- flags_ = (video->frame() % 3) ? 0 : VPX_EFLAG_FORCE_KF;
+ frame_flags_ = (video->frame() % 3) ? 0 : VPX_EFLAG_FORCE_KF;
if (set_cpu_used_ && video->frame() == 1)
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
}