History

cleanup cpplint warnings

Suggested by James Zern to clear out cpplint warnings for all unit test code.

Yaowu Xu committed 13 years ago

Commit afffa3d1 parent e4e864527 files · +112 −102Browse files

Unified · Split

27 files
  1. test/acm_random.h +3 −3
  2. test/borders_test.cc +1 −1
  3. test/clear_system_state.h +1 −1
  4. test/datarate_test.cc +1 −1
  5. test/dct16x16_test.cc +8 −6
  6. test/dct32x32_test.cc +2 −2
  7. test/decode_test_driver.h +3 −4
  8. test/encode_test_driver.cc +10 −10
  9. test/fdct4x4_test.cc +3 −3
  10. test/i420_video_source.h +1 −1
  11. test/idct8x8_test.cc +5 −5
  12. test/idct_test.cc +2 −2
  13. test/intrapred_test.cc +4 −4
  14. test/ivf_video_source.h +1 −1
  15. test/keyframe_test.cc +0 −1
  16. test/md5_helper.h +3 −3
  17. test/pp_filter_test.cc +4 −3
  18. test/register_state_check.h +3 −3
  19. test/sad_test.cc +0 −1
  20. test/set_roi.cc +8 −4
  21. test/subtract_test.cc +3 −3
  22. test/test_libvpx.cc +4 −2
  23. test/variance_test.cc +8 −8
  24. test/vp8_boolcoder_test.cc +18 −16
  25. test/vp8_decrypt_test.cc +5 −3
  26. test/vp8_fdct4x4_test.cc +1 −1
  27. test/vp9_boolcoder_test.cc +10 −10
