X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=test%2Fsuperframe_test.cc;h=a5c92e9147bc77894c9934a3dfd53a5d1ff6d5a9;hb=65d9ac5b5a3dd1c72c15a1fc5bcc004a43ad4c90;hp=b07bcb2843bdd93f8abea5771de7cd4811dca5fb;hpb=b34705f64ff0bc8facd0fc33fe07bf6def67cb45;p=platform%2Fupstream%2Flibvpx.git diff --git a/test/superframe_test.cc b/test/superframe_test.cc index b07bcb2..a5c92e9 100644 --- a/test/superframe_test.cc +++ b/test/superframe_test.cc @@ -8,6 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ #include +#include + #include "third_party/googletest/src/include/gtest/gtest.h" #include "test/codec_factory.h" #include "test/encode_test_driver.h" @@ -18,54 +20,49 @@ namespace { const int kTestMode = 0; -typedef std::tr1::tuple SuperframeTestParam; +typedef std::tuple SuperframeTestParam; -class SuperframeTest : public ::libvpx_test::EncoderTest, - public ::libvpx_test::CodecTestWithParam { +class SuperframeTest + : public ::libvpx_test::EncoderTest, + public ::libvpx_test::CodecTestWithParam { protected: - SuperframeTest() : EncoderTest(GET_PARAM(0)), modified_buf_(NULL), - last_sf_pts_(0) {} + SuperframeTest() + : EncoderTest(GET_PARAM(0)), modified_buf_(nullptr), last_sf_pts_(0) {} virtual ~SuperframeTest() {} virtual void SetUp() { InitializeConfig(); const SuperframeTestParam input = GET_PARAM(1); - const libvpx_test::TestMode mode = std::tr1::get(input); + const libvpx_test::TestMode mode = std::get(input); SetMode(mode); sf_count_ = 0; sf_count_max_ = INT_MAX; } - virtual void TearDown() { - delete[] modified_buf_; - } + virtual void TearDown() { delete[] modified_buf_; } virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video, libvpx_test::Encoder *encoder) { - if (video->frame() == 1) { + if (video->frame() == 0) { encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1); } } - virtual const vpx_codec_cx_pkt_t * MutateEncoderOutputHook( + virtual const vpx_codec_cx_pkt_t *MutateEncoderOutputHook( const vpx_codec_cx_pkt_t *pkt) { - if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) - return pkt; + if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return pkt; - const uint8_t *buffer = reinterpret_cast(pkt->data.frame.buf); + const uint8_t *buffer = reinterpret_cast(pkt->data.frame.buf); const uint8_t marker = buffer[pkt->data.frame.sz - 1]; const int frames = (marker & 0x7) + 1; const int mag = ((marker >> 3) & 3) + 1; const unsigned int index_sz = 2 + mag * frames; - if ((marker & 0xe0) == 0xc0 && - pkt->data.frame.sz >= index_sz && + if ((marker & 0xe0) == 0xc0 && pkt->data.frame.sz >= index_sz && buffer[pkt->data.frame.sz - index_sz] == marker) { // frame is a superframe. strip off the index. - if (modified_buf_) - delete[] modified_buf_; + if (modified_buf_) delete[] modified_buf_; modified_buf_ = new uint8_t[pkt->data.frame.sz - index_sz]; - memcpy(modified_buf_, pkt->data.frame.buf, - pkt->data.frame.sz - index_sz); + memcpy(modified_buf_, pkt->data.frame.buf, pkt->data.frame.sz - index_sz); modified_pkt_ = *pkt; modified_pkt_.data.frame.buf = modified_buf_; modified_pkt_.data.frame.sz -= index_sz; @@ -76,8 +73,8 @@ class SuperframeTest : public ::libvpx_test::EncoderTest, } // Make sure we do a few frames after the last SF - abort_ |= sf_count_ > sf_count_max_ && - pkt->data.frame.pts - last_sf_pts_ >= 5; + abort_ |= + sf_count_ > sf_count_max_ && pkt->data.frame.pts - last_sf_pts_ >= 5; return pkt; } @@ -98,7 +95,8 @@ TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) { EXPECT_EQ(sf_count_, 1); } -VP9_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Combine( - ::testing::Values(::libvpx_test::kTwoPassGood), - ::testing::Values(0))); +VP9_INSTANTIATE_TEST_SUITE( + SuperframeTest, + ::testing::Combine(::testing::Values(::libvpx_test::kTwoPassGood), + ::testing::Values(0))); } // namespace