summaryrefslogtreecommitdiff
path: root/test/encode_test_driver.h
diff options
context:
space:
mode:
authorclang-format <noreply@google.com>2016-07-25 22:50:48 -0700
committerJames Zern <jzern@google.com>2016-07-27 01:58:52 +0000
commit33e40cb5db12309b69ef40e84b2ed522a54da09e (patch)
treed9772b1e118a04162b551bdfd53233725a916ab5 /test/encode_test_driver.h
parente4290800b21478a3f9548c58b4f15c5ba5393073 (diff)
downloadlibvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.tar
libvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.tar.gz
libvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.tar.bz2
libvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.zip
test: apply clang-format
Change-Id: I0d9ab85855eb723f653a7bb09b3d0d31dd6cfd2f
Diffstat (limited to 'test/encode_test_driver.h')
-rw-r--r--test/encode_test_driver.h96
1 files changed, 41 insertions, 55 deletions
diff --git a/test/encode_test_driver.h b/test/encode_test_driver.h
index d14ddc7d7..09b1a7834 100644
--- a/test/encode_test_driver.h
+++ b/test/encode_test_driver.h
@@ -33,19 +33,17 @@ enum TestMode {
kTwoPassGood,
kTwoPassBest
};
-#define ALL_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \
- ::libvpx_test::kOnePassGood, \
- ::libvpx_test::kOnePassBest, \
- ::libvpx_test::kTwoPassGood, \
- ::libvpx_test::kTwoPassBest)
+#define ALL_TEST_MODES \
+ ::testing::Values(::libvpx_test::kRealTime, ::libvpx_test::kOnePassGood, \
+ ::libvpx_test::kOnePassBest, ::libvpx_test::kTwoPassGood, \
+ ::libvpx_test::kTwoPassBest)
-#define ONE_PASS_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \
- ::libvpx_test::kOnePassGood, \
- ::libvpx_test::kOnePassBest)
-
-#define TWO_PASS_TEST_MODES ::testing::Values(::libvpx_test::kTwoPassGood, \
- ::libvpx_test::kTwoPassBest)
+#define ONE_PASS_TEST_MODES \
+ ::testing::Values(::libvpx_test::kRealTime, ::libvpx_test::kOnePassGood, \
+ ::libvpx_test::kOnePassBest)
+#define TWO_PASS_TEST_MODES \
+ ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kTwoPassBest)
// Provides an object to handle the libvpx get_cx_data() iteration pattern
class CxDataIterator {
@@ -58,8 +56,8 @@ class CxDataIterator {
}
private:
- vpx_codec_ctx_t *encoder_;
- vpx_codec_iter_t iter_;
+ vpx_codec_ctx_t *encoder_;
+ vpx_codec_iter_t iter_;
};
// Implements an in-memory store for libvpx twopass statistics
@@ -75,15 +73,12 @@ class TwopassStatsStore {
return buf;
}
- void Reset() {
- buffer_.clear();
- }
+ void Reset() { buffer_.clear(); }
protected:
- std::string buffer_;
+ std::string buffer_;
};
-
// Provides a simplified interface to manage one video encoding pass, given
// a configuration and video source.
//
@@ -97,13 +92,9 @@ class Encoder {
memset(&encoder_, 0, sizeof(encoder_));
}
- virtual ~Encoder() {
- vpx_codec_destroy(&encoder_);
- }
+ virtual ~Encoder() { vpx_codec_destroy(&encoder_); }
- CxDataIterator GetCxData() {
- return CxDataIterator(&encoder_);
- }
+ CxDataIterator GetCxData() { return CxDataIterator(&encoder_); }
void InitEncoder(VideoSource *video);
@@ -115,9 +106,7 @@ class Encoder {
void EncodeFrame(VideoSource *video, const unsigned long frame_flags);
// Convenience wrapper for EncodeFrame()
- void EncodeFrame(VideoSource *video) {
- EncodeFrame(video, 0);
- }
+ void EncodeFrame(VideoSource *video) { EncodeFrame(video, 0); }
void Control(int ctrl_id, int arg) {
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
@@ -156,12 +145,10 @@ class Encoder {
cfg_ = *cfg;
}
- void set_deadline(unsigned long deadline) {
- deadline_ = deadline;
- }
+ void set_deadline(unsigned long deadline) { deadline_ = deadline; }
protected:
- virtual vpx_codec_iface_t* CodecInterface() const = 0;
+ virtual vpx_codec_iface_t *CodecInterface() const = 0;
const char *EncoderError() {
const char *detail = vpx_codec_error_detail(&encoder_);
@@ -175,11 +162,11 @@ class Encoder {
// Flush the encoder on EOS
void Flush();
- vpx_codec_ctx_t encoder_;
- vpx_codec_enc_cfg_t cfg_;
- unsigned long deadline_;
- unsigned long init_flags_;
- TwopassStatsStore *stats_;
+ vpx_codec_ctx_t encoder_;
+ vpx_codec_enc_cfg_t cfg_;
+ unsigned long deadline_;
+ unsigned long init_flags_;
+ TwopassStatsStore *stats_;
};
// Common test functionality for all Encoder tests.
@@ -221,36 +208,35 @@ class EncoderTest {
virtual void EndPassHook() {}
// Hook to be called before encoding a frame.
- virtual void PreEncodeFrameHook(VideoSource* /*video*/) {}
- virtual void PreEncodeFrameHook(VideoSource* /*video*/,
- Encoder* /*encoder*/) {}
+ virtual void PreEncodeFrameHook(VideoSource * /*video*/) {}
+ virtual void PreEncodeFrameHook(VideoSource * /*video*/,
+ Encoder * /*encoder*/) {}
// Hook to be called on every compressed data packet.
- virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {}
+ virtual void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {}
// Hook to be called on every PSNR packet.
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {}
+ virtual void PSNRPktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {}
// Hook to determine whether the encode loop should continue.
virtual bool Continue() const {
return !(::testing::Test::HasFatalFailure() || abort_);
}
- const CodecFactory *codec_;
+ const CodecFactory *codec_;
// Hook to determine whether to decode frame after encoding
virtual bool DoDecode() const { return 1; }
// Hook to handle encode/decode mismatch
- virtual void MismatchHook(const vpx_image_t *img1,
- const vpx_image_t *img2);
+ virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2);
// Hook to be called on every decompressed frame.
- virtual void DecompressedFrameHook(const vpx_image_t& /*img*/,
+ virtual void DecompressedFrameHook(const vpx_image_t & /*img*/,
vpx_codec_pts_t /*pts*/) {}
// Hook to be called to handle decode result. Return true to continue.
virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
- const VideoSource& /*video*/,
+ const VideoSource & /*video*/,
Decoder *decoder) {
EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
return VPX_CODEC_OK == res_dec;
@@ -262,15 +248,15 @@ class EncoderTest {
return pkt;
}
- bool abort_;
- vpx_codec_enc_cfg_t cfg_;
- vpx_codec_dec_cfg_t dec_cfg_;
- unsigned int passes_;
- unsigned long deadline_;
- TwopassStatsStore stats_;
- unsigned long init_flags_;
- unsigned long frame_flags_;
- vpx_codec_pts_t last_pts_;
+ bool abort_;
+ vpx_codec_enc_cfg_t cfg_;
+ vpx_codec_dec_cfg_t dec_cfg_;
+ unsigned int passes_;
+ unsigned long deadline_;
+ TwopassStatsStore stats_;
+ unsigned long init_flags_;
+ unsigned long frame_flags_;
+ vpx_codec_pts_t last_pts_;
};
} // namespace libvpx_test