test/acm_random.h+3−3
@@ -8,8 +8,8 @@ · 7 unmodified lines
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#ifndef LIBVPX_TEST_ACM_RANDOM_H_11#ifndef TEST_ACM_RANDOM_H_
12#define LIBVPX_TEST_ACM_RANDOM_H_12#define TEST_ACM_RANDOM_H_
13 13
14#include "third_party/googletest/src/include/gtest/gtest.h"14#include "third_party/googletest/src/include/gtest/gtest.h"
15 15
@@ -59,4 +59,4 @@ class ACMRandom { · 43 unmodified lines
59 59
60} // namespace libvpx_test60} // namespace libvpx_test
61 61
62#endif // LIBVPX_TEST_ACM_RANDOM_H_62#endif // TEST_ACM_RANDOM_H_
test/borders_test.cc+1−1
@@ -29,7 +29,7 @@ class BordersTest : public ::libvpx_test::EncoderTest, · 28 unmodified lines
29 29
30 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,30 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
31 ::libvpx_test::Encoder *encoder) {31 ::libvpx_test::Encoder *encoder) {
32 if ( video->frame() == 1) {32 if (video->frame() == 1) {
33 encoder->Control(VP8E_SET_CPUUSED, 0);33 encoder->Control(VP8E_SET_CPUUSED, 0);
34 encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);34 encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
35 encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7);35 encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7);
test/clear_system_state.h+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
10#ifndef TEST_CLEAR_SYSTEM_STATE_H_10#ifndef TEST_CLEAR_SYSTEM_STATE_H_
11#define TEST_CLEAR_SYSTEM_STATE_H_11#define TEST_CLEAR_SYSTEM_STATE_H_
12 12
13#include "vpx_config.h"13#include "./vpx_config.h"
14extern "C" {14extern "C" {
15#if ARCH_X86 || ARCH_X86_6415#if ARCH_X86 || ARCH_X86_64
16# include "vpx_ports/x86.h"16# include "vpx_ports/x86.h"
test/datarate_test.cc+1−1
@@ -75,7 +75,7 @@ class DatarateTest : public ::libvpx_test::EncoderTest, · 74 unmodified lines
75 bits_in_buffer_model_ -= frame_size_in_bits;75 bits_in_buffer_model_ -= frame_size_in_bits;
76 76
77 // Update the running total of bits for end of test datarate checks.77 // Update the running total of bits for end of test datarate checks.
78 bits_total_ += frame_size_in_bits ;78 bits_total_ += frame_size_in_bits;
79 79
80 // If first drop not set and we have a drop set it to this time.80 // If first drop not set and we have a drop set it to this time.
81 if (!first_drop_ && duration > 1)81 if (!first_drop_ && duration > 1)
test/dct16x16_test.cc+8−6
@@ -17,11 +17,11 @@ · 16 unmodified lines
17 17
18extern "C" {18extern "C" {
19#include "vp9/common/vp9_entropy.h"19#include "vp9/common/vp9_entropy.h"
20#include "vp9_rtcd.h"20#include "./vp9_rtcd.h"
21void vp9_short_idct16x16_add_c(short *input, uint8_t *output, int pitch);21void vp9_short_idct16x16_add_c(int16_t *input, uint8_t *output, int pitch);
22}22}
23 23
24#include "acm_random.h"24#include "test/acm_random.h"
25#include "vpx/vpx_integer.h"25#include "vpx/vpx_integer.h"
26 26
27using libvpx_test::ACMRandom;27using libvpx_test::ACMRandom;
@@ -31,9 +31,9 @@ namespace { · 3 unmodified lines
31#ifdef _MSC_VER31#ifdef _MSC_VER
32static int round(double x) {32static int round(double x) {
33 if (x < 0)33 if (x < 0)
34 return (int)ceil(x - 0.5);34 return static_cast<int>(ceil(x - 0.5));
35 else35 else
36 return (int)floor(x + 0.5);36 return static_cast<int>(floor(x + 0.5));
37}37}
38#endif38#endif
39 39
@@ -45,7 +45,9 @@ void reference2_16x16_idct_2d(double *input, double *output) { · 5 unmodified lines
45 double s = 0;45 double s = 0;
46 for (int i = 0; i < 16; ++i) {46 for (int i = 0; i < 16; ++i) {
47 for (int j = 0; j < 16; ++j) {47 for (int j = 0; j < 16; ++j) {
48 x=cos(PI*j*(l+0.5)/16.0)*cos(PI*i*(k+0.5)/16.0)*input[i*16+j]/256;48 x = cos(PI * j * (l + 0.5) / 16.0) *
49 cos(PI * i * (k + 0.5) / 16.0) *
50 input[i * 16 + j] / 256;
49 if (i != 0)51 if (i != 0)
50 x *= sqrt(2.0);52 x *= sqrt(2.0);
51 if (j != 0)53 if (j != 0)
test/dct32x32_test.cc+2−2
@@ -32,9 +32,9 @@ namespace { · 31 unmodified lines
32#ifdef _MSC_VER32#ifdef _MSC_VER
33static int round(double x) {33static int round(double x) {
34 if (x < 0)34 if (x < 0)
35 return (int)ceil(x - 0.5);35 return static_cast<int>(ceil(x - 0.5));
36 else36 else
37 return (int)floor(x + 0.5);37 return static_cast<int>(floor(x + 0.5));
38}38}
39#endif39#endif
40 40
test/decode_test_driver.h+3−4
@@ -12,7 +12,7 @@ · 11 unmodified lines
12#define TEST_DECODE_TEST_DRIVER_H_12#define TEST_DECODE_TEST_DRIVER_H_
13#include <cstring>13#include <cstring>
14#include "third_party/googletest/src/include/gtest/gtest.h"14#include "third_party/googletest/src/include/gtest/gtest.h"
15#include "vpx_config.h"15#include "./vpx_config.h"
16#include "vpx/vpx_decoder.h"16#include "vpx/vpx_decoder.h"
17 17
18namespace libvpx_test {18namespace libvpx_test {
@@ -36,9 +36,8 @@ class DxDataIterator { · 17 unmodified lines
36};36};
37 37
38// Provides a simplified interface to manage one video decoding.38// Provides a simplified interface to manage one video decoding.
39//39// Similar to Encoder class, the exact services should be added
40// TODO: similar to Encoder class, the exact services should be40// as more tests are added.
41// added as more tests are added.
42class Decoder {41class Decoder {
43 public:42 public:
44 Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)43 Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
test/encode_test_driver.cc+10−10
@@ -8,7 +8,7 @@ · 7 unmodified lines
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 "vpx_config.h"11#include "./vpx_config.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/decode_test_driver.h"14#include "test/decode_test_driver.h"
@@ -114,19 +114,19 @@ static bool compare_img(const vpx_image_t *img1, · 99 unmodified lines
114 const unsigned int height_y = img1->d_h;114 const unsigned int height_y = img1->d_h;
115 unsigned int i;115 unsigned int i;
116 for (i = 0; i < height_y; ++i)116 for (i = 0; i < height_y; ++i)
117 match = ( memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y],117 match = (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y],
118 img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y],118 img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y],
119 width_y) == 0) && match;119 width_y) == 0) && match;
120 const unsigned int width_uv = (img1->d_w + 1) >> 1;120 const unsigned int width_uv = (img1->d_w + 1) >> 1;
121 const unsigned int height_uv = (img1->d_h + 1) >> 1;121 const unsigned int height_uv = (img1->d_h + 1) >> 1;
122 for (i = 0; i < height_uv; ++i)122 for (i = 0; i < height_uv; ++i)
123 match = ( memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U],123 match = (memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U],
124 img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U],124 img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U],
125 width_uv) == 0) && match;125 width_uv) == 0) && match;
126 for (i = 0; i < height_uv; ++i)126 for (i = 0; i < height_uv; ++i)
127 match = ( memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V],127 match = (memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V],
128 img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V],128 img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V],
129 width_uv) == 0) && match;129 width_uv) == 0) && match;
130 return match;130 return match;
131}131}
132 132
test/fdct4x4_test.cc+3−3
@@ -15,10 +15,10 @@ · 14 unmodified lines
15#include "third_party/googletest/src/include/gtest/gtest.h"15#include "third_party/googletest/src/include/gtest/gtest.h"
16 16
17extern "C" {17extern "C" {
18#include "vp9_rtcd.h"18#include "./vp9_rtcd.h"
19}19}
20 20
21#include "acm_random.h"21#include "test/acm_random.h"
22#include "vpx/vpx_integer.h"22#include "vpx/vpx_integer.h"
23#include "vpx_ports/mem.h"23#include "vpx_ports/mem.h"
24 24
@@ -156,7 +156,7 @@ TEST_P(FwdTrans4x4Test, RoundTripErrorCheck) { · 131 unmodified lines
156 RunFwdTxfm(test_input_block, test_temp_block, dst, pitch, tx_type_);156 RunFwdTxfm(test_input_block, test_temp_block, dst, pitch, tx_type_);
157 157
158 for (int j = 0; j < 16; ++j) {158 for (int j = 0; j < 16; ++j) {
159 if(test_temp_block[j] > 0) {159 if (test_temp_block[j] > 0) {
160 test_temp_block[j] += 2;160 test_temp_block[j] += 2;
161 test_temp_block[j] /= 4;161 test_temp_block[j] /= 4;
162 test_temp_block[j] *= 4;162 test_temp_block[j] *= 4;
test/i420_video_source.h+1−1
@@ -11,6 +11,7 @@ · 10 unmodified lines
11#define TEST_I420_VIDEO_SOURCE_H_11#define TEST_I420_VIDEO_SOURCE_H_
12#include <cstdio>12#include <cstdio>
13#include <cstdlib>13#include <cstdlib>
14#include <string>
14 15
15#include "test/video_source.h"16#include "test/video_source.h"
16 17
@@ -34,7 +35,6 @@ class I420VideoSource : public VideoSource { · 17 unmodified lines
34 height_(0),35 height_(0),
35 framerate_numerator_(rate_numerator),36 framerate_numerator_(rate_numerator),
36 framerate_denominator_(rate_denominator) {37 framerate_denominator_(rate_denominator) {
37
38 // This initializes raw_sz_, width_, height_ and allocates an img.38 // This initializes raw_sz_, width_, height_ and allocates an img.
39 SetSize(width, height);39 SetSize(width, height);
40 }40 }
test/idct8x8_test.cc+5−5
@@ -15,10 +15,10 @@ · 14 unmodified lines
15#include "third_party/googletest/src/include/gtest/gtest.h"15#include "third_party/googletest/src/include/gtest/gtest.h"
16 16
17extern "C" {17extern "C" {
18#include "vp9_rtcd.h"18#include "./vp9_rtcd.h"
19}19}
20 20
21#include "acm_random.h"21#include "test/acm_random.h"
22#include "vpx/vpx_integer.h"22#include "vpx/vpx_integer.h"
23 23
24using libvpx_test::ACMRandom;24using libvpx_test::ACMRandom;
@@ -27,10 +27,10 @@ namespace { · 2 unmodified lines
27 27
28#ifdef _MSC_VER28#ifdef _MSC_VER
29static int round(double x) {29static int round(double x) {
30 if(x < 0)30 if (x < 0)
31 return (int)ceil(x - 0.5);31 return static_cast<int>(ceil(x - 0.5));
32 else32 else
33 return (int)floor(x + 0.5);33 return static_cast<int>(floor(x + 0.5));
34}34}
35#endif35#endif
36 36
test/idct_test.cc+2−2
@@ -16,7 +16,7 @@ extern "C" { · 15 unmodified lines
16#include "test/register_state_check.h"16#include "test/register_state_check.h"
17#include "third_party/googletest/src/include/gtest/gtest.h"17#include "third_party/googletest/src/include/gtest/gtest.h"
18 18
19typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr,19typedef void (*idct_fn_t)(int16_t *input, unsigned char *pred_ptr,
20 int pred_stride, unsigned char *dst_ptr,20 int pred_stride, unsigned char *dst_ptr,
21 int dst_stride);21 int dst_stride);
22namespace {22namespace {
@@ -34,7 +34,7 @@ class IDCTTest : public ::testing::TestWithParam<idct_fn_t> { · 11 unmodified lines
34 virtual void TearDown() { libvpx_test::ClearSystemState(); }34 virtual void TearDown() { libvpx_test::ClearSystemState(); }
35 35
36 idct_fn_t UUT;36 idct_fn_t UUT;
37 short input[16];37 int16_t input[16];
38 unsigned char output[256];38 unsigned char output[256];
39 unsigned char predict[256];39 unsigned char predict[256];
40};40};
test/intrapred_test.cc+4−4
@@ -15,8 +15,8 @@ · 14 unmodified lines
15#include "test/register_state_check.h"15#include "test/register_state_check.h"
16#include "third_party/googletest/src/include/gtest/gtest.h"16#include "third_party/googletest/src/include/gtest/gtest.h"
17extern "C" {17extern "C" {
18#include "vpx_config.h"18#include "./vpx_config.h"
19#include "vp8_rtcd.h"19#include "./vp8_rtcd.h"
20#include "vp8/common/blockd.h"20#include "vp8/common/blockd.h"
21#include "vpx_mem/vpx_mem.h"21#include "vpx_mem/vpx_mem.h"
22}22}
@@ -106,9 +106,9 @@ class IntraPredBase { · 83 unmodified lines
106 for (int y = 0; y < block_size_; y++)106 for (int y = 0; y < block_size_; y++)
107 sum += data_ptr_[p][y * stride_ - 1];107 sum += data_ptr_[p][y * stride_ - 1];
108 expected = (sum + (1 << (shift - 1))) >> shift;108 expected = (sum + (1 << (shift - 1))) >> shift;
109 } else109 } else {
110 expected = 0x80;110 expected = 0x80;
111 111 }
112 // check that all subsequent lines are equal to the first112 // check that all subsequent lines are equal to the first
113 for (int y = 1; y < block_size_; ++y)113 for (int y = 1; y < block_size_; ++y)
114 ASSERT_EQ(0, memcmp(data_ptr_[p], &data_ptr_[p][y * stride_],114 ASSERT_EQ(0, memcmp(data_ptr_[p], &data_ptr_[p][y * stride_],
test/ivf_video_source.h+1−1
@@ -28,7 +28,7 @@ static unsigned int MemGetLe32(const uint8_t *mem) { · 27 unmodified lines
28// so that we can do actual file decodes.28// so that we can do actual file decodes.
29class IVFVideoSource : public CompressedVideoSource {29class IVFVideoSource : public CompressedVideoSource {
30 public:30 public:
31 IVFVideoSource(const std::string &file_name)31 explicit IVFVideoSource(const std::string &file_name)
32 : file_name_(file_name),32 : file_name_(file_name),
33 input_file_(NULL),33 input_file_(NULL),
34 compressed_frame_buf_(NULL),34 compressed_frame_buf_(NULL),
test/keyframe_test.cc+0−1
@@ -132,7 +132,6 @@ TEST_P(KeyframeTest, TestAutoKeyframe) { · 131 unmodified lines
132 // Verify that keyframes match the file keyframes in the file.132 // Verify that keyframes match the file keyframes in the file.
133 for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();133 for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
134 iter != kf_pts_list_.end(); ++iter) {134 iter != kf_pts_list_.end(); ++iter) {
135
136 if (deadline_ == VPX_DL_REALTIME && *iter > 0)135 if (deadline_ == VPX_DL_REALTIME && *iter > 0)
137 EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame "136 EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame "
138 << *iter;137 << *iter;
test/md5_helper.h+3−3
@@ -8,8 +8,8 @@ · 7 unmodified lines
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#ifndef LIBVPX_TEST_MD5_HELPER_H_11#ifndef TEST_MD5_HELPER_H_
12#define LIBVPX_TEST_MD5_HELPER_H_12#define TEST_MD5_HELPER_H_
13 13
14extern "C" {14extern "C" {
15#include "./md5_utils.h"15#include "./md5_utils.h"
@@ -67,4 +67,4 @@ class MD5 { · 51 unmodified lines
67 67
68} // namespace libvpx_test68} // namespace libvpx_test
69 69
70#endif // LIBVPX_TEST_MD5_HELPER_H_70#endif // TEST_MD5_HELPER_H_
test/pp_filter_test.cc+4−3
@@ -11,8 +11,8 @@ · 10 unmodified lines
11#include "test/register_state_check.h"11#include "test/register_state_check.h"
12#include "third_party/googletest/src/include/gtest/gtest.h"12#include "third_party/googletest/src/include/gtest/gtest.h"
13extern "C" {13extern "C" {
14#include "vpx_config.h"14#include "./vpx_config.h"
15#include "vp8_rtcd.h"15#include "./vp8_rtcd.h"
16#include "vpx/vpx_integer.h"16#include "vpx/vpx_integer.h"
17#include "vpx_mem/vpx_mem.h"17#include "vpx_mem/vpx_mem.h"
18}18}
@@ -63,7 +63,8 @@ TEST_P(Vp8PostProcessingFilterTest, FilterOutputCheck) { · 44 unmodified lines
63 // Pointers to top-left pixel of block in the input and output images.63 // Pointers to top-left pixel of block in the input and output images.
64 uint8_t *const src_image_ptr = src_image + (input_stride << 1);64 uint8_t *const src_image_ptr = src_image + (input_stride << 1);
65 uint8_t *const dst_image_ptr = dst_image + 8;65 uint8_t *const dst_image_ptr = dst_image + 8;
66 uint8_t *const flimits = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width));66 uint8_t *const flimits =
67 reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width));
67 (void)vpx_memset(flimits, 255, block_width);68 (void)vpx_memset(flimits, 255, block_width);
68 69
69 // Initialize pixels in the input:70 // Initialize pixels in the input:
test/register_state_check.h+3−3
@@ -8,8 +8,8 @@ · 7 unmodified lines
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#ifndef LIBVPX_TEST_REGISTER_STATE_CHECK_H_11#ifndef TEST_REGISTER_STATE_CHECK_H_
12#define LIBVPX_TEST_REGISTER_STATE_CHECK_H_12#define TEST_REGISTER_STATE_CHECK_H_
13 13
14#ifdef _WIN6414#ifdef _WIN64
15 15
@@ -92,4 +92,4 @@ class RegisterStateCheck {}; · 76 unmodified lines
92 92
93#endif // _WIN6493#endif // _WIN64
94 94
95#endif // LIBVPX_TEST_REGISTER_STATE_CHECK_H_95#endif // TEST_REGISTER_STATE_CHECK_H_
test/sad_test.cc+0−1
@@ -17,7 +17,6 @@ extern "C" { · 16 unmodified lines
17#include "./vpx_config.h"17#include "./vpx_config.h"
18#if CONFIG_VP8_ENCODER18#if CONFIG_VP8_ENCODER
19#include "./vp8_rtcd.h"19#include "./vp8_rtcd.h"
20//#include "vp8/common/blockd.h"
21#endif20#endif
22#if CONFIG_VP9_ENCODER21#if CONFIG_VP9_ENCODER
23#include "./vp9_rtcd.h"22#include "./vp9_rtcd.h"
test/set_roi.cc+8−4
@@ -17,15 +17,19 @@ · 16 unmodified lines
17#include <sys/types.h>17#include <sys/types.h>
18 18
19#include "third_party/googletest/src/include/gtest/gtest.h"19#include "third_party/googletest/src/include/gtest/gtest.h"
20#include "test/acm_random.h"
20#include "vpx/vpx_integer.h"21#include "vpx/vpx_integer.h"
21#include "vpx_mem/vpx_mem.h"22#include "vpx_mem/vpx_mem.h"
22extern "C" {23extern "C" {
23#include "vp8/encoder/onyx_int.h"24#include "vp8/encoder/onyx_int.h"
24}25}
25 26
27using libvpx_test::ACMRandom;
28
26namespace {29namespace {
27 30
28TEST(Vp8RoiMapTest, ParameterCheck) {31TEST(Vp8RoiMapTest, ParameterCheck) {
32 ACMRandom rnd(ACMRandom::DeterministicSeed());
29 int delta_q[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };33 int delta_q[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
30 int delta_lf[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };34 int delta_lf[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
31 unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };35 unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };
@@ -121,10 +125,10 @@ TEST(Vp8RoiMapTest, ParameterCheck) { · 89 unmodified lines
121 for (int i = 0; i < 1000; ++i) {125 for (int i = 0; i < 1000; ++i) {
122 int rand_deltas[4];126 int rand_deltas[4];
123 int deltas_valid;127 int deltas_valid;
124 rand_deltas[0] = (rand() % 160) - 80;128 rand_deltas[0] = rnd(160) - 80;
125 rand_deltas[1] = (rand() % 160) - 80;129 rand_deltas[1] = rnd(160) - 80;
126 rand_deltas[2] = (rand() % 160) - 80;130 rand_deltas[2] = rnd(160) - 80;
127 rand_deltas[3] = (rand() % 160) - 80;131 rand_deltas[3] = rnd(160) - 80;
128 132
129 deltas_valid = ((abs(rand_deltas[0]) <= 63) &&133 deltas_valid = ((abs(rand_deltas[0]) <= 63) &&
130 (abs(rand_deltas[1]) <= 63) &&134 (abs(rand_deltas[1]) <= 63) &&
test/subtract_test.cc+3−3
@@ -13,8 +13,8 @@ · 12 unmodified lines
13#include "test/clear_system_state.h"13#include "test/clear_system_state.h"
14#include "test/register_state_check.h"14#include "test/register_state_check.h"
15extern "C" {15extern "C" {
16#include "vpx_config.h"16#include "./vpx_config.h"
17#include "vp8_rtcd.h"17#include "./vp8_rtcd.h"
18#include "vp8/common/blockd.h"18#include "vp8/common/blockd.h"
19#include "vp8/encoder/block.h"19#include "vp8/encoder/block.h"
20#include "vpx_mem/vpx_mem.h"20#include "vpx_mem/vpx_mem.h"
@@ -51,7 +51,7 @@ TEST_P(SubtractBlockTest, SimpleSubtract) { · 30 unmodified lines
51 bd.predictor = reinterpret_cast<unsigned char*>(51 bd.predictor = reinterpret_cast<unsigned char*>(
52 vpx_memalign(16, kBlockHeight * kDiffPredStride * sizeof(*bd.predictor)));52 vpx_memalign(16, kBlockHeight * kDiffPredStride * sizeof(*bd.predictor)));
53 53
54 for(int i = 0; kSrcStride[i] > 0; ++i) {54 for (int i = 0; kSrcStride[i] > 0; ++i) {
55 // start at block055 // start at block0
56 be.src = 0;56 be.src = 0;
57 be.base_src = &source;57 be.base_src = &source;
test/test_libvpx.cc+4−2
@@ -8,7 +8,7 @@ · 7 unmodified lines
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#include <string>10#include <string>
11#include "vpx_config.h"11#include "./vpx_config.h"
12extern "C" {12extern "C" {
13#if ARCH_X86 || ARCH_X86_6413#if ARCH_X86 || ARCH_X86_64
14#include "vpx_ports/x86.h"14#include "vpx_ports/x86.h"
@@ -48,7 +48,9 @@ int main(int argc, char **argv) { · 33 unmodified lines
48#endif48#endif
49 49
50#if !CONFIG_SHARED50#if !CONFIG_SHARED
51 /* Shared library builds don't support whitebox tests that exercise internal symbols. */51// Shared library builds don't support whitebox tests
52// that exercise internal symbols.
53
52#if CONFIG_VP854#if CONFIG_VP8
53 vp8_rtcd();55 vp8_rtcd();
54#endif56#endif
test/variance_test.cc+8−8
@@ -16,16 +16,16 @@ · 15 unmodified lines
16#include "test/register_state_check.h"16#include "test/register_state_check.h"
17 17
18#include "vpx/vpx_integer.h"18#include "vpx/vpx_integer.h"
19#include "vpx_config.h"19#include "./vpx_config.h"
20extern "C" {20extern "C" {
21#include "vpx_mem/vpx_mem.h"21#include "vpx_mem/vpx_mem.h"
22#if CONFIG_VP8_ENCODER22#if CONFIG_VP8_ENCODER
23# include "vp8/common/variance.h"23# include "vp8/common/variance.h"
24# include "vp8_rtcd.h"24# include "./vp8_rtcd.h"
25#endif25#endif
26#if CONFIG_VP9_ENCODER26#if CONFIG_VP9_ENCODER
27# include "vp9/encoder/vp9_variance.h"27# include "vp9/encoder/vp9_variance.h"
28# include "vp9_rtcd.h"28# include "./vp9_rtcd.h"
29#endif29#endif
30}30}
31#include "test/acm_random.h"31#include "test/acm_random.h"
@@ -107,8 +107,8 @@ static unsigned int subpel_avg_variance_ref(const uint8_t *ref, · 75 unmodified lines
107}107}
108 108
109template<typename VarianceFunctionType>109template<typename VarianceFunctionType>
110class VarianceTest :110class VarianceTest
111 public ::testing::TestWithParam<tuple<int, int, VarianceFunctionType> > {111 : public ::testing::TestWithParam<tuple<int, int, VarianceFunctionType> > {
112 public:112 public:
113 virtual void SetUp() {113 virtual void SetUp() {
114 const tuple<int, int, VarianceFunctionType>& params = this->GetParam();114 const tuple<int, int, VarianceFunctionType>& params = this->GetParam();
@@ -191,9 +191,9 @@ void VarianceTest<VarianceFunctionType>::OneQuarterTest() { · 76 unmodified lines
191}191}
192 192
193template<typename SubpelVarianceFunctionType>193template<typename SubpelVarianceFunctionType>
194class SubpelVarianceTest :194class SubpelVarianceTest
195 public ::testing::TestWithParam<tuple<int, int,195 : public ::testing::TestWithParam<tuple<int, int,
196 SubpelVarianceFunctionType> > {196 SubpelVarianceFunctionType> > {
197 public:197 public:
198 virtual void SetUp() {198 virtual void SetUp() {
199 const tuple<int, int, SubpelVarianceFunctionType>& params =199 const tuple<int, int, SubpelVarianceFunctionType>& params =
test/vp8_boolcoder_test.cc+18−16
@@ -8,10 +8,6 @@ · 7 unmodified lines
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
11extern "C" {
12#include "vp8/encoder/boolhuff.h"
13#include "vp8/decoder/dboolhuff.h"
14}
15 11
16#include <math.h>12#include <math.h>
17#include <stddef.h>13#include <stddef.h>
@@ -24,6 +20,11 @@ extern "C" { · 6 unmodified lines
24#include "third_party/googletest/src/include/gtest/gtest.h"20#include "third_party/googletest/src/include/gtest/gtest.h"
25#include "vpx/vpx_integer.h"21#include "vpx/vpx_integer.h"
26 22
23extern "C" {
24#include "vp8/encoder/boolhuff.h"
25#include "vp8/decoder/dboolhuff.h"
26}
27
27namespace {28namespace {
28const int num_tests = 10;29const int num_tests = 10;
29 30
@@ -44,7 +45,7 @@ void encrypt_buffer(uint8_t *buffer, int size) { · 14 unmodified lines
44 45
45void test_decrypt_cb(void *decrypt_state, const uint8_t *input,46void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
46 uint8_t *output, int count) {47 uint8_t *output, int count) {
47 int offset = input - (uint8_t *)decrypt_state;48 int offset = input - reinterpret_cast<uint8_t *>(decrypt_state);
48 for (int i = 0; i < count; i++) {49 for (int i = 0; i < count; i++) {
49 output[i] = input[i] ^ secret_key[(offset + i) & 15];50 output[i] = input[i] ^ secret_key[(offset + i) & 15];
50 }51 }
@@ -58,10 +59,10 @@ TEST(VP8, TestBitIO) { · 7 unmodified lines
58 ACMRandom rnd(ACMRandom::DeterministicSeed());59 ACMRandom rnd(ACMRandom::DeterministicSeed());
59 for (int n = 0; n < num_tests; ++n) {60 for (int n = 0; n < num_tests; ++n) {
60 for (int method = 0; method <= 7; ++method) { // we generate various proba61 for (int method = 0; method <= 7; ++method) { // we generate various proba
61 const int bits_to_test = 1000;62 const int kBitsToTest = 1000;
62 uint8_t probas[bits_to_test];63 uint8_t probas[kBitsToTest];
63 64
64 for (int i = 0; i < bits_to_test; ++i) {65 for (int i = 0; i < kBitsToTest; ++i) {
65 const int parity = i & 1;66 const int parity = i & 1;
66 probas[i] =67 probas[i] =
67 (method == 0) ? 0 : (method == 1) ? 255 :68 (method == 0) ? 0 : (method == 1) ? 255 :
@@ -76,14 +77,14 @@ TEST(VP8, TestBitIO) { · 8 unmodified lines
76 }77 }
77 for (int bit_method = 0; bit_method <= 3; ++bit_method) {78 for (int bit_method = 0; bit_method <= 3; ++bit_method) {
78 const int random_seed = 6432;79 const int random_seed = 6432;
79 const int buffer_size = 10000;80 const int kBufferSize = 10000;
80 ACMRandom bit_rnd(random_seed);81 ACMRandom bit_rnd(random_seed);
81 BOOL_CODER bw;82 BOOL_CODER bw;
82 uint8_t bw_buffer[buffer_size];83 uint8_t bw_buffer[kBufferSize];
83 vp8_start_encode(&bw, bw_buffer, bw_buffer + buffer_size);84 vp8_start_encode(&bw, bw_buffer, bw_buffer + kBufferSize);
84 85
85 int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;86 int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;
86 for (int i = 0; i < bits_to_test; ++i) {87 for (int i = 0; i < kBitsToTest; ++i) {
87 if (bit_method == 2) {88 if (bit_method == 2) {
88 bit = (i & 1);89 bit = (i & 1);
89 } else if (bit_method == 3) {90 } else if (bit_method == 3) {
@@ -98,19 +99,20 @@ TEST(VP8, TestBitIO) { · 8 unmodified lines
98#if CONFIG_DECRYPT99#if CONFIG_DECRYPT
99 encrypt_buffer(bw_buffer, buffer_size);100 encrypt_buffer(bw_buffer, buffer_size);
100 vp8dx_start_decode(&br, bw_buffer, buffer_size,101 vp8dx_start_decode(&br, bw_buffer, buffer_size,
101 test_decrypt_cb, (void *)bw_buffer);102 test_decrypt_cb,
103 reinterpret_cast<void *>(bw_buffer));
102#else104#else
103 vp8dx_start_decode(&br, bw_buffer, buffer_size, NULL, NULL);105 vp8dx_start_decode(&br, bw_buffer, kBufferSize, NULL, NULL);
104#endif106#endif
105 bit_rnd.Reset(random_seed);107 bit_rnd.Reset(random_seed);
106 for (int i = 0; i < bits_to_test; ++i) {108 for (int i = 0; i < kBitsToTest; ++i) {
107 if (bit_method == 2) {109 if (bit_method == 2) {
108 bit = (i & 1);110 bit = (i & 1);
109 } else if (bit_method == 3) {111 } else if (bit_method == 3) {
110 bit = bit_rnd(2);112 bit = bit_rnd(2);
111 }113 }
112 GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)114 GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
113 << "pos: "<< i << " / " << bits_to_test115 << "pos: "<< i << " / " << kBitsToTest
114 << " bit_method: " << bit_method116 << " bit_method: " << bit_method
115 << " method: " << method;117 << " method: " << method;
116 }118 }
test/vp8_decrypt_test.cc+5−3
@@ -26,7 +26,8 @@ const uint8_t test_key[16] = { · 25 unmodified lines
26 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf026 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
27};27};
28 28
29void encrypt_buffer(const uint8_t *src, uint8_t *dst, int size, int offset = 0) {29void encrypt_buffer(const uint8_t *src, uint8_t *dst,
30 int size, int offset = 0) {
30 for (int i = 0; i < size; ++i) {31 for (int i = 0; i < size; ++i) {
31 dst[i] = src[i] ^ test_key[(offset + i) & 15];32 dst[i] = src[i] ^ test_key[(offset + i) & 15];
32 }33 }
@@ -34,10 +35,11 @@ void encrypt_buffer(const uint8_t *src, uint8_t *dst, int size, int offset = 0) · 1 unmodified line
34 35
35void test_decrypt_cb(void *decrypt_state, const uint8_t *input,36void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
36 uint8_t *output, int count) {37 uint8_t *output, int count) {
37 encrypt_buffer(input, output, count, input - (uint8_t *)decrypt_state);38 encrypt_buffer(input, output, count,
39 input - reinterpret_cast<uint8_t *>(decrypt_state));
38}40}
39 41
40} // namespace42} // namespace
41 43
42namespace libvpx_test {44namespace libvpx_test {
43 45
test/vp8_fdct4x4_test.cc+1−1
@@ -18,7 +18,7 @@ · 17 unmodified lines
18 18
19 19
20extern "C" {20extern "C" {
21#include "vp8_rtcd.h"21#include "./vp8_rtcd.h"
22}22}
23 23
24#include "test/acm_random.h"24#include "test/acm_random.h"
test/vp9_boolcoder_test.cc+10−10
@@ -19,7 +19,7 @@ extern "C" { · 18 unmodified lines
19#include "vp9/decoder/vp9_dboolhuff.h"19#include "vp9/decoder/vp9_dboolhuff.h"
20}20}
21 21
22#include "acm_random.h"22#include "test/acm_random.h"
23#include "vpx/vpx_integer.h"23#include "vpx/vpx_integer.h"
24 24
25using libvpx_test::ACMRandom;25using libvpx_test::ACMRandom;
@@ -32,10 +32,10 @@ TEST(VP9, TestBitIO) { · 6 unmodified lines
32 ACMRandom rnd(ACMRandom::DeterministicSeed());32 ACMRandom rnd(ACMRandom::DeterministicSeed());
33 for (int n = 0; n < num_tests; ++n) {33 for (int n = 0; n < num_tests; ++n) {
34 for (int method = 0; method <= 7; ++method) { // we generate various proba34 for (int method = 0; method <= 7; ++method) { // we generate various proba
35 const int bits_to_test = 1000;35 const int kBitsToTest = 1000;
36 uint8_t probas[bits_to_test];36 uint8_t probas[kBitsToTest];
37 37
38 for (int i = 0; i < bits_to_test; ++i) {38 for (int i = 0; i < kBitsToTest; ++i) {
39 const int parity = i & 1;39 const int parity = i & 1;
40 probas[i] =40 probas[i] =
41 (method == 0) ? 0 : (method == 1) ? 255 :41 (method == 0) ? 0 : (method == 1) ? 255 :
@@ -50,14 +50,14 @@ TEST(VP9, TestBitIO) { · 8 unmodified lines
50 }50 }
51 for (int bit_method = 0; bit_method <= 3; ++bit_method) {51 for (int bit_method = 0; bit_method <= 3; ++bit_method) {
52 const int random_seed = 6432;52 const int random_seed = 6432;
53 const int buffer_size = 10000;53 const int kBufferSize = 10000;
54 ACMRandom bit_rnd(random_seed);54 ACMRandom bit_rnd(random_seed);
55 vp9_writer bw;55 vp9_writer bw;
56 uint8_t bw_buffer[buffer_size];56 uint8_t bw_buffer[kBufferSize];
57 vp9_start_encode(&bw, bw_buffer);57 vp9_start_encode(&bw, bw_buffer);
58 58
59 int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;59 int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;
60 for (int i = 0; i < bits_to_test; ++i) {60 for (int i = 0; i < kBitsToTest; ++i) {
61 if (bit_method == 2) {61 if (bit_method == 2) {
62 bit = (i & 1);62 bit = (i & 1);
63 } else if (bit_method == 3) {63 } else if (bit_method == 3) {
@@ -72,16 +72,16 @@ TEST(VP9, TestBitIO) { · 8 unmodified lines
72 GTEST_ASSERT_EQ(bw_buffer[0] & 0x80, 0);72 GTEST_ASSERT_EQ(bw_buffer[0] & 0x80, 0);
73 73
74 vp9_reader br;74 vp9_reader br;
75 vp9_reader_init(&br, bw_buffer, buffer_size);75 vp9_reader_init(&br, bw_buffer, kBufferSize);
76 bit_rnd.Reset(random_seed);76 bit_rnd.Reset(random_seed);
77 for (int i = 0; i < bits_to_test; ++i) {77 for (int i = 0; i < kBitsToTest; ++i) {
78 if (bit_method == 2) {78 if (bit_method == 2) {
79 bit = (i & 1);79 bit = (i & 1);
80 } else if (bit_method == 3) {80 } else if (bit_method == 3) {
81 bit = bit_rnd(2);81 bit = bit_rnd(2);
82 }82 }
83 GTEST_ASSERT_EQ(vp9_read(&br, probas[i]), bit)83 GTEST_ASSERT_EQ(vp9_read(&br, probas[i]), bit)
84 << "pos: " << i << " / " << bits_to_test84 << "pos: " << i << " / " << kBitsToTest
85 << " bit_method: " << bit_method85 << " bit_method: " << bit_method
86 << " method: " << method;86 << " method: " << method;
87 }87 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t