summaryrefslogtreecommitdiff
path: root/test/decode_test_driver.h
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2013-03-27 10:41:29 -0700
committerJohn Koleszar <jkoleszar@google.com>2013-03-27 10:46:19 -0700
commit771fc832f3889c067b76899c8209bd0854ba7f7d (patch)
tree617379cd79f034d2ea2f709e90ab59105bbfc7cc /test/decode_test_driver.h
parent513157e0939b2774db583a31fe29c9d34948e09c (diff)
parent8015a9aedc2358135940180884f0b9bba9509009 (diff)
downloadlibvpx-771fc832f3889c067b76899c8209bd0854ba7f7d.tar
libvpx-771fc832f3889c067b76899c8209bd0854ba7f7d.tar.gz
libvpx-771fc832f3889c067b76899c8209bd0854ba7f7d.tar.bz2
libvpx-771fc832f3889c067b76899c8209bd0854ba7f7d.zip
Merge branch 'master' into experimental
Pick up VP8 encryption, quantization changes, and some fixes to vpxenc Conflicts: test/decode_test_driver.cc test/decode_test_driver.h test/encode_test_driver.cc vp8/vp8cx.mk vpxdec.c vpxenc.c Change-Id: I9fbcc64808ead47e22f1f22501965cc7f0c4791c
Diffstat (limited to 'test/decode_test_driver.h')
-rw-r--r--test/decode_test_driver.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/test/decode_test_driver.h b/test/decode_test_driver.h
index ed7069004..49e7384f4 100644
--- a/test/decode_test_driver.h
+++ b/test/decode_test_driver.h
@@ -42,7 +42,7 @@ class DxDataIterator {
class Decoder {
public:
Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
- : cfg_(cfg), deadline_(deadline) {
+ : cfg_(cfg), deadline_(deadline), init_done_(false) {
memset(&decoder_, 0, sizeof(decoder_));
}
@@ -50,7 +50,7 @@ class Decoder {
vpx_codec_destroy(&decoder_);
}
- void DecodeFrame(const uint8_t *cxdata, int size);
+ vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, int size);
DxDataIterator GetDxData() {
return DxDataIterator(&decoder_);
@@ -61,21 +61,39 @@ class Decoder {
}
void Control(int ctrl_id, int arg) {
+ InitOnce();
const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
}
- protected:
- virtual const vpx_codec_iface_t* CodecInterface() const = 0;
+ void Control(int ctrl_id, const void *arg) {
+ InitOnce();
+ const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
+ ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
+ }
const char* DecodeError() {
const char *detail = vpx_codec_error_detail(&decoder_);
return detail ? detail : vpx_codec_error(&decoder_);
}
+ protected:
+ virtual const vpx_codec_iface_t* CodecInterface() const = 0;
+
+ void InitOnce() {
+ if (!init_done_) {
+ const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_,
+ CodecInterface(),
+ &cfg_, 0);
+ ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
+ init_done_ = true;
+ }
+ }
+
vpx_codec_ctx_t decoder_;
vpx_codec_dec_cfg_t cfg_;
unsigned int deadline_;
+ bool init_done_;
};
// Common test functionality for all Decoder tests.