From afffa3d9b0722dfd2afb59eb0f28acedad713e63 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Thu, 5 Sep 2013 08:45:56 -0700 Subject: [PATCH] cleanup cpplint warnings Suggested by James Zern to clear out cpplint warnings for all unit test code. Change-Id: I731a3fa4d2a257eb9ef733426ba84286fbd7ea34 --- test/acm_random.h | 6 +++--- test/borders_test.cc | 2 +- test/clear_system_state.h | 2 +- test/datarate_test.cc | 2 +- test/dct16x16_test.cc | 14 ++++++++------ test/dct32x32_test.cc | 4 ++-- test/decode_test_driver.h | 7 +++---- test/encode_test_driver.cc | 20 ++++++++++---------- test/fdct4x4_test.cc | 6 +++--- test/i420_video_source.h | 2 +- test/idct8x8_test.cc | 10 +++++----- test/idct_test.cc | 4 ++-- test/intrapred_test.cc | 8 ++++---- test/ivf_video_source.h | 2 +- test/keyframe_test.cc | 1 - test/md5_helper.h | 6 +++--- test/pp_filter_test.cc | 7 ++++--- test/register_state_check.h | 6 +++--- test/sad_test.cc | 1 - test/set_roi.cc | 12 ++++++++---- test/subtract_test.cc | 6 +++--- test/test_libvpx.cc | 6 ++++-- test/variance_test.cc | 16 ++++++++-------- test/vp8_boolcoder_test.cc | 34 ++++++++++++++++++---------------- test/vp8_decrypt_test.cc | 8 +++++--- test/vp8_fdct4x4_test.cc | 2 +- test/vp9_boolcoder_test.cc | 20 ++++++++++---------- 27 files changed, 112 insertions(+), 102 deletions(-) diff --git a/test/acm_random.h b/test/acm_random.h index cd33d12..de94186 100644 --- a/test/acm_random.h +++ b/test/acm_random.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef LIBVPX_TEST_ACM_RANDOM_H_ -#define LIBVPX_TEST_ACM_RANDOM_H_ +#ifndef TEST_ACM_RANDOM_H_ +#define TEST_ACM_RANDOM_H_ #include "third_party/googletest/src/include/gtest/gtest.h" @@ -59,4 +59,4 @@ class ACMRandom { } // namespace libvpx_test -#endif // LIBVPX_TEST_ACM_RANDOM_H_ +#endif // TEST_ACM_RANDOM_H_ diff --git a/test/borders_test.cc b/test/borders_test.cc index 7bfece8..efaedb9 100644 --- a/test/borders_test.cc +++ b/test/borders_test.cc @@ -29,7 +29,7 @@ class BordersTest : public ::libvpx_test::EncoderTest, virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, ::libvpx_test::Encoder *encoder) { - if ( video->frame() == 1) { + if (video->frame() == 1) { encoder->Control(VP8E_SET_CPUUSED, 0); encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1); encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7); diff --git a/test/clear_system_state.h b/test/clear_system_state.h index e240981..8f08a4c 100644 --- a/test/clear_system_state.h +++ b/test/clear_system_state.h @@ -10,7 +10,7 @@ #ifndef TEST_CLEAR_SYSTEM_STATE_H_ #define TEST_CLEAR_SYSTEM_STATE_H_ -#include "vpx_config.h" +#include "./vpx_config.h" extern "C" { #if ARCH_X86 || ARCH_X86_64 # include "vpx_ports/x86.h" diff --git a/test/datarate_test.cc b/test/datarate_test.cc index 287e805..f020a99 100644 --- a/test/datarate_test.cc +++ b/test/datarate_test.cc @@ -75,7 +75,7 @@ class DatarateTest : public ::libvpx_test::EncoderTest, bits_in_buffer_model_ -= frame_size_in_bits; // Update the running total of bits for end of test datarate checks. - bits_total_ += frame_size_in_bits ; + bits_total_ += frame_size_in_bits; // If first drop not set and we have a drop set it to this time. if (!first_drop_ && duration > 1) diff --git a/test/dct16x16_test.cc b/test/dct16x16_test.cc index 0743f35..544d188 100644 --- a/test/dct16x16_test.cc +++ b/test/dct16x16_test.cc @@ -17,11 +17,11 @@ extern "C" { #include "vp9/common/vp9_entropy.h" -#include "vp9_rtcd.h" -void vp9_short_idct16x16_add_c(short *input, uint8_t *output, int pitch); +#include "./vp9_rtcd.h" +void vp9_short_idct16x16_add_c(int16_t *input, uint8_t *output, int pitch); } -#include "acm_random.h" +#include "test/acm_random.h" #include "vpx/vpx_integer.h" using libvpx_test::ACMRandom; @@ -31,9 +31,9 @@ namespace { #ifdef _MSC_VER static int round(double x) { if (x < 0) - return (int)ceil(x - 0.5); + return static_cast(ceil(x - 0.5)); else - return (int)floor(x + 0.5); + return static_cast(floor(x + 0.5)); } #endif @@ -45,7 +45,9 @@ void reference2_16x16_idct_2d(double *input, double *output) { double s = 0; for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) { - x=cos(PI*j*(l+0.5)/16.0)*cos(PI*i*(k+0.5)/16.0)*input[i*16+j]/256; + x = cos(PI * j * (l + 0.5) / 16.0) * + cos(PI * i * (k + 0.5) / 16.0) * + input[i * 16 + j] / 256; if (i != 0) x *= sqrt(2.0); if (j != 0) diff --git a/test/dct32x32_test.cc b/test/dct32x32_test.cc index 9cfa386..f331886 100644 --- a/test/dct32x32_test.cc +++ b/test/dct32x32_test.cc @@ -32,9 +32,9 @@ namespace { #ifdef _MSC_VER static int round(double x) { if (x < 0) - return (int)ceil(x - 0.5); + return static_cast(ceil(x - 0.5)); else - return (int)floor(x + 0.5); + return static_cast(floor(x + 0.5)); } #endif diff --git a/test/decode_test_driver.h b/test/decode_test_driver.h index 49e7384..055c45e 100644 --- a/test/decode_test_driver.h +++ b/test/decode_test_driver.h @@ -12,7 +12,7 @@ #define TEST_DECODE_TEST_DRIVER_H_ #include #include "third_party/googletest/src/include/gtest/gtest.h" -#include "vpx_config.h" +#include "./vpx_config.h" #include "vpx/vpx_decoder.h" namespace libvpx_test { @@ -36,9 +36,8 @@ class DxDataIterator { }; // Provides a simplified interface to manage one video decoding. -// -// TODO: similar to Encoder class, the exact services should be -// added as more tests are added. +// Similar to Encoder class, the exact services should be added +// as more tests are added. class Decoder { public: Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline) diff --git a/test/encode_test_driver.cc b/test/encode_test_driver.cc index df9e421..709831e 100644 --- a/test/encode_test_driver.cc +++ b/test/encode_test_driver.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "vpx_config.h" +#include "./vpx_config.h" #include "test/codec_factory.h" #include "test/encode_test_driver.h" #include "test/decode_test_driver.h" @@ -114,19 +114,19 @@ static bool compare_img(const vpx_image_t *img1, const unsigned int height_y = img1->d_h; unsigned int i; for (i = 0; i < height_y; ++i) - match = ( memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y], - img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y], - width_y) == 0) && match; + match = (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y], + img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y], + width_y) == 0) && match; const unsigned int width_uv = (img1->d_w + 1) >> 1; const unsigned int height_uv = (img1->d_h + 1) >> 1; for (i = 0; i < height_uv; ++i) - match = ( memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U], - img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U], - width_uv) == 0) && match; + match = (memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U], + img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U], + width_uv) == 0) && match; for (i = 0; i < height_uv; ++i) - match = ( memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V], - img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V], - width_uv) == 0) && match; + match = (memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V], + img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V], + width_uv) == 0) && match; return match; } diff --git a/test/fdct4x4_test.cc b/test/fdct4x4_test.cc index 39f915c..ea40ca6 100644 --- a/test/fdct4x4_test.cc +++ b/test/fdct4x4_test.cc @@ -15,10 +15,10 @@ #include "third_party/googletest/src/include/gtest/gtest.h" extern "C" { -#include "vp9_rtcd.h" +#include "./vp9_rtcd.h" } -#include "acm_random.h" +#include "test/acm_random.h" #include "vpx/vpx_integer.h" #include "vpx_ports/mem.h" @@ -156,7 +156,7 @@ TEST_P(FwdTrans4x4Test, RoundTripErrorCheck) { RunFwdTxfm(test_input_block, test_temp_block, dst, pitch, tx_type_); for (int j = 0; j < 16; ++j) { - if(test_temp_block[j] > 0) { + if (test_temp_block[j] > 0) { test_temp_block[j] += 2; test_temp_block[j] /= 4; test_temp_block[j] *= 4; diff --git a/test/i420_video_source.h b/test/i420_video_source.h index bcbe8a7..2bf2a03 100644 --- a/test/i420_video_source.h +++ b/test/i420_video_source.h @@ -11,6 +11,7 @@ #define TEST_I420_VIDEO_SOURCE_H_ #include #include +#include #include "test/video_source.h" @@ -34,7 +35,6 @@ class I420VideoSource : public VideoSource { height_(0), framerate_numerator_(rate_numerator), framerate_denominator_(rate_denominator) { - // This initializes raw_sz_, width_, height_ and allocates an img. SetSize(width, height); } diff --git a/test/idct8x8_test.cc b/test/idct8x8_test.cc index 67db78b..fc8129e 100644 --- a/test/idct8x8_test.cc +++ b/test/idct8x8_test.cc @@ -15,10 +15,10 @@ #include "third_party/googletest/src/include/gtest/gtest.h" extern "C" { -#include "vp9_rtcd.h" +#include "./vp9_rtcd.h" } -#include "acm_random.h" +#include "test/acm_random.h" #include "vpx/vpx_integer.h" using libvpx_test::ACMRandom; @@ -27,10 +27,10 @@ namespace { #ifdef _MSC_VER static int round(double x) { - if(x < 0) - return (int)ceil(x - 0.5); + if (x < 0) + return static_cast(ceil(x - 0.5)); else - return (int)floor(x + 0.5); + return static_cast(floor(x + 0.5)); } #endif diff --git a/test/idct_test.cc b/test/idct_test.cc index aa786cb..ea61e0b 100644 --- a/test/idct_test.cc +++ b/test/idct_test.cc @@ -16,7 +16,7 @@ extern "C" { #include "test/register_state_check.h" #include "third_party/googletest/src/include/gtest/gtest.h" -typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr, +typedef void (*idct_fn_t)(int16_t *input, unsigned char *pred_ptr, int pred_stride, unsigned char *dst_ptr, int dst_stride); namespace { @@ -34,7 +34,7 @@ class IDCTTest : public ::testing::TestWithParam { virtual void TearDown() { libvpx_test::ClearSystemState(); } idct_fn_t UUT; - short input[16]; + int16_t input[16]; unsigned char output[256]; unsigned char predict[256]; }; diff --git a/test/intrapred_test.cc b/test/intrapred_test.cc index da96741..f5f6d5b 100644 --- a/test/intrapred_test.cc +++ b/test/intrapred_test.cc @@ -15,8 +15,8 @@ #include "test/register_state_check.h" #include "third_party/googletest/src/include/gtest/gtest.h" extern "C" { -#include "vpx_config.h" -#include "vp8_rtcd.h" +#include "./vpx_config.h" +#include "./vp8_rtcd.h" #include "vp8/common/blockd.h" #include "vpx_mem/vpx_mem.h" } @@ -106,9 +106,9 @@ class IntraPredBase { for (int y = 0; y < block_size_; y++) sum += data_ptr_[p][y * stride_ - 1]; expected = (sum + (1 << (shift - 1))) >> shift; - } else + } else { expected = 0x80; - + } // check that all subsequent lines are equal to the first for (int y = 1; y < block_size_; ++y) ASSERT_EQ(0, memcmp(data_ptr_[p], &data_ptr_[p][y * stride_], diff --git a/test/ivf_video_source.h b/test/ivf_video_source.h index 926f801..3fbafbd 100644 --- a/test/ivf_video_source.h +++ b/test/ivf_video_source.h @@ -28,7 +28,7 @@ static unsigned int MemGetLe32(const uint8_t *mem) { // so that we can do actual file decodes. class IVFVideoSource : public CompressedVideoSource { public: - IVFVideoSource(const std::string &file_name) + explicit IVFVideoSource(const std::string &file_name) : file_name_(file_name), input_file_(NULL), compressed_frame_buf_(NULL), diff --git a/test/keyframe_test.cc b/test/keyframe_test.cc index f7572e8..7ee2898 100644 --- a/test/keyframe_test.cc +++ b/test/keyframe_test.cc @@ -132,7 +132,6 @@ TEST_P(KeyframeTest, TestAutoKeyframe) { // Verify that keyframes match the file keyframes in the file. for (std::vector::const_iterator iter = kf_pts_list_.begin(); iter != kf_pts_list_.end(); ++iter) { - if (deadline_ == VPX_DL_REALTIME && *iter > 0) EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame " << *iter; diff --git a/test/md5_helper.h b/test/md5_helper.h index f34054d..289f608 100644 --- a/test/md5_helper.h +++ b/test/md5_helper.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef LIBVPX_TEST_MD5_HELPER_H_ -#define LIBVPX_TEST_MD5_HELPER_H_ +#ifndef TEST_MD5_HELPER_H_ +#define TEST_MD5_HELPER_H_ extern "C" { #include "./md5_utils.h" @@ -67,4 +67,4 @@ class MD5 { } // namespace libvpx_test -#endif // LIBVPX_TEST_MD5_HELPER_H_ +#endif // TEST_MD5_HELPER_H_ diff --git a/test/pp_filter_test.cc b/test/pp_filter_test.cc index 79896fe..e5ac9db 100644 --- a/test/pp_filter_test.cc +++ b/test/pp_filter_test.cc @@ -11,8 +11,8 @@ #include "test/register_state_check.h" #include "third_party/googletest/src/include/gtest/gtest.h" extern "C" { -#include "vpx_config.h" -#include "vp8_rtcd.h" +#include "./vpx_config.h" +#include "./vp8_rtcd.h" #include "vpx/vpx_integer.h" #include "vpx_mem/vpx_mem.h" } @@ -63,7 +63,8 @@ TEST_P(Vp8PostProcessingFilterTest, FilterOutputCheck) { // Pointers to top-left pixel of block in the input and output images. uint8_t *const src_image_ptr = src_image + (input_stride << 1); uint8_t *const dst_image_ptr = dst_image + 8; - uint8_t *const flimits = reinterpret_cast(vpx_memalign(16, block_width)); + uint8_t *const flimits = + reinterpret_cast(vpx_memalign(16, block_width)); (void)vpx_memset(flimits, 255, block_width); // Initialize pixels in the input: diff --git a/test/register_state_check.h b/test/register_state_check.h index fb3f53b..479a42d 100644 --- a/test/register_state_check.h +++ b/test/register_state_check.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef LIBVPX_TEST_REGISTER_STATE_CHECK_H_ -#define LIBVPX_TEST_REGISTER_STATE_CHECK_H_ +#ifndef TEST_REGISTER_STATE_CHECK_H_ +#define TEST_REGISTER_STATE_CHECK_H_ #ifdef _WIN64 @@ -92,4 +92,4 @@ class RegisterStateCheck {}; #endif // _WIN64 -#endif // LIBVPX_TEST_REGISTER_STATE_CHECK_H_ +#endif // TEST_REGISTER_STATE_CHECK_H_ diff --git a/test/sad_test.cc b/test/sad_test.cc index 23403e8..453b3a8 100644 --- a/test/sad_test.cc +++ b/test/sad_test.cc @@ -17,7 +17,6 @@ extern "C" { #include "./vpx_config.h" #if CONFIG_VP8_ENCODER #include "./vp8_rtcd.h" -//#include "vp8/common/blockd.h" #endif #if CONFIG_VP9_ENCODER #include "./vp9_rtcd.h" diff --git a/test/set_roi.cc b/test/set_roi.cc index 3b6112e..9d2e771 100644 --- a/test/set_roi.cc +++ b/test/set_roi.cc @@ -17,15 +17,19 @@ #include #include "third_party/googletest/src/include/gtest/gtest.h" +#include "test/acm_random.h" #include "vpx/vpx_integer.h" #include "vpx_mem/vpx_mem.h" extern "C" { #include "vp8/encoder/onyx_int.h" } +using libvpx_test::ACMRandom; + namespace { TEST(Vp8RoiMapTest, ParameterCheck) { + ACMRandom rnd(ACMRandom::DeterministicSeed()); int delta_q[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 }; int delta_lf[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 }; unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 }; @@ -121,10 +125,10 @@ TEST(Vp8RoiMapTest, ParameterCheck) { for (int i = 0; i < 1000; ++i) { int rand_deltas[4]; int deltas_valid; - rand_deltas[0] = (rand() % 160) - 80; - rand_deltas[1] = (rand() % 160) - 80; - rand_deltas[2] = (rand() % 160) - 80; - rand_deltas[3] = (rand() % 160) - 80; + rand_deltas[0] = rnd(160) - 80; + rand_deltas[1] = rnd(160) - 80; + rand_deltas[2] = rnd(160) - 80; + rand_deltas[3] = rnd(160) - 80; deltas_valid = ((abs(rand_deltas[0]) <= 63) && (abs(rand_deltas[1]) <= 63) && diff --git a/test/subtract_test.cc b/test/subtract_test.cc index 574bfbf..d1f2729 100644 --- a/test/subtract_test.cc +++ b/test/subtract_test.cc @@ -13,8 +13,8 @@ #include "test/clear_system_state.h" #include "test/register_state_check.h" extern "C" { -#include "vpx_config.h" -#include "vp8_rtcd.h" +#include "./vpx_config.h" +#include "./vp8_rtcd.h" #include "vp8/common/blockd.h" #include "vp8/encoder/block.h" #include "vpx_mem/vpx_mem.h" @@ -51,7 +51,7 @@ TEST_P(SubtractBlockTest, SimpleSubtract) { bd.predictor = reinterpret_cast( vpx_memalign(16, kBlockHeight * kDiffPredStride * sizeof(*bd.predictor))); - for(int i = 0; kSrcStride[i] > 0; ++i) { + for (int i = 0; kSrcStride[i] > 0; ++i) { // start at block0 be.src = 0; be.base_src = &source; diff --git a/test/test_libvpx.cc b/test/test_libvpx.cc index 5610c26..a4dbca4 100644 --- a/test/test_libvpx.cc +++ b/test/test_libvpx.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ #include -#include "vpx_config.h" +#include "./vpx_config.h" extern "C" { #if ARCH_X86 || ARCH_X86_64 #include "vpx_ports/x86.h" @@ -48,7 +48,9 @@ int main(int argc, char **argv) { #endif #if !CONFIG_SHARED - /* Shared library builds don't support whitebox tests that exercise internal symbols. */ +// Shared library builds don't support whitebox tests +// that exercise internal symbols. + #if CONFIG_VP8 vp8_rtcd(); #endif diff --git a/test/variance_test.cc b/test/variance_test.cc index 4a3bf5c..ca53ffb 100644 --- a/test/variance_test.cc +++ b/test/variance_test.cc @@ -16,16 +16,16 @@ #include "test/register_state_check.h" #include "vpx/vpx_integer.h" -#include "vpx_config.h" +#include "./vpx_config.h" extern "C" { #include "vpx_mem/vpx_mem.h" #if CONFIG_VP8_ENCODER # include "vp8/common/variance.h" -# include "vp8_rtcd.h" +# include "./vp8_rtcd.h" #endif #if CONFIG_VP9_ENCODER # include "vp9/encoder/vp9_variance.h" -# include "vp9_rtcd.h" +# include "./vp9_rtcd.h" #endif } #include "test/acm_random.h" @@ -107,8 +107,8 @@ static unsigned int subpel_avg_variance_ref(const uint8_t *ref, } template -class VarianceTest : - public ::testing::TestWithParam > { +class VarianceTest + : public ::testing::TestWithParam > { public: virtual void SetUp() { const tuple& params = this->GetParam(); @@ -191,9 +191,9 @@ void VarianceTest::OneQuarterTest() { } template -class SubpelVarianceTest : - public ::testing::TestWithParam > { +class SubpelVarianceTest + : public ::testing::TestWithParam > { public: virtual void SetUp() { const tuple& params = diff --git a/test/vp8_boolcoder_test.cc b/test/vp8_boolcoder_test.cc index c3a8d12..0383af2 100644 --- a/test/vp8_boolcoder_test.cc +++ b/test/vp8_boolcoder_test.cc @@ -8,10 +8,6 @@ * be found in the AUTHORS file in the root of the source tree. */ -extern "C" { -#include "vp8/encoder/boolhuff.h" -#include "vp8/decoder/dboolhuff.h" -} #include #include @@ -24,6 +20,11 @@ extern "C" { #include "third_party/googletest/src/include/gtest/gtest.h" #include "vpx/vpx_integer.h" +extern "C" { +#include "vp8/encoder/boolhuff.h" +#include "vp8/decoder/dboolhuff.h" +} + namespace { const int num_tests = 10; @@ -44,7 +45,7 @@ void encrypt_buffer(uint8_t *buffer, int size) { void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output, int count) { - int offset = input - (uint8_t *)decrypt_state; + int offset = input - reinterpret_cast(decrypt_state); for (int i = 0; i < count; i++) { output[i] = input[i] ^ secret_key[(offset + i) & 15]; } @@ -58,10 +59,10 @@ TEST(VP8, TestBitIO) { ACMRandom rnd(ACMRandom::DeterministicSeed()); for (int n = 0; n < num_tests; ++n) { for (int method = 0; method <= 7; ++method) { // we generate various proba - const int bits_to_test = 1000; - uint8_t probas[bits_to_test]; + const int kBitsToTest = 1000; + uint8_t probas[kBitsToTest]; - for (int i = 0; i < bits_to_test; ++i) { + for (int i = 0; i < kBitsToTest; ++i) { const int parity = i & 1; probas[i] = (method == 0) ? 0 : (method == 1) ? 255 : @@ -76,14 +77,14 @@ TEST(VP8, TestBitIO) { } for (int bit_method = 0; bit_method <= 3; ++bit_method) { const int random_seed = 6432; - const int buffer_size = 10000; + const int kBufferSize = 10000; ACMRandom bit_rnd(random_seed); BOOL_CODER bw; - uint8_t bw_buffer[buffer_size]; - vp8_start_encode(&bw, bw_buffer, bw_buffer + buffer_size); + uint8_t bw_buffer[kBufferSize]; + vp8_start_encode(&bw, bw_buffer, bw_buffer + kBufferSize); int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0; - for (int i = 0; i < bits_to_test; ++i) { + for (int i = 0; i < kBitsToTest; ++i) { if (bit_method == 2) { bit = (i & 1); } else if (bit_method == 3) { @@ -98,19 +99,20 @@ TEST(VP8, TestBitIO) { #if CONFIG_DECRYPT encrypt_buffer(bw_buffer, buffer_size); vp8dx_start_decode(&br, bw_buffer, buffer_size, - test_decrypt_cb, (void *)bw_buffer); + test_decrypt_cb, + reinterpret_cast(bw_buffer)); #else - vp8dx_start_decode(&br, bw_buffer, buffer_size, NULL, NULL); + vp8dx_start_decode(&br, bw_buffer, kBufferSize, NULL, NULL); #endif bit_rnd.Reset(random_seed); - for (int i = 0; i < bits_to_test; ++i) { + for (int i = 0; i < kBitsToTest; ++i) { if (bit_method == 2) { bit = (i & 1); } else if (bit_method == 3) { bit = bit_rnd(2); } GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit) - << "pos: "<< i << " / " << bits_to_test + << "pos: "<< i << " / " << kBitsToTest << " bit_method: " << bit_method << " method: " << method; } diff --git a/test/vp8_decrypt_test.cc b/test/vp8_decrypt_test.cc index d850f00..b092509 100644 --- a/test/vp8_decrypt_test.cc +++ b/test/vp8_decrypt_test.cc @@ -26,7 +26,8 @@ const uint8_t test_key[16] = { 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0 }; -void encrypt_buffer(const uint8_t *src, uint8_t *dst, int size, int offset = 0) { +void encrypt_buffer(const uint8_t *src, uint8_t *dst, + int size, int offset = 0) { for (int i = 0; i < size; ++i) { dst[i] = src[i] ^ test_key[(offset + i) & 15]; } @@ -34,10 +35,11 @@ void encrypt_buffer(const uint8_t *src, uint8_t *dst, int size, int offset = 0) void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output, int count) { - encrypt_buffer(input, output, count, input - (uint8_t *)decrypt_state); + encrypt_buffer(input, output, count, + input - reinterpret_cast(decrypt_state)); } -} // namespace +} // namespace namespace libvpx_test { diff --git a/test/vp8_fdct4x4_test.cc b/test/vp8_fdct4x4_test.cc index 3c60011..c823436 100644 --- a/test/vp8_fdct4x4_test.cc +++ b/test/vp8_fdct4x4_test.cc @@ -18,7 +18,7 @@ extern "C" { -#include "vp8_rtcd.h" +#include "./vp8_rtcd.h" } #include "test/acm_random.h" diff --git a/test/vp9_boolcoder_test.cc b/test/vp9_boolcoder_test.cc index 42b2229..5edde90 100644 --- a/test/vp9_boolcoder_test.cc +++ b/test/vp9_boolcoder_test.cc @@ -19,7 +19,7 @@ extern "C" { #include "vp9/decoder/vp9_dboolhuff.h" } -#include "acm_random.h" +#include "test/acm_random.h" #include "vpx/vpx_integer.h" using libvpx_test::ACMRandom; @@ -32,10 +32,10 @@ TEST(VP9, TestBitIO) { ACMRandom rnd(ACMRandom::DeterministicSeed()); for (int n = 0; n < num_tests; ++n) { for (int method = 0; method <= 7; ++method) { // we generate various proba - const int bits_to_test = 1000; - uint8_t probas[bits_to_test]; + const int kBitsToTest = 1000; + uint8_t probas[kBitsToTest]; - for (int i = 0; i < bits_to_test; ++i) { + for (int i = 0; i < kBitsToTest; ++i) { const int parity = i & 1; probas[i] = (method == 0) ? 0 : (method == 1) ? 255 : @@ -50,14 +50,14 @@ TEST(VP9, TestBitIO) { } for (int bit_method = 0; bit_method <= 3; ++bit_method) { const int random_seed = 6432; - const int buffer_size = 10000; + const int kBufferSize = 10000; ACMRandom bit_rnd(random_seed); vp9_writer bw; - uint8_t bw_buffer[buffer_size]; + uint8_t bw_buffer[kBufferSize]; vp9_start_encode(&bw, bw_buffer); int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0; - for (int i = 0; i < bits_to_test; ++i) { + for (int i = 0; i < kBitsToTest; ++i) { if (bit_method == 2) { bit = (i & 1); } else if (bit_method == 3) { @@ -72,16 +72,16 @@ TEST(VP9, TestBitIO) { GTEST_ASSERT_EQ(bw_buffer[0] & 0x80, 0); vp9_reader br; - vp9_reader_init(&br, bw_buffer, buffer_size); + vp9_reader_init(&br, bw_buffer, kBufferSize); bit_rnd.Reset(random_seed); - for (int i = 0; i < bits_to_test; ++i) { + for (int i = 0; i < kBitsToTest; ++i) { if (bit_method == 2) { bit = (i & 1); } else if (bit_method == 3) { bit = bit_rnd(2); } GTEST_ASSERT_EQ(vp9_read(&br, probas[i]), bit) - << "pos: " << i << " / " << bits_to_test + << "pos: " << i << " / " << kBitsToTest << " bit_method: " << bit_method << " method: " << method; } -- 2.7.4