Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: source/libvpx/test/vp9_lossless_test.cc

Issue 111463005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/vp8_fdct4x4_test.cc ('k') | source/libvpx/test/vp9_subtract_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright (c) 2012 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
3 3 *
4 Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "third_party/googletest/src/include/gtest/gtest.h" 11 #include "third_party/googletest/src/include/gtest/gtest.h"
12 #include "test/codec_factory.h" 12 #include "test/codec_factory.h"
13 #include "test/encode_test_driver.h" 13 #include "test/encode_test_driver.h"
14 #include "test/i420_video_source.h" 14 #include "test/i420_video_source.h"
15 #include "test/util.h" 15 #include "test/util.h"
16 16
17 namespace { 17 namespace {
18 18
19 const int kMaxPsnr = 100; 19 const int kMaxPsnr = 100;
20 20
21 class LossLessTest : public ::libvpx_test::EncoderTest, 21 class LossLessTest : public ::libvpx_test::EncoderTest,
22 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { 22 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
23 protected: 23 protected:
24 LossLessTest() : EncoderTest(GET_PARAM(0)), 24 LossLessTest() : EncoderTest(GET_PARAM(0)),
25 psnr_(kMaxPsnr), 25 psnr_(kMaxPsnr),
26 nframes_(0), 26 nframes_(0),
27 encoding_mode_(GET_PARAM(1)) { 27 encoding_mode_(GET_PARAM(1)) {
28 } 28 }
29 29
30 virtual ~LossLessTest() {} 30 virtual ~LossLessTest() {}
31 31
32 virtual void SetUp() { 32 virtual void SetUp() {
33 InitializeConfig(); 33 InitializeConfig();
34 SetMode(encoding_mode_); 34 SetMode(encoding_mode_);
35 } 35 }
36 36
37 virtual void BeginPassHook(unsigned int /*pass*/) { 37 virtual void BeginPassHook(unsigned int /*pass*/) {
38 psnr_ = 0.0; 38 psnr_ = kMaxPsnr;
39 nframes_ = 0; 39 nframes_ = 0;
40 } 40 }
41 41
42 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) { 42 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
43 if (pkt->data.psnr.psnr[0] < psnr_) 43 if (pkt->data.psnr.psnr[0] < psnr_)
44 psnr_= pkt->data.psnr.psnr[0]; 44 psnr_= pkt->data.psnr.psnr[0];
45 } 45 }
46 46
47 double GetMinPsnr() const { 47 double GetMinPsnr() const {
48 return psnr_; 48 return psnr_;
49 } 49 }
50 50
51 private: 51 private:
52 double psnr_; 52 double psnr_;
53 unsigned int nframes_; 53 unsigned int nframes_;
54 libvpx_test::TestMode encoding_mode_; 54 libvpx_test::TestMode encoding_mode_;
55 }; 55 };
56 56
57 TEST_P(LossLessTest, TestLossLessEncoding) { 57 TEST_P(LossLessTest, TestLossLessEncoding) {
58 const vpx_rational timebase = { 33333333, 1000000000 }; 58 const vpx_rational timebase = { 33333333, 1000000000 };
59 cfg_.g_timebase = timebase; 59 cfg_.g_timebase = timebase;
60 cfg_.rc_target_bitrate = 2000; 60 cfg_.rc_target_bitrate = 2000;
61 cfg_.g_lag_in_frames = 25; 61 cfg_.g_lag_in_frames = 25;
62 cfg_.rc_min_quantizer = 0; 62 cfg_.rc_min_quantizer = 0;
63 cfg_.rc_max_quantizer = 0; 63 cfg_.rc_max_quantizer = 0;
64 64
65 init_flags_ = VPX_CODEC_USE_PSNR; 65 init_flags_ = VPX_CODEC_USE_PSNR;
66 66
67 // intentionally changed the dimension for better testing coverage 67 // intentionally changed the dimension for better testing coverage
68 libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 356, 284, 68 libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
69 timebase.den, timebase.num, 0, 30); 69 timebase.den, timebase.num, 0, 10);
70 70 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
71 const double psnr_lossless = GetMinPsnr(); 71 const double psnr_lossless = GetMinPsnr();
72 EXPECT_GE(psnr_lossless, kMaxPsnr); 72 EXPECT_GE(psnr_lossless, kMaxPsnr);
73 } 73 }
74 VP9_INSTANTIATE_TEST_CASE(LossLessTest, ALL_TEST_MODES); 74 VP9_INSTANTIATE_TEST_CASE(LossLessTest, ALL_TEST_MODES);
75 } // namespace 75 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/vp8_fdct4x4_test.cc ('k') | source/libvpx/test/vp9_subtract_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698