diff options
author | James Zern <jzern@google.com> | 2016-08-08 20:12:42 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-08-08 20:12:42 +0000 |
commit | cfd92dab18639c7f1198393ce04613e6d2b126eb (patch) | |
tree | 3875dc00655001eba8016ac83677ea31bfc7ae5b /test | |
parent | 6a8d4631a8b28c2fb0be87467d38174ea3c04e95 (diff) | |
parent | 2c17d54681bf6f529fac713d37075e8060e0c72a (diff) | |
download | libvpx-cfd92dab18639c7f1198393ce04613e6d2b126eb.tar.gz libvpx-cfd92dab18639c7f1198393ce04613e6d2b126eb.tar.bz2 libvpx-cfd92dab18639c7f1198393ce04613e6d2b126eb.zip |
Merge changes from topic 'clang-tidy'
* changes:
*_perf_test.cc: correct DoDecode signature
test: apply clang-tidy google-readability-braces-around-statements
Diffstat (limited to 'test')
-rw-r--r-- | test/active_map_refresh_test.cc | 3 | ||||
-rw-r--r-- | test/avg_test.cc | 6 | ||||
-rw-r--r-- | test/blockiness_test.cc | 5 | ||||
-rw-r--r-- | test/convolve_test.cc | 39 | ||||
-rw-r--r-- | test/datarate_test.cc | 8 | ||||
-rw-r--r-- | test/dct16x16_test.cc | 15 | ||||
-rw-r--r-- | test/dct32x32_test.cc | 9 | ||||
-rw-r--r-- | test/decode_perf_test.cc | 9 | ||||
-rw-r--r-- | test/decode_test_driver.cc | 3 | ||||
-rw-r--r-- | test/encode_perf_test.cc | 9 | ||||
-rw-r--r-- | test/encode_test_driver.cc | 29 | ||||
-rw-r--r-- | test/error_resilience_test.cc | 16 | ||||
-rw-r--r-- | test/fdct4x4_test.cc | 3 | ||||
-rw-r--r-- | test/fdct8x8_test.cc | 28 | ||||
-rw-r--r-- | test/idct8x8_test.cc | 6 | ||||
-rw-r--r-- | test/idct_test.cc | 15 | ||||
-rw-r--r-- | test/keyframe_test.cc | 6 | ||||
-rw-r--r-- | test/partial_idct_test.cc | 3 | ||||
-rw-r--r-- | test/sad_test.cc | 3 | ||||
-rw-r--r-- | test/sixtap_predict_test.cc | 6 | ||||
-rw-r--r-- | test/test_libvpx.cc | 6 | ||||
-rw-r--r-- | test/util.h | 3 | ||||
-rw-r--r-- | test/video_source.h | 5 | ||||
-rw-r--r-- | test/vp8_fdct4x4_test.cc | 25 | ||||
-rw-r--r-- | test/vp9_arf_freq_test.cc | 10 | ||||
-rw-r--r-- | test/vp9_encoder_parms_get_to_decoder.cc | 3 | ||||
-rw-r--r-- | test/vp9_end_to_end_test.cc | 5 | ||||
-rw-r--r-- | test/yuv_video_source.h | 3 |
28 files changed, 179 insertions, 102 deletions
diff --git a/test/active_map_refresh_test.cc b/test/active_map_refresh_test.cc index 6ebab9101..d89363550 100644 --- a/test/active_map_refresh_test.cc +++ b/test/active_map_refresh_test.cc @@ -37,8 +37,9 @@ int CheckMb(const vpx_image_t ¤t, const vpx_image_t &previous, int mb_r, for (; r < r_top; ++r) { for (int c = c0; c < c_top; ++c) { if (current.planes[plane][current.stride[plane] * r + c] != - previous.planes[plane][previous.stride[plane] * r + c]) + previous.planes[plane][previous.stride[plane] * r + c]) { return 1; + } } } } diff --git a/test/avg_test.cc b/test/avg_test.cc index 4a5d325c4..867a77aa0 100644 --- a/test/avg_test.cc +++ b/test/avg_test.cc @@ -55,15 +55,17 @@ class AverageTestBase : public ::testing::Test { // Sum Pixels unsigned int ReferenceAverage8x8(const uint8_t *source, int pitch) { unsigned int average = 0; - for (int h = 0; h < 8; ++h) + for (int h = 0; h < 8; ++h) { for (int w = 0; w < 8; ++w) average += source[h * pitch + w]; + } return ((average + 32) >> 6); } unsigned int ReferenceAverage4x4(const uint8_t *source, int pitch) { unsigned int average = 0; - for (int h = 0; h < 4; ++h) + for (int h = 0; h < 4; ++h) { for (int w = 0; w < 4; ++w) average += source[h * pitch + w]; + } return ((average + 8) >> 4); } diff --git a/test/blockiness_test.cc b/test/blockiness_test.cc index d20b9a61a..2fa10192f 100644 --- a/test/blockiness_test.cc +++ b/test/blockiness_test.cc @@ -100,10 +100,11 @@ class BlockinessTestBase : public ::testing::Test { void FillCheckerboard(uint8_t *data, int stride) { for (int h = 0; h < height_; h += 4) { for (int w = 0; w < width_; w += 4) { - if (((h / 4) ^ (w / 4)) & 1) + if (((h / 4) ^ (w / 4)) & 1) { FillConstant(data + h * stride + w, stride, 255, 4, 4); - else + } else { FillConstant(data + h * stride + w, stride, 0, 4, 4); + } } } } diff --git a/test/convolve_test.cc b/test/convolve_test.cc index 2befe6142..432d1b009 100644 --- a/test/convolve_test.cc +++ b/test/convolve_test.cc @@ -346,17 +346,19 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> { virtual void SetUp() { UUT_ = GET_PARAM(2); #if CONFIG_VP9_HIGHBITDEPTH - if (UUT_->use_highbd_ != 0) + if (UUT_->use_highbd_ != 0) { mask_ = (1 << UUT_->use_highbd_) - 1; - else + } else { mask_ = 255; + } #endif /* Set up guard blocks for an inner block centered in the outer block */ for (int i = 0; i < kOutputBufferSize; ++i) { - if (IsIndexInBorder(i)) + if (IsIndexInBorder(i)) { output_[i] = 255; - else + } else { output_[i] = 0; + } } ::libvpx_test::ACMRandom prng; @@ -535,11 +537,12 @@ TEST_P(ConvolveTest, Copy) { CheckGuardBlocks(); - for (int y = 0; y < Height(); ++y) + for (int y = 0; y < Height(); ++y) { for (int x = 0; x < Width(); ++x) ASSERT_EQ(lookup(out, y * kOutputStride + x), lookup(in, y * kInputStride + x)) << "(" << x << "," << y << ")"; + } } TEST_P(ConvolveTest, Avg) { @@ -553,13 +556,14 @@ TEST_P(ConvolveTest, Avg) { CheckGuardBlocks(); - for (int y = 0; y < Height(); ++y) + for (int y = 0; y < Height(); ++y) { for (int x = 0; x < Width(); ++x) ASSERT_EQ(lookup(out, y * kOutputStride + x), ROUND_POWER_OF_TWO(lookup(in, y * kInputStride + x) + lookup(out_ref, y * kOutputStride + x), 1)) << "(" << x << "," << y << ")"; + } } TEST_P(ConvolveTest, CopyHoriz) { @@ -574,11 +578,12 @@ TEST_P(ConvolveTest, CopyHoriz) { CheckGuardBlocks(); - for (int y = 0; y < Height(); ++y) + for (int y = 0; y < Height(); ++y) { for (int x = 0; x < Width(); ++x) ASSERT_EQ(lookup(out, y * kOutputStride + x), lookup(in, y * kInputStride + x)) << "(" << x << "," << y << ")"; + } } TEST_P(ConvolveTest, CopyVert) { @@ -593,11 +598,12 @@ TEST_P(ConvolveTest, CopyVert) { CheckGuardBlocks(); - for (int y = 0; y < Height(); ++y) + for (int y = 0; y < Height(); ++y) { for (int x = 0; x < Width(); ++x) ASSERT_EQ(lookup(out, y * kOutputStride + x), lookup(in, y * kInputStride + x)) << "(" << x << "," << y << ")"; + } } TEST_P(ConvolveTest, Copy2D) { @@ -612,11 +618,12 @@ TEST_P(ConvolveTest, Copy2D) { CheckGuardBlocks(); - for (int y = 0; y < Height(); ++y) + for (int y = 0; y < Height(); ++y) { for (int x = 0; x < Width(); ++x) ASSERT_EQ(lookup(out, y * kOutputStride + x), lookup(in, y * kInputStride + x)) << "(" << x << "," << y << ")"; + } } const int kNumFilterBanks = 4; @@ -690,13 +697,14 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) { CheckGuardBlocks(); - for (int y = 0; y < Height(); ++y) + for (int y = 0; y < Height(); ++y) { for (int x = 0; x < Width(); ++x) ASSERT_EQ(lookup(ref, y * kOutputStride + x), lookup(out, y * kOutputStride + x)) << "mismatch at (" << x << "," << y << "), " << "filters (" << filter_bank << "," << filter_x << "," << filter_y << ")"; + } } } } @@ -767,13 +775,14 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) { CheckGuardBlocks(); - for (int y = 0; y < Height(); ++y) + for (int y = 0; y < Height(); ++y) { for (int x = 0; x < Width(); ++x) ASSERT_EQ(lookup(ref, y * kOutputStride + x), lookup(out, y * kOutputStride + x)) << "mismatch at (" << x << "," << y << "), " << "filters (" << filter_bank << "," << filter_x << "," << filter_y << ")"; + } } } } @@ -828,10 +837,11 @@ TEST_P(ConvolveTest, FilterExtremes) { #endif if (axis) seed_val++; } - if (axis) + if (axis) { seed_val -= 8; - else + } else { seed_val++; + } } if (axis) seed_val += 8; @@ -860,13 +870,14 @@ TEST_P(ConvolveTest, FilterExtremes) { in, kInputStride, out, kOutputStride, kInvalidFilter, 0, kInvalidFilter, 0, Width(), Height())); - for (int y = 0; y < Height(); ++y) + for (int y = 0; y < Height(); ++y) { for (int x = 0; x < Width(); ++x) ASSERT_EQ(lookup(ref, y * kOutputStride + x), lookup(out, y * kOutputStride + x)) << "mismatch at (" << x << "," << y << "), " << "filters (" << filter_bank << "," << filter_x << "," << filter_y << ")"; + } } } } diff --git a/test/datarate_test.cc b/test/datarate_test.cc index 9b49544cf..b424b7514 100644 --- a/test/datarate_test.cc +++ b/test/datarate_test.cc @@ -46,8 +46,9 @@ class DatarateTestLarge virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, ::libvpx_test::Encoder *encoder) { - if (video->frame() == 0) + if (video->frame() == 0) { encoder->Control(VP8E_SET_NOISE_SENSITIVITY, denoiser_on_); + } if (denoiser_offon_test_) { ASSERT_GT(denoiser_offon_period_, 0) @@ -476,10 +477,11 @@ TEST_P(DatarateTestVP9Large, BasicRateTargetingVBRLagNonZero) { cfg_.rc_end_usage = VPX_VBR; // For non-zero lag, rate control will work (be within bounds) for // real-time mode. - if (deadline_ == VPX_DL_REALTIME) + if (deadline_ == VPX_DL_REALTIME) { cfg_.g_lag_in_frames = 15; - else + } else { cfg_.g_lag_in_frames = 0; + } ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, 30, 1, 0, 300); diff --git a/test/dct16x16_test.cc b/test/dct16x16_test.cc index 2990e5434..f9745ed81 100644 --- a/test/dct16x16_test.cc +++ b/test/dct16x16_test.cc @@ -386,8 +386,9 @@ class Trans16x16TestBase { for (int i = 0; i < count_test_block; ++i) { // Initialize a test block with input range [-mask_, mask_]. - for (int j = 0; j < kNumCoeffs; ++j) + for (int j = 0; j < kNumCoeffs; ++j) { input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_); + } fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_); ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_)); @@ -447,10 +448,12 @@ class Trans16x16TestBase { for (int j = 0; j < kNumCoeffs; ++j) { input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_; } - if (i == 0) + if (i == 0) { for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_; - if (i == 1) + } + if (i == 1) { for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_; + } fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); @@ -464,8 +467,9 @@ class Trans16x16TestBase { // quantization with maximum allowed step sizes output_ref_block[0] = (output_ref_block[0] / dc_thred) * dc_thred; - for (int j = 1; j < kNumCoeffs; ++j) + for (int j = 1; j < kNumCoeffs; ++j) { output_ref_block[j] = (output_ref_block[j] / ac_thred) * ac_thred; + } if (bit_depth_ == VPX_BITS_8) { inv_txfm_ref(output_ref_block, ref, pitch_, tx_type_); ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block, dst, pitch_)); @@ -518,8 +522,9 @@ class Trans16x16TestBase { } reference_16x16_dct_2d(in, out_r); - for (int j = 0; j < kNumCoeffs; ++j) + for (int j = 0; j < kNumCoeffs; ++j) { coeff[j] = static_cast<tran_low_t>(round(out_r[j])); + } if (bit_depth_ == VPX_BITS_8) { ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16)); diff --git a/test/dct32x32_test.cc b/test/dct32x32_test.cc index 667e9f2c7..a168e690e 100644 --- a/test/dct32x32_test.cc +++ b/test/dct32x32_test.cc @@ -37,8 +37,9 @@ void reference_32x32_dct_1d(const double in[32], double out[32]) { const double kInvSqrt2 = 0.707106781186547524400844362104; for (int k = 0; k < 32; k++) { out[k] = 0.0; - for (int n = 0; n < 32; n++) + for (int n = 0; n < 32; n++) { out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 64.0); + } if (k == 0) out[k] = out[k] * kInvSqrt2; } } @@ -174,8 +175,9 @@ TEST_P(Trans32x32Test, CoeffCheck) { DECLARE_ALIGNED(16, tran_low_t, output_block[kNumCoeffs]); for (int i = 0; i < count_test_block; ++i) { - for (int j = 0; j < kNumCoeffs; ++j) + for (int j = 0; j < kNumCoeffs; ++j) { input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_); + } const int stride = 32; vpx_fdct32x32_c(input_block, output_ref_block, stride); @@ -266,8 +268,9 @@ TEST_P(Trans32x32Test, InverseAccuracy) { } reference_32x32_dct_2d(in, out_r); - for (int j = 0; j < kNumCoeffs; ++j) + for (int j = 0; j < kNumCoeffs; ++j) { coeff[j] = static_cast<tran_low_t>(round(out_r[j])); + } if (bit_depth_ == VPX_BITS_8) { ASM_REGISTER_STATE_CHECK(inv_txfm_(coeff, dst, 32)); #if CONFIG_VP9_HIGHBITDEPTH diff --git a/test/decode_perf_test.cc b/test/decode_perf_test.cc index 33a2c1397..ee26c3c04 100644 --- a/test/decode_perf_test.cc +++ b/test/decode_perf_test.cc @@ -28,7 +28,6 @@ namespace { #define VIDEO_NAME 0 #define THREADS 1 -const int kMaxPsnr = 100; const double kUsecsInSec = 1000000.0; const char kNewEncodeOutputFile[] = "new_encode.ivf"; @@ -154,8 +153,9 @@ class VP9NewEncodeDecodePerfTest virtual void EndPassHook() { if (outfile_ != NULL) { - if (!fseek(outfile_, 0, SEEK_SET)) + if (!fseek(outfile_, 0, SEEK_SET)) { ivf_write_file_header(outfile_, &cfg_, VP9_FOURCC, out_frames_); + } fclose(outfile_); outfile_ = NULL; } @@ -165,8 +165,9 @@ class VP9NewEncodeDecodePerfTest ++out_frames_; // Write initial file header if first frame. - if (pkt->data.frame.pts == 0) + if (pkt->data.frame.pts == 0) { ivf_write_file_header(outfile_, &cfg_, VP9_FOURCC, out_frames_); + } // Write frame header and data. ivf_write_frame_header(outfile_, out_frames_, pkt->data.frame.sz); @@ -174,7 +175,7 @@ class VP9NewEncodeDecodePerfTest pkt->data.frame.sz); } - virtual bool DoDecode() { return false; } + virtual bool DoDecode() const { return false; } void set_speed(unsigned int speed) { speed_ = speed; } diff --git a/test/decode_test_driver.cc b/test/decode_test_driver.cc index 58eff7fa4..b738e0db1 100644 --- a/test/decode_test_driver.cc +++ b/test/decode_test_driver.cc @@ -97,8 +97,9 @@ void DecoderTest::RunLoop(CompressedVideoSource *video, const vpx_image_t *img = NULL; // Get decompressed data - while ((img = dec_iter.Next())) + while ((img = dec_iter.Next())) { DecompressedFrameHook(*img, video->frame_number()); + } } delete decoder; } diff --git a/test/encode_perf_test.cc b/test/encode_perf_test.cc index 5ea93a045..0bb435502 100644 --- a/test/encode_perf_test.cc +++ b/test/encode_perf_test.cc @@ -105,7 +105,7 @@ class VP9EncodePerfTest } // for performance reasons don't decode - virtual bool DoDecode() { return 0; } + virtual bool DoDecode() const { return false; } double min_psnr() const { return min_psnr_; } @@ -126,11 +126,12 @@ TEST_P(VP9EncodePerfTest, PerfTest) { for (size_t j = 0; j < NELEMENTS(kEncodePerfTestSpeeds); ++j) { for (size_t k = 0; k < NELEMENTS(kEncodePerfTestThreads); ++k) { if (kVP9EncodePerfTestVectors[i].width < 512 && - kEncodePerfTestThreads[k] > 1) + kEncodePerfTestThreads[k] > 1) { continue; - else if (kVP9EncodePerfTestVectors[i].width < 1024 && - kEncodePerfTestThreads[k] > 2) + } else if (kVP9EncodePerfTestVectors[i].width < 1024 && + kEncodePerfTestThreads[k] > 2) { continue; + } set_threads(kEncodePerfTestThreads[k]); SetUp(); diff --git a/test/encode_test_driver.cc b/test/encode_test_driver.cc index 32269afef..632c98f05 100644 --- a/test/encode_test_driver.cc +++ b/test/encode_test_driver.cc @@ -52,10 +52,11 @@ void Encoder::InitEncoder(VideoSource *video) { } void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) { - if (video->img()) + if (video->img()) { EncodeFrameInternal(*video, frame_flags); - else + } else { Flush(); + } // Handle twopass stats CxDataIterator iter = GetCxData(); @@ -115,10 +116,11 @@ void EncoderTest::SetMode(TestMode mode) { default: ASSERT_TRUE(false) << "Unexpected mode " << mode; } - if (mode == kTwoPassGood || mode == kTwoPassBest) + if (mode == kTwoPassGood || mode == kTwoPassBest) { passes_ = 2; - else + } else { passes_ = 1; + } } // The function should return "true" most of the time, therefore no early // break-out is implemented within the match checking process. @@ -129,23 +131,26 @@ static bool compare_img(const vpx_image_t *img1, const vpx_image_t *img2) { const unsigned int width_y = img1->d_w; const unsigned int height_y = img1->d_h; unsigned int i; - for (i = 0; i < height_y; ++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; + } 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) + 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; - for (i = 0; i < height_uv; ++i) + } + 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; + } return match; } @@ -163,12 +168,13 @@ void EncoderTest::RunLoop(VideoSource *video) { for (unsigned int pass = 0; pass < passes_; pass++) { last_pts_ = 0; - if (passes_ == 1) + if (passes_ == 1) { cfg_.g_pass = VPX_RC_ONE_PASS; - else if (pass == 0) + } else if (pass == 0) { cfg_.g_pass = VPX_RC_FIRST_PASS; - else + } else { cfg_.g_pass = VPX_RC_LAST_PASS; + } BeginPassHook(pass); testing::internal::scoped_ptr<Encoder> encoder( @@ -182,8 +188,9 @@ void EncoderTest::RunLoop(VideoSource *video) { unsigned long dec_init_flags = 0; // NOLINT // Use fragment decoder if encoder outputs partitions. // NOTE: fragment decoder and partition encoder are only supported by VP8. - if (init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION) + if (init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION) { dec_init_flags |= VPX_CODEC_USE_INPUT_FRAGMENTS; + } testing::internal::scoped_ptr<Decoder> decoder( codec_->CreateDecoder(dec_cfg, dec_init_flags)); bool again; diff --git a/test/error_resilience_test.cc b/test/error_resilience_test.cc index 1970b175f..4c7ede8ca 100644 --- a/test/error_resilience_test.cc +++ b/test/error_resilience_test.cc @@ -152,23 +152,27 @@ class ErrorResilienceTestLarge } void SetErrorFrames(int num, unsigned int *list) { - if (num > kMaxErrorFrames) + if (num > kMaxErrorFrames) { num = kMaxErrorFrames; - else if (num < 0) + } else if (num < 0) { num = 0; + } error_nframes_ = num; - for (unsigned int i = 0; i < error_nframes_; ++i) + for (unsigned int i = 0; i < error_nframes_; ++i) { error_frames_[i] = list[i]; + } } void SetDroppableFrames(int num, unsigned int *list) { - if (num > kMaxDroppableFrames) + if (num > kMaxDroppableFrames) { num = kMaxDroppableFrames; - else if (num < 0) + } else if (num < 0) { num = 0; + } droppable_nframes_ = num; - for (unsigned int i = 0; i < droppable_nframes_; ++i) + for (unsigned int i = 0; i < droppable_nframes_; ++i) { droppable_frames_[i] = list[i]; + } } unsigned int GetMismatchFrames() { return mismatch_nframes_; } diff --git a/test/fdct4x4_test.cc b/test/fdct4x4_test.cc index 327793623..1270dae94 100644 --- a/test/fdct4x4_test.cc +++ b/test/fdct4x4_test.cc @@ -170,8 +170,9 @@ class Trans4x4TestBase { for (int i = 0; i < count_test_block; ++i) { // Initialize a test block with input range [-mask_, mask_]. - for (int j = 0; j < kNumCoeffs; ++j) + for (int j = 0; j < kNumCoeffs; ++j) { input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_); + } fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_); ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_)); diff --git a/test/fdct8x8_test.cc b/test/fdct8x8_test.cc index 994dab118..3ac73c125 100644 --- a/test/fdct8x8_test.cc +++ b/test/fdct8x8_test.cc @@ -51,8 +51,9 @@ void reference_8x8_dct_1d(const double in[8], double out[8]) { const double kInvSqrt2 = 0.707106781186547524400844362104; for (int k = 0; k < 8; k++) { out[k] = 0.0; - for (int n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0); + } if (k == 0) out[k] = out[k] * kInvSqrt2; } } @@ -149,17 +150,19 @@ class FwdTrans8x8TestBase { for (int i = 0; i < count_test_block; ++i) { // Initialize a test block with input range [-255, 255]. - for (int j = 0; j < 64; ++j) + for (int j = 0; j < 64; ++j) { test_input_block[j] = ((rnd.Rand16() >> (16 - bit_depth_)) & mask_) - ((rnd.Rand16() >> (16 - bit_depth_)) & mask_); + } ASM_REGISTER_STATE_CHECK( RunFwdTxfm(test_input_block, test_output_block, pitch_)); for (int j = 0; j < 64; ++j) { - if (test_output_block[j] < 0) + if (test_output_block[j] < 0) { ++count_sign_block[j][0]; - else if (test_output_block[j] > 0) + } else if (test_output_block[j] > 0) { ++count_sign_block[j][1]; + } } } @@ -178,17 +181,19 @@ class FwdTrans8x8TestBase { for (int i = 0; i < count_test_block; ++i) { // Initialize a test block with input range [-mask_ / 16, mask_ / 16]. - for (int j = 0; j < 64; ++j) + for (int j = 0; j < 64; ++j) { test_input_block[j] = ((rnd.Rand16() & mask_) >> 4) - ((rnd.Rand16() & mask_) >> 4); + } ASM_REGISTER_STATE_CHECK( RunFwdTxfm(test_input_block, test_output_block, pitch_)); for (int j = 0; j < 64; ++j) { - if (test_output_block[j] < 0) + if (test_output_block[j] < 0) { ++count_sign_block[j][0]; - else if (test_output_block[j] > 0) + } else if (test_output_block[j] > 0) { ++count_sign_block[j][1]; + } } } @@ -399,8 +404,9 @@ class FwdTrans8x8TestBase { } reference_8x8_dct_2d(in, out_r); - for (int j = 0; j < kNumCoeffs; ++j) + for (int j = 0; j < kNumCoeffs; ++j) { coeff[j] = static_cast<tran_low_t>(round(out_r[j])); + } if (bit_depth_ == VPX_BITS_8) { ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_)); @@ -436,13 +442,15 @@ class FwdTrans8x8TestBase { double out_r[kNumCoeffs]; // Initialize a test block with input range [-mask_, mask_]. - for (int j = 0; j < kNumCoeffs; ++j) + for (int j = 0; j < kNumCoeffs; ++j) { in[j] = rnd.Rand8() % 2 == 0 ? mask_ : -mask_; + } RunFwdTxfm(in, coeff, pitch_); reference_8x8_dct_2d(in, out_r); - for (int j = 0; j < kNumCoeffs; ++j) + for (int j = 0; j < kNumCoeffs; ++j) { coeff_r[j] = static_cast<tran_low_t>(round(out_r[j])); + } for (int j = 0; j < kNumCoeffs; ++j) { const int32_t diff = coeff[j] - coeff_r[j]; diff --git a/test/idct8x8_test.cc b/test/idct8x8_test.cc index ee7580557..7951bb93c 100644 --- a/test/idct8x8_test.cc +++ b/test/idct8x8_test.cc @@ -28,8 +28,9 @@ void reference_dct_1d(double input[8], double output[8]) { const double kInvSqrt2 = 0.707106781186547524400844362104; for (int k = 0; k < 8; k++) { output[k] = 0.0; - for (int n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { output[k] += input[n] * cos(kPi * (2 * n + 1) * k / 16.0); + } if (k == 0) output[k] = output[k] * kInvSqrt2; } } @@ -70,8 +71,9 @@ TEST(VP9Idct8x8Test, AccuracyCheck) { for (int j = 0; j < 64; ++j) input[j] = src[j] - dst[j]; reference_dct_2d(input, output_r); - for (int j = 0; j < 64; ++j) + for (int j = 0; j < 64; ++j) { coeff[j] = static_cast<tran_low_t>(round(output_r[j])); + } vpx_idct8x8_64_add_c(coeff, dst, 8); for (int j = 0; j < 64; ++j) { const int diff = dst[j] - src[j]; diff --git a/test/idct_test.cc b/test/idct_test.cc index 39db3e4c6..f54f2c005 100644 --- a/test/idct_test.cc +++ b/test/idct_test.cc @@ -43,11 +43,12 @@ class IDCTTest : public ::testing::TestWithParam<IdctFunc> { TEST_P(IDCTTest, TestGuardBlocks) { int i; - for (i = 0; i < 256; i++) + for (i = 0; i < 256; i++) { if ((i & 0xF) < 4 && i < 64) EXPECT_EQ(0, output[i]) << i; else EXPECT_EQ(255, output[i]); + } } TEST_P(IDCTTest, TestAllZeros) { @@ -55,11 +56,12 @@ TEST_P(IDCTTest, TestAllZeros) { ASM_REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16)); - for (i = 0; i < 256; i++) + for (i = 0; i < 256; i++) { if ((i & 0xF) < 4 && i < 64) EXPECT_EQ(0, output[i]) << "i==" << i; else EXPECT_EQ(255, output[i]) << "i==" << i; + } } TEST_P(IDCTTest, TestAllOnes) { @@ -68,11 +70,12 @@ TEST_P(IDCTTest, TestAllOnes) { input[0] = 4; ASM_REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16)); - for (i = 0; i < 256; i++) + for (i = 0; i < 256; i++) { if ((i & 0xF) < 4 && i < 64) EXPECT_EQ(1, output[i]) << "i==" << i; else EXPECT_EQ(255, output[i]) << "i==" << i; + } } TEST_P(IDCTTest, TestAddOne) { @@ -82,11 +85,12 @@ TEST_P(IDCTTest, TestAddOne) { input[0] = 4; ASM_REGISTER_STATE_CHECK(UUT(input, predict, 16, output, 16)); - for (i = 0; i < 256; i++) + for (i = 0; i < 256; i++) { if ((i & 0xF) < 4 && i < 64) EXPECT_EQ(i + 1, output[i]) << "i==" << i; else EXPECT_EQ(255, output[i]) << "i==" << i; + } } TEST_P(IDCTTest, TestWithData) { @@ -96,7 +100,7 @@ TEST_P(IDCTTest, TestWithData) { ASM_REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16)); - for (i = 0; i < 256; i++) + for (i = 0; i < 256; i++) { if ((i & 0xF) > 3 || i > 63) EXPECT_EQ(255, output[i]) << "i==" << i; else if (i == 0) @@ -107,6 +111,7 @@ TEST_P(IDCTTest, TestWithData) { EXPECT_EQ(3, output[i]) << "i==" << i; else EXPECT_EQ(0, output[i]) << "i==" << i; + } } INSTANTIATE_TEST_CASE_P(C, IDCTTest, ::testing::Values(vp8_short_idct4x4llm_c)); diff --git a/test/keyframe_test.cc b/test/keyframe_test.cc index 03cdedc1a..38bd923b7 100644 --- a/test/keyframe_test.cc +++ b/test/keyframe_test.cc @@ -35,10 +35,12 @@ class KeyframeTest virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, ::libvpx_test::Encoder *encoder) { - if (kf_do_force_kf_) + if (kf_do_force_kf_) { frame_flags_ = (video->frame() % 3) ? 0 : VPX_EFLAG_FORCE_KF; - if (set_cpu_used_ && video->frame() == 1) + } + if (set_cpu_used_ && video->frame() == 1) { encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_); + } } virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { diff --git a/test/partial_idct_test.cc b/test/partial_idct_test.cc index 953bb715a..de6ff4a01 100644 --- a/test/partial_idct_test.cc +++ b/test/partial_idct_test.cc @@ -100,9 +100,10 @@ TEST_P(PartialIDctTest, RunQuantCheck) { // quantization with maximum allowed step sizes test_coef_block1[0] = (output_ref_block[0] / 1336) * 1336; - for (int j = 1; j < last_nonzero_; ++j) + for (int j = 1; j < last_nonzero_; ++j) { test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]] = (output_ref_block[j] / 1828) * 1828; + } } ASM_REGISTER_STATE_CHECK(full_itxfm_(test_coef_block1, dst1, size)); diff --git a/test/sad_test.cc b/test/sad_test.cc index e1f164a4e..837b08fbd 100644 --- a/test/sad_test.cc +++ b/test/sad_test.cc @@ -114,9 +114,10 @@ class SADTestBase : public ::testing::TestWithParam<ParamType> { uint8_t *GetReference(int block_idx) const { #if CONFIG_VP9_HIGHBITDEPTH - if (use_high_bit_depth_) + if (use_high_bit_depth_) { return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) + block_idx * kDataBlockSize); + } #endif // CONFIG_VP9_HIGHBITDEPTH return reference_data_ + block_idx * kDataBlockSize; } diff --git a/test/sixtap_predict_test.cc b/test/sixtap_predict_test.cc index b9bc37547..31a604417 100644 --- a/test/sixtap_predict_test.cc +++ b/test/sixtap_predict_test.cc @@ -146,10 +146,11 @@ TEST_P(SixtapPredictTest, TestWithPresetData) { ASM_REGISTER_STATE_CHECK(sixtap_predict_(&src[kSrcStride * 2 + 2 + 1], kSrcStride, 2, 2, dst_, kDstStride)); - for (int i = 0; i < height_; ++i) + for (int i = 0; i < height_; ++i) { for (int j = 0; j < width_; ++j) ASSERT_EQ(expected_dst[i * kDstStride + j], dst_[i * kDstStride + j]) << "i==" << (i * width_ + j); + } } using libvpx_test::ACMRandom; @@ -172,10 +173,11 @@ TEST_P(SixtapPredictTest, TestWithRandomData) { kSrcStride, xoffset, yoffset, dst_, kDstStride)); - for (int i = 0; i < height_; ++i) + for (int i = 0; i < height_; ++i) { for (int j = 0; j < width_; ++j) ASSERT_EQ(dst_c_[i * kDstStride + j], dst_[i * kDstStride + j]) << "i==" << (i * width_ + j); + } } } } diff --git a/test/test_libvpx.cc b/test/test_libvpx.cc index 120e0e17b..8a70b4e28 100644 --- a/test/test_libvpx.cc +++ b/test/test_libvpx.cc @@ -45,10 +45,12 @@ int main(int argc, char **argv) { if (!(simd_caps & HAS_SSE)) append_negative_gtest_filter(":SSE.*:SSE/*"); if (!(simd_caps & HAS_SSE2)) append_negative_gtest_filter(":SSE2.*:SSE2/*"); if (!(simd_caps & HAS_SSE3)) append_negative_gtest_filter(":SSE3.*:SSE3/*"); - if (!(simd_caps & HAS_SSSE3)) + if (!(simd_caps & HAS_SSSE3)) { append_negative_gtest_filter(":SSSE3.*:SSSE3/*"); - if (!(simd_caps & HAS_SSE4_1)) + } + if (!(simd_caps & HAS_SSE4_1)) { append_negative_gtest_filter(":SSE4_1.*:SSE4_1/*"); + } if (!(simd_caps & HAS_AVX)) append_negative_gtest_filter(":AVX.*:AVX/*"); if (!(simd_caps & HAS_AVX2)) append_negative_gtest_filter(":AVX2.*:AVX2/*"); #endif // ARCH_X86 || ARCH_X86_64 diff --git a/test/util.h b/test/util.h index 0ef2ad8a5..1f2540ecf 100644 --- a/test/util.h +++ b/test/util.h @@ -28,12 +28,13 @@ inline double compute_psnr(const vpx_image_t *img1, const vpx_image_t *img2) { unsigned int i, j; int64_t sqrerr = 0; - for (i = 0; i < height_y; ++i) + for (i = 0; i < height_y; ++i) { for (j = 0; j < width_y; ++j) { int64_t d = img1->planes[VPX_PLANE_Y][i * img1->stride[VPX_PLANE_Y] + j] - img2->planes[VPX_PLANE_Y][i * img2->stride[VPX_PLANE_Y] + j]; sqrerr += d * d; } + } double mse = static_cast<double>(sqrerr) / (width_y * height_y); double psnr = 100.0; if (mse > 0.0) { diff --git a/test/video_source.h b/test/video_source.h index 94a95ce8d..424bb2cfb 100644 --- a/test/video_source.h +++ b/test/video_source.h @@ -218,10 +218,11 @@ class RandomVideoSource : public DummyVideoSource { // than holding previous frames to encourage keyframes to be thrown. virtual void FillFrame() { if (img_) { - if (frame_ % 30 < 15) + if (frame_ % 30 < 15) { for (size_t i = 0; i < raw_sz_; ++i) img_->img_data[i] = rnd_.Rand8(); - else + } else { memset(img_->img_data, 0, raw_sz_); + } } } diff --git a/test/vp8_fdct4x4_test.cc b/test/vp8_fdct4x4_test.cc index 5def9a127..da4f0caa1 100644 --- a/test/vp8_fdct4x4_test.cc +++ b/test/vp8_fdct4x4_test.cc @@ -80,24 +80,27 @@ TEST(VP8FdctTest, SignBiasCheck) { for (int i = 0; i < count_test_block; ++i) { // Initialize a test block with input range [-255, 255]. - for (int j = 0; j < 16; ++j) + for (int j = 0; j < 16; ++j) { test_input_block[j] = rnd.Rand8() - rnd.Rand8(); + } vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch); for (int j = 0; j < 16; ++j) { - if (test_output_block[j] < 0) + if (test_output_block[j] < 0) { ++count_sign_block[j][0]; - else if (test_output_block[j] > 0) + } else if (test_output_block[j] > 0) { ++count_sign_block[j][1]; + } } } bool bias_acceptable = true; - for (int j = 0; j < 16; ++j) + for (int j = 0; j < 16; ++j) { bias_acceptable = bias_acceptable && (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000); + } EXPECT_EQ(true, bias_acceptable) << "Error: 4x4 FDCT has a sign bias > 1% for input range [-255, 255]"; @@ -106,24 +109,27 @@ TEST(VP8FdctTest, SignBiasCheck) { for (int i = 0; i < count_test_block; ++i) { // Initialize a test block with input range [-15, 15]. - for (int j = 0; j < 16; ++j) + for (int j = 0; j < 16; ++j) { test_input_block[j] = (rnd.Rand8() >> 4) - (rnd.Rand8() >> 4); + } vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch); for (int j = 0; j < 16; ++j) { - if (test_output_block[j] < 0) + if (test_output_block[j] < 0) { ++count_sign_block[j][0]; - else if (test_output_block[j] > 0) + } else if (test_output_block[j] > 0) { ++count_sign_block[j][1]; + } } } bias_acceptable = true; - for (int j = 0; j < 16; ++j) + for (int j = 0; j < 16; ++j) { bias_acceptable = bias_acceptable && (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000); + } EXPECT_EQ(true, bias_acceptable) << "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]"; @@ -140,8 +146,9 @@ TEST(VP8FdctTest, RoundTripErrorCheck) { int16_t test_output_block[16]; // Initialize a test block with input range [-255, 255]. - for (int j = 0; j < 16; ++j) + for (int j = 0; j < 16; ++j) { test_input_block[j] = rnd.Rand8() - rnd.Rand8(); + } const int pitch = 8; vp8_short_fdct4x4_c(test_input_block, test_temp_block, pitch); diff --git a/test/vp9_arf_freq_test.cc b/test/vp9_arf_freq_test.cc index 0799bcae8..48a4ca739 100644 --- a/test/vp9_arf_freq_test.cc +++ b/test/vp9_arf_freq_test.cc @@ -68,10 +68,11 @@ const int kMinArfVectors[] = { int is_extension_y4m(const char *filename) { const char *dot = strrchr(filename, '.'); - if (!dot || dot == filename) + if (!dot || dot == filename) { return 0; - else + } else { return !strcmp(dot, ".y4m"); + } } class ArfFreqTest @@ -161,13 +162,14 @@ class ArfFreqTest int GetMinVisibleRun() const { return min_run_; } int GetMinArfDistanceRequested() const { - if (min_arf_requested_) + if (min_arf_requested_) { return min_arf_requested_; - else + } else { return vp9_rc_get_default_min_gf_interval( test_video_param_.width, test_video_param_.height, (double)test_video_param_.framerate_num / test_video_param_.framerate_den); + } } TestVideoParam test_video_param_; diff --git a/test/vp9_encoder_parms_get_to_decoder.cc b/test/vp9_encoder_parms_get_to_decoder.cc index a08955534..b5ca1a350 100644 --- a/test/vp9_encoder_parms_get_to_decoder.cc +++ b/test/vp9_encoder_parms_get_to_decoder.cc @@ -87,8 +87,9 @@ class VpxEncoderParmsGetToDecoder encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7); encoder->Control(VP8E_SET_ARNR_STRENGTH, 5); encoder->Control(VP8E_SET_ARNR_TYPE, 3); - if (encode_parms.render_size[0] > 0 && encode_parms.render_size[1] > 0) + if (encode_parms.render_size[0] > 0 && encode_parms.render_size[1] > 0) { encoder->Control(VP9E_SET_RENDER_SIZE, encode_parms.render_size); + } } } diff --git a/test/vp9_end_to_end_test.cc b/test/vp9_end_to_end_test.cc index e82320f26..168368f5f 100644 --- a/test/vp9_end_to_end_test.cc +++ b/test/vp9_end_to_end_test.cc @@ -67,10 +67,11 @@ const int kCpuUsedVectors[] = { 1, 2, 3, 5, 6 }; int is_extension_y4m(const char *filename) { const char *dot = strrchr(filename, '.'); - if (!dot || dot == filename) + if (!dot || dot == filename) { return 0; - else + } else { return !strcmp(dot, ".y4m"); + } } class EndToEndTestLarge diff --git a/test/yuv_video_source.h b/test/yuv_video_source.h index 2cc81a0f3..71ad2ab9a 100644 --- a/test/yuv_video_source.h +++ b/test/yuv_video_source.h @@ -45,8 +45,9 @@ class YUVVideoSource : public VideoSource { input_file_ = OpenTestDataFile(file_name_); ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: " << file_name_; - if (start_) + if (start_) { fseek(input_file_, static_cast<unsigned>(raw_size_) * start_, SEEK_SET); + } frame_ = start_; FillFrame(); |