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
88 * be found in the AUTHORS file in the root of the source tree.
99 */
1010
11−#ifndef LIBVPX_TEST_ACM_RANDOM_H_
12−#define LIBVPX_TEST_ACM_RANDOM_H_
11+#ifndef TEST_ACM_RANDOM_H_
12+#define TEST_ACM_RANDOM_H_
1313
1414 #include "third_party/googletest/src/include/gtest/gtest.h"
1515
@@ -59,4 +59,4 @@ class ACMRandom { · 43 unmodified lines
5959
6060 } // namespace libvpx_test
6161
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
2929
3030 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
3131 ::libvpx_test::Encoder *encoder) {
32− if ( video->frame() == 1) {
32+ if (video->frame() == 1) {
3333 encoder->Control(VP8E_SET_CPUUSED, 0);
3434 encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
3535 encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7);
test/clear_system_state.h+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 #ifndef TEST_CLEAR_SYSTEM_STATE_H_
1111 #define TEST_CLEAR_SYSTEM_STATE_H_
1212
13−#include "vpx_config.h"
13+#include "./vpx_config.h"
1414 extern "C" {
1515 #if ARCH_X86 || ARCH_X86_64
1616 # include "vpx_ports/x86.h"
test/datarate_test.cc+1−1
@@ -75,7 +75,7 @@ class DatarateTest : public ::libvpx_test::EncoderTest, · 74 unmodified lines
7575 bits_in_buffer_model_ -= frame_size_in_bits;
7676
7777 // 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;
7979
8080 // If first drop not set and we have a drop set it to this time.
8181 if (!first_drop_ && duration > 1)
test/dct16x16_test.cc+8−6
@@ -17,11 +17,11 @@ · 16 unmodified lines
1717
1818 extern "C" {
1919 #include "vp9/common/vp9_entropy.h"
20−#include "vp9_rtcd.h"
21−void vp9_short_idct16x16_add_c(short *input, uint8_t *output, int pitch);
20+#include "./vp9_rtcd.h"
21+void vp9_short_idct16x16_add_c(int16_t *input, uint8_t *output, int pitch);
2222 }
2323
24−#include "acm_random.h"
24+#include "test/acm_random.h"
2525 #include "vpx/vpx_integer.h"
2626
2727 using libvpx_test::ACMRandom;
@@ -31,9 +31,9 @@ namespace { · 3 unmodified lines
3131 #ifdef _MSC_VER
3232 static int round(double x) {
3333 if (x < 0)
34− return (int)ceil(x - 0.5);
34+ return static_cast<int>(ceil(x - 0.5));
3535 else
36− return (int)floor(x + 0.5);
36+ return static_cast<int>(floor(x + 0.5));
3737 }
3838 #endif
3939
@@ -45,7 +45,9 @@ void reference2_16x16_idct_2d(double *input, double *output) { · 5 unmodified lines
4545 double s = 0;
4646 for (int i = 0; i < 16; ++i) {
4747 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;
4951 if (i != 0)
5052 x *= sqrt(2.0);
5153 if (j != 0)
test/dct32x32_test.cc+2−2
@@ -32,9 +32,9 @@ namespace { · 31 unmodified lines
3232 #ifdef _MSC_VER
3333 static int round(double x) {
3434 if (x < 0)
35− return (int)ceil(x - 0.5);
35+ return static_cast<int>(ceil(x - 0.5));
3636 else
37− return (int)floor(x + 0.5);
37+ return static_cast<int>(floor(x + 0.5));
3838 }
3939 #endif
4040
test/decode_test_driver.h+3−4
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 #define TEST_DECODE_TEST_DRIVER_H_
1313 #include <cstring>
1414 #include "third_party/googletest/src/include/gtest/gtest.h"
15−#include "vpx_config.h"
15+#include "./vpx_config.h"
1616 #include "vpx/vpx_decoder.h"
1717
1818 namespace libvpx_test {
@@ -36,9 +36,8 @@ class DxDataIterator { · 17 unmodified lines
3636 };
3737
3838 // Provides a simplified interface to manage one video decoding.
39−//
40−// TODO: similar to Encoder class, the exact services should be
41−// added as more tests are added.
39+// Similar to Encoder class, the exact services should be added
40+// as more tests are added.
4241 class Decoder {
4342 public:
4443 Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
test/encode_test_driver.cc+10−10
@@ -8,7 +8,7 @@ · 7 unmodified lines
88 * be found in the AUTHORS file in the root of the source tree.
99 */
1010
11−#include "vpx_config.h"
11+#include "./vpx_config.h"
1212 #include "test/codec_factory.h"
1313 #include "test/encode_test_driver.h"
1414 #include "test/decode_test_driver.h"
@@ -114,19 +114,19 @@ static bool compare_img(const vpx_image_t *img1, · 99 unmodified lines
114114 const unsigned int height_y = img1->d_h;
115115 unsigned int i;
116116 for (i = 0; i < height_y; ++i)
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],
119− width_y) == 0) && match;
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],
119+ width_y) == 0) && match;
120120 const unsigned int width_uv = (img1->d_w + 1) >> 1;
121121 const unsigned int height_uv = (img1->d_h + 1) >> 1;
122122 for (i = 0; i < height_uv; ++i)
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],
125− width_uv) == 0) && match;
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],
125+ width_uv) == 0) && match;
126126 for (i = 0; i < height_uv; ++i)
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],
129− width_uv) == 0) && match;
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],
129+ width_uv) == 0) && match;
130130 return match;
131131 }
132132
test/fdct4x4_test.cc+3−3
@@ -15,10 +15,10 @@ · 14 unmodified lines
1515 #include "third_party/googletest/src/include/gtest/gtest.h"
1616
1717 extern "C" {
18−#include "vp9_rtcd.h"
18+#include "./vp9_rtcd.h"
1919 }
2020
21−#include "acm_random.h"
21+#include "test/acm_random.h"
2222 #include "vpx/vpx_integer.h"
2323 #include "vpx_ports/mem.h"
2424
@@ -156,7 +156,7 @@ TEST_P(FwdTrans4x4Test, RoundTripErrorCheck) { · 131 unmodified lines
156156 RunFwdTxfm(test_input_block, test_temp_block, dst, pitch, tx_type_);
157157
158158 for (int j = 0; j < 16; ++j) {
159− if(test_temp_block[j] > 0) {
159+ if (test_temp_block[j] > 0) {
160160 test_temp_block[j] += 2;
161161 test_temp_block[j] /= 4;
162162 test_temp_block[j] *= 4;
test/i420_video_source.h+1−1
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #define TEST_I420_VIDEO_SOURCE_H_
1212 #include <cstdio>
1313 #include <cstdlib>
14+#include <string>
1415
1516 #include "test/video_source.h"
1617
@@ -34,7 +35,6 @@ class I420VideoSource : public VideoSource { · 17 unmodified lines
3435 height_(0),
3536 framerate_numerator_(rate_numerator),
3637 framerate_denominator_(rate_denominator) {
37−
3838 // This initializes raw_sz_, width_, height_ and allocates an img.
3939 SetSize(width, height);
4040 }
test/idct8x8_test.cc+5−5
@@ -15,10 +15,10 @@ · 14 unmodified lines
1515 #include "third_party/googletest/src/include/gtest/gtest.h"
1616
1717 extern "C" {
18−#include "vp9_rtcd.h"
18+#include "./vp9_rtcd.h"
1919 }
2020
21−#include "acm_random.h"
21+#include "test/acm_random.h"
2222 #include "vpx/vpx_integer.h"
2323
2424 using libvpx_test::ACMRandom;
@@ -27,10 +27,10 @@ namespace { · 2 unmodified lines
2727
2828 #ifdef _MSC_VER
2929 static int round(double x) {
30− if(x < 0)
31− return (int)ceil(x - 0.5);
30+ if (x < 0)
31+ return static_cast<int>(ceil(x - 0.5));
3232 else
33− return (int)floor(x + 0.5);
33+ return static_cast<int>(floor(x + 0.5));
3434 }
3535 #endif
3636
test/idct_test.cc+2−2
@@ -16,7 +16,7 @@ extern "C" { · 15 unmodified lines
1616 #include "test/register_state_check.h"
1717 #include "third_party/googletest/src/include/gtest/gtest.h"
1818
19−typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr,
19+typedef void (*idct_fn_t)(int16_t *input, unsigned char *pred_ptr,
2020 int pred_stride, unsigned char *dst_ptr,
2121 int dst_stride);
2222 namespace {
@@ -34,7 +34,7 @@ class IDCTTest : public ::testing::TestWithParam<idct_fn_t> { · 11 unmodified lines
3434 virtual void TearDown() { libvpx_test::ClearSystemState(); }
3535
3636 idct_fn_t UUT;
37− short input[16];
37+ int16_t input[16];
3838 unsigned char output[256];
3939 unsigned char predict[256];
4040 };
test/intrapred_test.cc+4−4
@@ -15,8 +15,8 @@ · 14 unmodified lines
1515 #include "test/register_state_check.h"
1616 #include "third_party/googletest/src/include/gtest/gtest.h"
1717 extern "C" {
18−#include "vpx_config.h"
19−#include "vp8_rtcd.h"
18+#include "./vpx_config.h"
19+#include "./vp8_rtcd.h"
2020 #include "vp8/common/blockd.h"
2121 #include "vpx_mem/vpx_mem.h"
2222 }
@@ -106,9 +106,9 @@ class IntraPredBase { · 83 unmodified lines
106106 for (int y = 0; y < block_size_; y++)
107107 sum += data_ptr_[p][y * stride_ - 1];
108108 expected = (sum + (1 << (shift - 1))) >> shift;
109− } else
109+ } else {
110110 expected = 0x80;
111−
111+ }
112112 // check that all subsequent lines are equal to the first
113113 for (int y = 1; y < block_size_; ++y)
114114 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
2828 // so that we can do actual file decodes.
2929 class IVFVideoSource : public CompressedVideoSource {
3030 public:
31− IVFVideoSource(const std::string &file_name)
31+ explicit IVFVideoSource(const std::string &file_name)
3232 : file_name_(file_name),
3333 input_file_(NULL),
3434 compressed_frame_buf_(NULL),
test/keyframe_test.cc+0−1
@@ -132,7 +132,6 @@ TEST_P(KeyframeTest, TestAutoKeyframe) { · 131 unmodified lines
132132 // Verify that keyframes match the file keyframes in the file.
133133 for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
134134 iter != kf_pts_list_.end(); ++iter) {
135−
136135 if (deadline_ == VPX_DL_REALTIME && *iter > 0)
137136 EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame "
138137 << *iter;
test/md5_helper.h+3−3
@@ -8,8 +8,8 @@ · 7 unmodified lines
88 * be found in the AUTHORS file in the root of the source tree.
99 */
1010
11−#ifndef LIBVPX_TEST_MD5_HELPER_H_
12−#define LIBVPX_TEST_MD5_HELPER_H_
11+#ifndef TEST_MD5_HELPER_H_
12+#define TEST_MD5_HELPER_H_
1313
1414 extern "C" {
1515 #include "./md5_utils.h"
@@ -67,4 +67,4 @@ class MD5 { · 51 unmodified lines
6767
6868 } // namespace libvpx_test
6969
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
1111 #include "test/register_state_check.h"
1212 #include "third_party/googletest/src/include/gtest/gtest.h"
1313 extern "C" {
14−#include "vpx_config.h"
15−#include "vp8_rtcd.h"
14+#include "./vpx_config.h"
15+#include "./vp8_rtcd.h"
1616 #include "vpx/vpx_integer.h"
1717 #include "vpx_mem/vpx_mem.h"
1818 }
@@ -63,7 +63,8 @@ TEST_P(Vp8PostProcessingFilterTest, FilterOutputCheck) { · 44 unmodified lines
6363 // Pointers to top-left pixel of block in the input and output images.
6464 uint8_t *const src_image_ptr = src_image + (input_stride << 1);
6565 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));
6768 (void)vpx_memset(flimits, 255, block_width);
6869
6970 // Initialize pixels in the input:
test/register_state_check.h+3−3
@@ -8,8 +8,8 @@ · 7 unmodified lines
88 * be found in the AUTHORS file in the root of the source tree.
99 */
1010
11−#ifndef LIBVPX_TEST_REGISTER_STATE_CHECK_H_
12−#define LIBVPX_TEST_REGISTER_STATE_CHECK_H_
11+#ifndef TEST_REGISTER_STATE_CHECK_H_
12+#define TEST_REGISTER_STATE_CHECK_H_
1313
1414 #ifdef _WIN64
1515
@@ -92,4 +92,4 @@ class RegisterStateCheck {}; · 76 unmodified lines
9292
9393 #endif // _WIN64
9494
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
1717 #include "./vpx_config.h"
1818 #if CONFIG_VP8_ENCODER
1919 #include "./vp8_rtcd.h"
20−//#include "vp8/common/blockd.h"
2120 #endif
2221 #if CONFIG_VP9_ENCODER
2322 #include "./vp9_rtcd.h"
test/set_roi.cc+8−4
@@ -17,15 +17,19 @@ · 16 unmodified lines
1717 #include <sys/types.h>
1818
1919 #include "third_party/googletest/src/include/gtest/gtest.h"
20+#include "test/acm_random.h"
2021 #include "vpx/vpx_integer.h"
2122 #include "vpx_mem/vpx_mem.h"
2223 extern "C" {
2324 #include "vp8/encoder/onyx_int.h"
2425 }
2526
27+using libvpx_test::ACMRandom;
28+
2629 namespace {
2730
2831 TEST(Vp8RoiMapTest, ParameterCheck) {
32+ ACMRandom rnd(ACMRandom::DeterministicSeed());
2933 int delta_q[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
3034 int delta_lf[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
3135 unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };
@@ -121,10 +125,10 @@ TEST(Vp8RoiMapTest, ParameterCheck) { · 89 unmodified lines
121125 for (int i = 0; i < 1000; ++i) {
122126 int rand_deltas[4];
123127 int deltas_valid;
124− rand_deltas[0] = (rand() % 160) - 80;
125− rand_deltas[1] = (rand() % 160) - 80;
126− rand_deltas[2] = (rand() % 160) - 80;
127− rand_deltas[3] = (rand() % 160) - 80;
128+ rand_deltas[0] = rnd(160) - 80;
129+ rand_deltas[1] = rnd(160) - 80;
130+ rand_deltas[2] = rnd(160) - 80;
131+ rand_deltas[3] = rnd(160) - 80;
128132
129133 deltas_valid = ((abs(rand_deltas[0]) <= 63) &&
130134 (abs(rand_deltas[1]) <= 63) &&
test/subtract_test.cc+3−3
@@ -13,8 +13,8 @@ · 12 unmodified lines
1313 #include "test/clear_system_state.h"
1414 #include "test/register_state_check.h"
1515 extern "C" {
16−#include "vpx_config.h"
17−#include "vp8_rtcd.h"
16+#include "./vpx_config.h"
17+#include "./vp8_rtcd.h"
1818 #include "vp8/common/blockd.h"
1919 #include "vp8/encoder/block.h"
2020 #include "vpx_mem/vpx_mem.h"
@@ -51,7 +51,7 @@ TEST_P(SubtractBlockTest, SimpleSubtract) { · 30 unmodified lines
5151 bd.predictor = reinterpret_cast<unsigned char*>(
5252 vpx_memalign(16, kBlockHeight * kDiffPredStride * sizeof(*bd.predictor)));
5353
54− for(int i = 0; kSrcStride[i] > 0; ++i) {
54+ for (int i = 0; kSrcStride[i] > 0; ++i) {
5555 // start at block0
5656 be.src = 0;
5757 be.base_src = &source;
test/test_libvpx.cc+4−2
@@ -8,7 +8,7 @@ · 7 unmodified lines
88 * be found in the AUTHORS file in the root of the source tree.
99 */
1010 #include <string>
11−#include "vpx_config.h"
11+#include "./vpx_config.h"
1212 extern "C" {
1313 #if ARCH_X86 || ARCH_X86_64
1414 #include "vpx_ports/x86.h"
@@ -48,7 +48,9 @@ int main(int argc, char **argv) { · 33 unmodified lines
4848 #endif
4949
5050 #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+
5254 #if CONFIG_VP8
5355 vp8_rtcd();
5456 #endif
test/variance_test.cc+8−8
@@ -16,16 +16,16 @@ · 15 unmodified lines
1616 #include "test/register_state_check.h"
1717
1818 #include "vpx/vpx_integer.h"
19−#include "vpx_config.h"
19+#include "./vpx_config.h"
2020 extern "C" {
2121 #include "vpx_mem/vpx_mem.h"
2222 #if CONFIG_VP8_ENCODER
2323 # include "vp8/common/variance.h"
24−# include "vp8_rtcd.h"
24+# include "./vp8_rtcd.h"
2525 #endif
2626 #if CONFIG_VP9_ENCODER
2727 # include "vp9/encoder/vp9_variance.h"
28−# include "vp9_rtcd.h"
28+# include "./vp9_rtcd.h"
2929 #endif
3030 }
3131 #include "test/acm_random.h"
@@ -107,8 +107,8 @@ static unsigned int subpel_avg_variance_ref(const uint8_t *ref, · 75 unmodified lines
107107 }
108108
109109 template<typename VarianceFunctionType>
110−class VarianceTest :
111− public ::testing::TestWithParam<tuple<int, int, VarianceFunctionType> > {
110+class VarianceTest
111+ : public ::testing::TestWithParam<tuple<int, int, VarianceFunctionType> > {
112112 public:
113113 virtual void SetUp() {
114114 const tuple<int, int, VarianceFunctionType>& params = this->GetParam();
@@ -191,9 +191,9 @@ void VarianceTest<VarianceFunctionType>::OneQuarterTest() { · 76 unmodified lines
191191 }
192192
193193 template<typename SubpelVarianceFunctionType>
194−class SubpelVarianceTest :
195− public ::testing::TestWithParam<tuple<int, int,
196− SubpelVarianceFunctionType> > {
194+class SubpelVarianceTest
195+ : public ::testing::TestWithParam<tuple<int, int,
196+ SubpelVarianceFunctionType> > {
197197 public:
198198 virtual void SetUp() {
199199 const tuple<int, int, SubpelVarianceFunctionType>& params =
test/vp8_boolcoder_test.cc+18−16
@@ -8,10 +8,6 @@ · 7 unmodified lines
88 * be found in the AUTHORS file in the root of the source tree.
99 */
1010
11−extern "C" {
12−#include "vp8/encoder/boolhuff.h"
13−#include "vp8/decoder/dboolhuff.h"
14−}
1511
1612 #include <math.h>
1713 #include <stddef.h>
@@ -24,6 +20,11 @@ extern "C" { · 6 unmodified lines
2420 #include "third_party/googletest/src/include/gtest/gtest.h"
2521 #include "vpx/vpx_integer.h"
2622
23+extern "C" {
24+#include "vp8/encoder/boolhuff.h"
25+#include "vp8/decoder/dboolhuff.h"
26+}
27+
2728 namespace {
2829 const int num_tests = 10;
2930
@@ -44,7 +45,7 @@ void encrypt_buffer(uint8_t *buffer, int size) { · 14 unmodified lines
4445
4546 void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
4647 uint8_t *output, int count) {
47− int offset = input - (uint8_t *)decrypt_state;
48+ int offset = input - reinterpret_cast<uint8_t *>(decrypt_state);
4849 for (int i = 0; i < count; i++) {
4950 output[i] = input[i] ^ secret_key[(offset + i) & 15];
5051 }
@@ -58,10 +59,10 @@ TEST(VP8, TestBitIO) { · 7 unmodified lines
5859 ACMRandom rnd(ACMRandom::DeterministicSeed());
5960 for (int n = 0; n < num_tests; ++n) {
6061 for (int method = 0; method <= 7; ++method) { // we generate various proba
61− const int bits_to_test = 1000;
62− uint8_t probas[bits_to_test];
62+ const int kBitsToTest = 1000;
63+ uint8_t probas[kBitsToTest];
6364
64− for (int i = 0; i < bits_to_test; ++i) {
65+ for (int i = 0; i < kBitsToTest; ++i) {
6566 const int parity = i & 1;
6667 probas[i] =
6768 (method == 0) ? 0 : (method == 1) ? 255 :
@@ -76,14 +77,14 @@ TEST(VP8, TestBitIO) { · 8 unmodified lines
7677 }
7778 for (int bit_method = 0; bit_method <= 3; ++bit_method) {
7879 const int random_seed = 6432;
79− const int buffer_size = 10000;
80+ const int kBufferSize = 10000;
8081 ACMRandom bit_rnd(random_seed);
8182 BOOL_CODER bw;
82− uint8_t bw_buffer[buffer_size];
83− vp8_start_encode(&bw, bw_buffer, bw_buffer + buffer_size);
83+ uint8_t bw_buffer[kBufferSize];
84+ vp8_start_encode(&bw, bw_buffer, bw_buffer + kBufferSize);
8485
8586 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) {
8788 if (bit_method == 2) {
8889 bit = (i & 1);
8990 } else if (bit_method == 3) {
@@ -98,19 +99,20 @@ TEST(VP8, TestBitIO) { · 8 unmodified lines
9899 #if CONFIG_DECRYPT
99100 encrypt_buffer(bw_buffer, buffer_size);
100101 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));
102104 #else
103− vp8dx_start_decode(&br, bw_buffer, buffer_size, NULL, NULL);
105+ vp8dx_start_decode(&br, bw_buffer, kBufferSize, NULL, NULL);
104106 #endif
105107 bit_rnd.Reset(random_seed);
106− for (int i = 0; i < bits_to_test; ++i) {
108+ for (int i = 0; i < kBitsToTest; ++i) {
107109 if (bit_method == 2) {
108110 bit = (i & 1);
109111 } else if (bit_method == 3) {
110112 bit = bit_rnd(2);
111113 }
112114 GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
113− << "pos: "<< i << " / " << bits_to_test
115+ << "pos: "<< i << " / " << kBitsToTest
114116 << " bit_method: " << bit_method
115117 << " method: " << method;
116118 }
test/vp8_decrypt_test.cc+5−3
@@ -26,7 +26,8 @@ const uint8_t test_key[16] = { · 25 unmodified lines
2626 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
2727 };
2828
29−void encrypt_buffer(const uint8_t *src, uint8_t *dst, int size, int offset = 0) {
29+void encrypt_buffer(const uint8_t *src, uint8_t *dst,
30+ int size, int offset = 0) {
3031 for (int i = 0; i < size; ++i) {
3132 dst[i] = src[i] ^ test_key[(offset + i) & 15];
3233 }
@@ -34,10 +35,11 @@ void encrypt_buffer(const uint8_t *src, uint8_t *dst, int size, int offset = 0) · 1 unmodified line
3435
3536 void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
3637 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));
3840 }
3941
40−} // namespace
42+} // namespace
4143
4244 namespace libvpx_test {
4345
test/vp8_fdct4x4_test.cc+1−1
@@ -18,7 +18,7 @@ · 17 unmodified lines
1818
1919
2020 extern "C" {
21−#include "vp8_rtcd.h"
21+#include "./vp8_rtcd.h"
2222 }
2323
2424 #include "test/acm_random.h"
test/vp9_boolcoder_test.cc+10−10
@@ -19,7 +19,7 @@ extern "C" { · 18 unmodified lines
1919 #include "vp9/decoder/vp9_dboolhuff.h"
2020 }
2121
22−#include "acm_random.h"
22+#include "test/acm_random.h"
2323 #include "vpx/vpx_integer.h"
2424
2525 using libvpx_test::ACMRandom;
@@ -32,10 +32,10 @@ TEST(VP9, TestBitIO) { · 6 unmodified lines
3232 ACMRandom rnd(ACMRandom::DeterministicSeed());
3333 for (int n = 0; n < num_tests; ++n) {
3434 for (int method = 0; method <= 7; ++method) { // we generate various proba
35− const int bits_to_test = 1000;
36− uint8_t probas[bits_to_test];
35+ const int kBitsToTest = 1000;
36+ uint8_t probas[kBitsToTest];
3737
38− for (int i = 0; i < bits_to_test; ++i) {
38+ for (int i = 0; i < kBitsToTest; ++i) {
3939 const int parity = i & 1;
4040 probas[i] =
4141 (method == 0) ? 0 : (method == 1) ? 255 :
@@ -50,14 +50,14 @@ TEST(VP9, TestBitIO) { · 8 unmodified lines
5050 }
5151 for (int bit_method = 0; bit_method <= 3; ++bit_method) {
5252 const int random_seed = 6432;
53− const int buffer_size = 10000;
53+ const int kBufferSize = 10000;
5454 ACMRandom bit_rnd(random_seed);
5555 vp9_writer bw;
56− uint8_t bw_buffer[buffer_size];
56+ uint8_t bw_buffer[kBufferSize];
5757 vp9_start_encode(&bw, bw_buffer);
5858
5959 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) {
6161 if (bit_method == 2) {
6262 bit = (i & 1);
6363 } else if (bit_method == 3) {
@@ -72,16 +72,16 @@ TEST(VP9, TestBitIO) { · 8 unmodified lines
7272 GTEST_ASSERT_EQ(bw_buffer[0] & 0x80, 0);
7373
7474 vp9_reader br;
75− vp9_reader_init(&br, bw_buffer, buffer_size);
75+ vp9_reader_init(&br, bw_buffer, kBufferSize);
7676 bit_rnd.Reset(random_seed);
77− for (int i = 0; i < bits_to_test; ++i) {
77+ for (int i = 0; i < kBitsToTest; ++i) {
7878 if (bit_method == 2) {
7979 bit = (i & 1);
8080 } else if (bit_method == 3) {
8181 bit = bit_rnd(2);
8282 }
8383 GTEST_ASSERT_EQ(vp9_read(&br, probas[i]), bit)
84− << "pos: " << i << " / " << bits_to_test
84+ << "pos: " << i << " / " << kBitsToTest
8585 << " bit_method: " << bit_method
8686 << " method: " << method;
8787 }

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