Suggested by James Zern to clear out cpplint warnings for all unit test code.
Unified · Split
| @@ -8,8 +8,8 @@ · 7 unmodified lines | ||
| 8 | 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_ | |
| 12 | −#define LIBVPX_TEST_ACM_RANDOM_H_ | |
| 11 | +#ifndef TEST_ACM_RANDOM_H_ | |
| 12 | +#define TEST_ACM_RANDOM_H_ | |
| 13 | 13 | |
| 14 | 14 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 15 | 15 | |
| @@ -59,4 +59,4 @@ class ACMRandom { · 43 unmodified lines | ||
| 59 | 59 | |
| 60 | 60 | } // namespace libvpx_test |
| 61 | 61 | |
| 62 | −#endif // LIBVPX_TEST_ACM_RANDOM_H_ | |
| 62 | +#endif // TEST_ACM_RANDOM_H_ | |
| @@ -29,7 +29,7 @@ class BordersTest : public ::libvpx_test::EncoderTest, · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, |
| 31 | 31 | ::libvpx_test::Encoder *encoder) { |
| 32 | − if ( video->frame() == 1) { | |
| 32 | + if (video->frame() == 1) { | |
| 33 | 33 | encoder->Control(VP8E_SET_CPUUSED, 0); |
| 34 | 34 | encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1); |
| 35 | 35 | encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7); |
| @@ -10,7 +10,7 @@ · 9 unmodified lines | ||
| 10 | 10 | #ifndef TEST_CLEAR_SYSTEM_STATE_H_ |
| 11 | 11 | #define TEST_CLEAR_SYSTEM_STATE_H_ |
| 12 | 12 | |
| 13 | −#include "vpx_config.h" | |
| 13 | +#include "./vpx_config.h" | |
| 14 | 14 | extern "C" { |
| 15 | 15 | #if ARCH_X86 || ARCH_X86_64 |
| 16 | 16 | # include "vpx_ports/x86.h" |
| @@ -75,7 +75,7 @@ class DatarateTest : public ::libvpx_test::EncoderTest, · 74 unmodified lines | ||
| 75 | 75 | bits_in_buffer_model_ -= frame_size_in_bits; |
| 76 | 76 | |
| 77 | 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 | 80 | // If first drop not set and we have a drop set it to this time. |
| 81 | 81 | if (!first_drop_ && duration > 1) |
| @@ -17,11 +17,11 @@ · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | extern "C" { |
| 19 | 19 | #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); | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | −#include "acm_random.h" | |
| 24 | +#include "test/acm_random.h" | |
| 25 | 25 | #include "vpx/vpx_integer.h" |
| 26 | 26 | |
| 27 | 27 | using libvpx_test::ACMRandom; |
| @@ -31,9 +31,9 @@ namespace { · 3 unmodified lines | ||
| 31 | 31 | #ifdef _MSC_VER |
| 32 | 32 | static int round(double x) { |
| 33 | 33 | if (x < 0) |
| 34 | − return (int)ceil(x - 0.5); | |
| 34 | + return static_cast<int>(ceil(x - 0.5)); | |
| 35 | 35 | else |
| 36 | − return (int)floor(x + 0.5); | |
| 36 | + return static_cast<int>(floor(x + 0.5)); | |
| 37 | 37 | } |
| 38 | 38 | #endif |
| 39 | 39 | |
| @@ -45,7 +45,9 @@ void reference2_16x16_idct_2d(double *input, double *output) { · 5 unmodified lines | ||
| 45 | 45 | double s = 0; |
| 46 | 46 | for (int i = 0; i < 16; ++i) { |
| 47 | 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 | 51 | if (i != 0) |
| 50 | 52 | x *= sqrt(2.0); |
| 51 | 53 | if (j != 0) |
| @@ -32,9 +32,9 @@ namespace { · 31 unmodified lines | ||
| 32 | 32 | #ifdef _MSC_VER |
| 33 | 33 | static int round(double x) { |
| 34 | 34 | if (x < 0) |
| 35 | − return (int)ceil(x - 0.5); | |
| 35 | + return static_cast<int>(ceil(x - 0.5)); | |
| 36 | 36 | else |
| 37 | − return (int)floor(x + 0.5); | |
| 37 | + return static_cast<int>(floor(x + 0.5)); | |
| 38 | 38 | } |
| 39 | 39 | #endif |
| 40 | 40 | |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #define TEST_DECODE_TEST_DRIVER_H_ |
| 13 | 13 | #include <cstring> |
| 14 | 14 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 15 | −#include "vpx_config.h" | |
| 15 | +#include "./vpx_config.h" | |
| 16 | 16 | #include "vpx/vpx_decoder.h" |
| 17 | 17 | |
| 18 | 18 | namespace libvpx_test { |
| @@ -36,9 +36,8 @@ class DxDataIterator { · 17 unmodified lines | ||
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 38 | // 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. | |
| 42 | 41 | class Decoder { |
| 43 | 42 | public: |
| 44 | 43 | Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline) |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | ||
| 8 | 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 | 12 | #include "test/codec_factory.h" |
| 13 | 13 | #include "test/encode_test_driver.h" |
| 14 | 14 | #include "test/decode_test_driver.h" |
| @@ -114,19 +114,19 @@ static bool compare_img(const vpx_image_t *img1, · 99 unmodified lines | ||
| 114 | 114 | const unsigned int height_y = img1->d_h; |
| 115 | 115 | unsigned int i; |
| 116 | 116 | 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; | |
| 120 | 120 | const unsigned int width_uv = (img1->d_w + 1) >> 1; |
| 121 | 121 | const unsigned int height_uv = (img1->d_h + 1) >> 1; |
| 122 | 122 | 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; | |
| 126 | 126 | 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; | |
| 130 | 130 | return match; |
| 131 | 131 | } |
| 132 | 132 | |
| @@ -15,10 +15,10 @@ · 14 unmodified lines | ||
| 15 | 15 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 16 | 16 | |
| 17 | 17 | extern "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 | 22 | #include "vpx/vpx_integer.h" |
| 23 | 23 | #include "vpx_ports/mem.h" |
| 24 | 24 | |
| @@ -156,7 +156,7 @@ TEST_P(FwdTrans4x4Test, RoundTripErrorCheck) { · 131 unmodified lines | ||
| 156 | 156 | RunFwdTxfm(test_input_block, test_temp_block, dst, pitch, tx_type_); |
| 157 | 157 | |
| 158 | 158 | for (int j = 0; j < 16; ++j) { |
| 159 | − if(test_temp_block[j] > 0) { | |
| 159 | + if (test_temp_block[j] > 0) { | |
| 160 | 160 | test_temp_block[j] += 2; |
| 161 | 161 | test_temp_block[j] /= 4; |
| 162 | 162 | test_temp_block[j] *= 4; |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #define TEST_I420_VIDEO_SOURCE_H_ |
| 12 | 12 | #include <cstdio> |
| 13 | 13 | #include <cstdlib> |
| 14 | +#include <string> | |
| 14 | 15 | |
| 15 | 16 | #include "test/video_source.h" |
| 16 | 17 | |
| @@ -34,7 +35,6 @@ class I420VideoSource : public VideoSource { · 17 unmodified lines | ||
| 34 | 35 | height_(0), |
| 35 | 36 | framerate_numerator_(rate_numerator), |
| 36 | 37 | framerate_denominator_(rate_denominator) { |
| 37 | − | |
| 38 | 38 | // This initializes raw_sz_, width_, height_ and allocates an img. |
| 39 | 39 | SetSize(width, height); |
| 40 | 40 | } |
| @@ -15,10 +15,10 @@ · 14 unmodified lines | ||
| 15 | 15 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 16 | 16 | |
| 17 | 17 | extern "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 | 22 | #include "vpx/vpx_integer.h" |
| 23 | 23 | |
| 24 | 24 | using libvpx_test::ACMRandom; |
| @@ -27,10 +27,10 @@ namespace { · 2 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | #ifdef _MSC_VER |
| 29 | 29 | 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)); | |
| 32 | 32 | else |
| 33 | − return (int)floor(x + 0.5); | |
| 33 | + return static_cast<int>(floor(x + 0.5)); | |
| 34 | 34 | } |
| 35 | 35 | #endif |
| 36 | 36 | |
| @@ -16,7 +16,7 @@ extern "C" { · 15 unmodified lines | ||
| 16 | 16 | #include "test/register_state_check.h" |
| 17 | 17 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 18 | 18 | |
| 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, | |
| 20 | 20 | int pred_stride, unsigned char *dst_ptr, |
| 21 | 21 | int dst_stride); |
| 22 | 22 | namespace { |
| @@ -34,7 +34,7 @@ class IDCTTest : public ::testing::TestWithParam<idct_fn_t> { · 11 unmodified lines | ||
| 34 | 34 | virtual void TearDown() { libvpx_test::ClearSystemState(); } |
| 35 | 35 | |
| 36 | 36 | idct_fn_t UUT; |
| 37 | − short input[16]; | |
| 37 | + int16_t input[16]; | |
| 38 | 38 | unsigned char output[256]; |
| 39 | 39 | unsigned char predict[256]; |
| 40 | 40 | }; |
| @@ -15,8 +15,8 @@ · 14 unmodified lines | ||
| 15 | 15 | #include "test/register_state_check.h" |
| 16 | 16 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 17 | 17 | extern "C" { |
| 18 | −#include "vpx_config.h" | |
| 19 | −#include "vp8_rtcd.h" | |
| 18 | +#include "./vpx_config.h" | |
| 19 | +#include "./vp8_rtcd.h" | |
| 20 | 20 | #include "vp8/common/blockd.h" |
| 21 | 21 | #include "vpx_mem/vpx_mem.h" |
| 22 | 22 | } |
| @@ -106,9 +106,9 @@ class IntraPredBase { · 83 unmodified lines | ||
| 106 | 106 | for (int y = 0; y < block_size_; y++) |
| 107 | 107 | sum += data_ptr_[p][y * stride_ - 1]; |
| 108 | 108 | expected = (sum + (1 << (shift - 1))) >> shift; |
| 109 | − } else | |
| 109 | + } else { | |
| 110 | 110 | expected = 0x80; |
| 111 | − | |
| 111 | + } | |
| 112 | 112 | // check that all subsequent lines are equal to the first |
| 113 | 113 | for (int y = 1; y < block_size_; ++y) |
| 114 | 114 | ASSERT_EQ(0, memcmp(data_ptr_[p], &data_ptr_[p][y * stride_], |
| @@ -28,7 +28,7 @@ static unsigned int MemGetLe32(const uint8_t *mem) { · 27 unmodified lines | ||
| 28 | 28 | // so that we can do actual file decodes. |
| 29 | 29 | class IVFVideoSource : public CompressedVideoSource { |
| 30 | 30 | public: |
| 31 | − IVFVideoSource(const std::string &file_name) | |
| 31 | + explicit IVFVideoSource(const std::string &file_name) | |
| 32 | 32 | : file_name_(file_name), |
| 33 | 33 | input_file_(NULL), |
| 34 | 34 | compressed_frame_buf_(NULL), |
| @@ -132,7 +132,6 @@ TEST_P(KeyframeTest, TestAutoKeyframe) { · 131 unmodified lines | ||
| 132 | 132 | // Verify that keyframes match the file keyframes in the file. |
| 133 | 133 | for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin(); |
| 134 | 134 | iter != kf_pts_list_.end(); ++iter) { |
| 135 | − | |
| 136 | 135 | if (deadline_ == VPX_DL_REALTIME && *iter > 0) |
| 137 | 136 | EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame " |
| 138 | 137 | << *iter; |
| @@ -8,8 +8,8 @@ · 7 unmodified lines | ||
| 8 | 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_ | |
| 12 | −#define LIBVPX_TEST_MD5_HELPER_H_ | |
| 11 | +#ifndef TEST_MD5_HELPER_H_ | |
| 12 | +#define TEST_MD5_HELPER_H_ | |
| 13 | 13 | |
| 14 | 14 | extern "C" { |
| 15 | 15 | #include "./md5_utils.h" |
| @@ -67,4 +67,4 @@ class MD5 { · 51 unmodified lines | ||
| 67 | 67 | |
| 68 | 68 | } // namespace libvpx_test |
| 69 | 69 | |
| 70 | −#endif // LIBVPX_TEST_MD5_HELPER_H_ | |
| 70 | +#endif // TEST_MD5_HELPER_H_ | |
| @@ -11,8 +11,8 @@ · 10 unmodified lines | ||
| 11 | 11 | #include "test/register_state_check.h" |
| 12 | 12 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 13 | 13 | extern "C" { |
| 14 | −#include "vpx_config.h" | |
| 15 | −#include "vp8_rtcd.h" | |
| 14 | +#include "./vpx_config.h" | |
| 15 | +#include "./vp8_rtcd.h" | |
| 16 | 16 | #include "vpx/vpx_integer.h" |
| 17 | 17 | #include "vpx_mem/vpx_mem.h" |
| 18 | 18 | } |
| @@ -63,7 +63,8 @@ TEST_P(Vp8PostProcessingFilterTest, FilterOutputCheck) { · 44 unmodified lines | ||
| 63 | 63 | // Pointers to top-left pixel of block in the input and output images. |
| 64 | 64 | uint8_t *const src_image_ptr = src_image + (input_stride << 1); |
| 65 | 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 | 68 | (void)vpx_memset(flimits, 255, block_width); |
| 68 | 69 | |
| 69 | 70 | // Initialize pixels in the input: |
| @@ -8,8 +8,8 @@ · 7 unmodified lines | ||
| 8 | 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_ | |
| 12 | −#define LIBVPX_TEST_REGISTER_STATE_CHECK_H_ | |
| 11 | +#ifndef TEST_REGISTER_STATE_CHECK_H_ | |
| 12 | +#define TEST_REGISTER_STATE_CHECK_H_ | |
| 13 | 13 | |
| 14 | 14 | #ifdef _WIN64 |
| 15 | 15 | |
| @@ -92,4 +92,4 @@ class RegisterStateCheck {}; · 76 unmodified lines | ||
| 92 | 92 | |
| 93 | 93 | #endif // _WIN64 |
| 94 | 94 | |
| 95 | −#endif // LIBVPX_TEST_REGISTER_STATE_CHECK_H_ | |
| 95 | +#endif // TEST_REGISTER_STATE_CHECK_H_ | |
| @@ -17,7 +17,6 @@ extern "C" { · 16 unmodified lines | ||
| 17 | 17 | #include "./vpx_config.h" |
| 18 | 18 | #if CONFIG_VP8_ENCODER |
| 19 | 19 | #include "./vp8_rtcd.h" |
| 20 | −//#include "vp8/common/blockd.h" | |
| 21 | 20 | #endif |
| 22 | 21 | #if CONFIG_VP9_ENCODER |
| 23 | 22 | #include "./vp9_rtcd.h" |
| @@ -17,15 +17,19 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <sys/types.h> |
| 18 | 18 | |
| 19 | 19 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 20 | +#include "test/acm_random.h" | |
| 20 | 21 | #include "vpx/vpx_integer.h" |
| 21 | 22 | #include "vpx_mem/vpx_mem.h" |
| 22 | 23 | extern "C" { |
| 23 | 24 | #include "vp8/encoder/onyx_int.h" |
| 24 | 25 | } |
| 25 | 26 | |
| 27 | +using libvpx_test::ACMRandom; | |
| 28 | + | |
| 26 | 29 | namespace { |
| 27 | 30 | |
| 28 | 31 | TEST(Vp8RoiMapTest, ParameterCheck) { |
| 32 | + ACMRandom rnd(ACMRandom::DeterministicSeed()); | |
| 29 | 33 | int delta_q[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 }; |
| 30 | 34 | int delta_lf[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 }; |
| 31 | 35 | unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 }; |
| @@ -121,10 +125,10 @@ TEST(Vp8RoiMapTest, ParameterCheck) { · 89 unmodified lines | ||
| 121 | 125 | for (int i = 0; i < 1000; ++i) { |
| 122 | 126 | int rand_deltas[4]; |
| 123 | 127 | 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; | |
| 128 | 132 | |
| 129 | 133 | deltas_valid = ((abs(rand_deltas[0]) <= 63) && |
| 130 | 134 | (abs(rand_deltas[1]) <= 63) && |
| @@ -13,8 +13,8 @@ · 12 unmodified lines | ||
| 13 | 13 | #include "test/clear_system_state.h" |
| 14 | 14 | #include "test/register_state_check.h" |
| 15 | 15 | extern "C" { |
| 16 | −#include "vpx_config.h" | |
| 17 | −#include "vp8_rtcd.h" | |
| 16 | +#include "./vpx_config.h" | |
| 17 | +#include "./vp8_rtcd.h" | |
| 18 | 18 | #include "vp8/common/blockd.h" |
| 19 | 19 | #include "vp8/encoder/block.h" |
| 20 | 20 | #include "vpx_mem/vpx_mem.h" |
| @@ -51,7 +51,7 @@ TEST_P(SubtractBlockTest, SimpleSubtract) { · 30 unmodified lines | ||
| 51 | 51 | bd.predictor = reinterpret_cast<unsigned char*>( |
| 52 | 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 | 55 | // start at block0 |
| 56 | 56 | be.src = 0; |
| 57 | 57 | be.base_src = &source; |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | 9 | */ |
| 10 | 10 | #include <string> |
| 11 | −#include "vpx_config.h" | |
| 11 | +#include "./vpx_config.h" | |
| 12 | 12 | extern "C" { |
| 13 | 13 | #if ARCH_X86 || ARCH_X86_64 |
| 14 | 14 | #include "vpx_ports/x86.h" |
| @@ -48,7 +48,9 @@ int main(int argc, char **argv) { · 33 unmodified lines | ||
| 48 | 48 | #endif |
| 49 | 49 | |
| 50 | 50 | #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 | 54 | #if CONFIG_VP8 |
| 53 | 55 | vp8_rtcd(); |
| 54 | 56 | #endif |
| @@ -16,16 +16,16 @@ · 15 unmodified lines | ||
| 16 | 16 | #include "test/register_state_check.h" |
| 17 | 17 | |
| 18 | 18 | #include "vpx/vpx_integer.h" |
| 19 | −#include "vpx_config.h" | |
| 19 | +#include "./vpx_config.h" | |
| 20 | 20 | extern "C" { |
| 21 | 21 | #include "vpx_mem/vpx_mem.h" |
| 22 | 22 | #if CONFIG_VP8_ENCODER |
| 23 | 23 | # include "vp8/common/variance.h" |
| 24 | −# include "vp8_rtcd.h" | |
| 24 | +# include "./vp8_rtcd.h" | |
| 25 | 25 | #endif |
| 26 | 26 | #if CONFIG_VP9_ENCODER |
| 27 | 27 | # include "vp9/encoder/vp9_variance.h" |
| 28 | −# include "vp9_rtcd.h" | |
| 28 | +# include "./vp9_rtcd.h" | |
| 29 | 29 | #endif |
| 30 | 30 | } |
| 31 | 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 | |
| 109 | 109 | 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> > { | |
| 112 | 112 | public: |
| 113 | 113 | virtual void SetUp() { |
| 114 | 114 | const tuple<int, int, VarianceFunctionType>& params = this->GetParam(); |
| @@ -191,9 +191,9 @@ void VarianceTest<VarianceFunctionType>::OneQuarterTest() { · 76 unmodified lines | ||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | 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> > { | |
| 197 | 197 | public: |
| 198 | 198 | virtual void SetUp() { |
| 199 | 199 | const tuple<int, int, SubpelVarianceFunctionType>& params = |
| @@ -8,10 +8,6 @@ · 7 unmodified lines | ||
| 8 | 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | −extern "C" { | |
| 12 | −#include "vp8/encoder/boolhuff.h" | |
| 13 | −#include "vp8/decoder/dboolhuff.h" | |
| 14 | −} | |
| 15 | 11 | |
| 16 | 12 | #include <math.h> |
| 17 | 13 | #include <stddef.h> |
| @@ -24,6 +20,11 @@ extern "C" { · 6 unmodified lines | ||
| 24 | 20 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 25 | 21 | #include "vpx/vpx_integer.h" |
| 26 | 22 | |
| 23 | +extern "C" { | |
| 24 | +#include "vp8/encoder/boolhuff.h" | |
| 25 | +#include "vp8/decoder/dboolhuff.h" | |
| 26 | +} | |
| 27 | + | |
| 27 | 28 | namespace { |
| 28 | 29 | const int num_tests = 10; |
| 29 | 30 | |
| @@ -44,7 +45,7 @@ void encrypt_buffer(uint8_t *buffer, int size) { · 14 unmodified lines | ||
| 44 | 45 | |
| 45 | 46 | void test_decrypt_cb(void *decrypt_state, const uint8_t *input, |
| 46 | 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 | 49 | for (int i = 0; i < count; i++) { |
| 49 | 50 | output[i] = input[i] ^ secret_key[(offset + i) & 15]; |
| 50 | 51 | } |
| @@ -58,10 +59,10 @@ TEST(VP8, TestBitIO) { · 7 unmodified lines | ||
| 58 | 59 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 59 | 60 | for (int n = 0; n < num_tests; ++n) { |
| 60 | 61 | 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]; | |
| 63 | 64 | |
| 64 | − for (int i = 0; i < bits_to_test; ++i) { | |
| 65 | + for (int i = 0; i < kBitsToTest; ++i) { | |
| 65 | 66 | const int parity = i & 1; |
| 66 | 67 | probas[i] = |
| 67 | 68 | (method == 0) ? 0 : (method == 1) ? 255 : |
| @@ -76,14 +77,14 @@ TEST(VP8, TestBitIO) { · 8 unmodified lines | ||
| 76 | 77 | } |
| 77 | 78 | for (int bit_method = 0; bit_method <= 3; ++bit_method) { |
| 78 | 79 | const int random_seed = 6432; |
| 79 | − const int buffer_size = 10000; | |
| 80 | + const int kBufferSize = 10000; | |
| 80 | 81 | ACMRandom bit_rnd(random_seed); |
| 81 | 82 | 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); | |
| 84 | 85 | |
| 85 | 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 | 88 | if (bit_method == 2) { |
| 88 | 89 | bit = (i & 1); |
| 89 | 90 | } else if (bit_method == 3) { |
| @@ -98,19 +99,20 @@ TEST(VP8, TestBitIO) { · 8 unmodified lines | ||
| 98 | 99 | #if CONFIG_DECRYPT |
| 99 | 100 | encrypt_buffer(bw_buffer, buffer_size); |
| 100 | 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 | 104 | #else |
| 103 | − vp8dx_start_decode(&br, bw_buffer, buffer_size, NULL, NULL); | |
| 105 | + vp8dx_start_decode(&br, bw_buffer, kBufferSize, NULL, NULL); | |
| 104 | 106 | #endif |
| 105 | 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 | 109 | if (bit_method == 2) { |
| 108 | 110 | bit = (i & 1); |
| 109 | 111 | } else if (bit_method == 3) { |
| 110 | 112 | bit = bit_rnd(2); |
| 111 | 113 | } |
| 112 | 114 | GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit) |
| 113 | − << "pos: "<< i << " / " << bits_to_test | |
| 115 | + << "pos: "<< i << " / " << kBitsToTest | |
| 114 | 116 | << " bit_method: " << bit_method |
| 115 | 117 | << " method: " << method; |
| 116 | 118 | } |
| @@ -26,7 +26,8 @@ const uint8_t test_key[16] = { · 25 unmodified lines | ||
| 26 | 26 | 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0 |
| 27 | 27 | }; |
| 28 | 28 | |
| 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) { | |
| 30 | 31 | for (int i = 0; i < size; ++i) { |
| 31 | 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 | |
| 35 | 36 | void test_decrypt_cb(void *decrypt_state, const uint8_t *input, |
| 36 | 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 | −} // namespace | |
| 42 | +} // namespace | |
| 41 | 43 | |
| 42 | 44 | namespace libvpx_test { |
| 43 | 45 | |
| @@ -18,7 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | extern "C" { |
| 21 | −#include "vp8_rtcd.h" | |
| 21 | +#include "./vp8_rtcd.h" | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | #include "test/acm_random.h" |
| @@ -19,7 +19,7 @@ extern "C" { · 18 unmodified lines | ||
| 19 | 19 | #include "vp9/decoder/vp9_dboolhuff.h" |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | −#include "acm_random.h" | |
| 22 | +#include "test/acm_random.h" | |
| 23 | 23 | #include "vpx/vpx_integer.h" |
| 24 | 24 | |
| 25 | 25 | using libvpx_test::ACMRandom; |
| @@ -32,10 +32,10 @@ TEST(VP9, TestBitIO) { · 6 unmodified lines | ||
| 32 | 32 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 33 | 33 | for (int n = 0; n < num_tests; ++n) { |
| 34 | 34 | 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]; | |
| 37 | 37 | |
| 38 | − for (int i = 0; i < bits_to_test; ++i) { | |
| 38 | + for (int i = 0; i < kBitsToTest; ++i) { | |
| 39 | 39 | const int parity = i & 1; |
| 40 | 40 | probas[i] = |
| 41 | 41 | (method == 0) ? 0 : (method == 1) ? 255 : |
| @@ -50,14 +50,14 @@ TEST(VP9, TestBitIO) { · 8 unmodified lines | ||
| 50 | 50 | } |
| 51 | 51 | for (int bit_method = 0; bit_method <= 3; ++bit_method) { |
| 52 | 52 | const int random_seed = 6432; |
| 53 | − const int buffer_size = 10000; | |
| 53 | + const int kBufferSize = 10000; | |
| 54 | 54 | ACMRandom bit_rnd(random_seed); |
| 55 | 55 | vp9_writer bw; |
| 56 | − uint8_t bw_buffer[buffer_size]; | |
| 56 | + uint8_t bw_buffer[kBufferSize]; | |
| 57 | 57 | vp9_start_encode(&bw, bw_buffer); |
| 58 | 58 | |
| 59 | 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 | 61 | if (bit_method == 2) { |
| 62 | 62 | bit = (i & 1); |
| 63 | 63 | } else if (bit_method == 3) { |
| @@ -72,16 +72,16 @@ TEST(VP9, TestBitIO) { · 8 unmodified lines | ||
| 72 | 72 | GTEST_ASSERT_EQ(bw_buffer[0] & 0x80, 0); |
| 73 | 73 | |
| 74 | 74 | vp9_reader br; |
| 75 | − vp9_reader_init(&br, bw_buffer, buffer_size); | |
| 75 | + vp9_reader_init(&br, bw_buffer, kBufferSize); | |
| 76 | 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 | 78 | if (bit_method == 2) { |
| 79 | 79 | bit = (i & 1); |
| 80 | 80 | } else if (bit_method == 3) { |
| 81 | 81 | bit = bit_rnd(2); |
| 82 | 82 | } |
| 83 | 83 | GTEST_ASSERT_EQ(vp9_read(&br, probas[i]), bit) |
| 84 | − << "pos: " << i << " / " << bits_to_test | |
| 84 | + << "pos: " << i << " / " << kBitsToTest | |
| 85 | 85 | << " bit_method: " << bit_method |
| 86 | 86 | << " method: " << method; |
| 87 | 87 | } |