ref: cfd92dab18639c7f1198393ce04613e6d2b126eb
parent: 6a8d4631a8b28c2fb0be87467d38174ea3c04e95
parent: 2c17d54681bf6f529fac713d37075e8060e0c72a
author: James Zern <[email protected]>
date: Mon Aug 8 16:12:42 EDT 2016
Merge changes from topic 'clang-tidy' * changes: *_perf_test.cc: correct DoDecode signature test: apply clang-tidy google-readability-braces-around-statements
--- a/test/active_map_refresh_test.cc
+++ b/test/active_map_refresh_test.cc
@@ -37,8 +37,9 @@
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;
+ }
}
}
}
--- a/test/avg_test.cc
+++ b/test/avg_test.cc
@@ -55,15 +55,17 @@
// 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);
}
--- a/test/blockiness_test.cc
+++ b/test/blockiness_test.cc
@@ -100,10 +100,11 @@
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);
+ }
}
}
}
--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -346,17 +346,19 @@
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 @@
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,7 +556,7 @@
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) +
@@ -560,6 +563,7 @@
lookup(out_ref, y * kOutputStride + x),
1))
<< "(" << x << "," << y << ")";
+ }
}
TEST_P(ConvolveTest, CopyHoriz) {
@@ -574,11 +578,12 @@
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 @@
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 @@
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,7 +697,7 @@
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))
@@ -697,6 +704,7 @@
<< "mismatch at (" << x << "," << y << "), "
<< "filters (" << filter_bank << "," << filter_x << ","
<< filter_y << ")";
+ }
}
}
}
@@ -767,7 +775,7 @@
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))
@@ -774,6 +782,7 @@
<< "mismatch at (" << x << "," << y << "), "
<< "filters (" << filter_bank << "," << filter_x << ","
<< filter_y << ")";
+ }
}
}
}
@@ -828,10 +837,11 @@
#endif
if (axis) seed_val++;
}
- if (axis)
+ if (axis) {
seed_val -= 8;
- else
+ } else {
seed_val++;
+ }
}
if (axis) seed_val += 8;
@@ -860,7 +870,7 @@
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))
@@ -867,6 +877,7 @@
<< "mismatch at (" << x << "," << y << "), "
<< "filters (" << filter_bank << "," << filter_x << ","
<< filter_y << ")";
+ }
}
}
}
--- a/test/datarate_test.cc
+++ b/test/datarate_test.cc
@@ -46,8 +46,9 @@
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 @@
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);
--- a/test/dct16x16_test.cc
+++ b/test/dct16x16_test.cc
@@ -386,8 +386,9 @@
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 @@
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 @@
// 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 @@
}
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));
--- a/test/dct32x32_test.cc
+++ b/test/dct32x32_test.cc
@@ -37,8 +37,9 @@
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 @@
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 @@
}
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
--- a/test/decode_perf_test.cc
+++ b/test/decode_perf_test.cc
@@ -28,7 +28,6 @@
#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 @@
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 @@
++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 @@
pkt->data.frame.sz);
}
- virtual bool DoDecode() { return false; }
+ virtual bool DoDecode() const { return false; }
void set_speed(unsigned int speed) { speed_ = speed; }
--- a/test/decode_test_driver.cc
+++ b/test/decode_test_driver.cc
@@ -97,8 +97,9 @@
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;
}
--- a/test/encode_perf_test.cc
+++ b/test/encode_perf_test.cc
@@ -105,7 +105,7 @@
}
// 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 @@
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();
--- a/test/encode_test_driver.cc
+++ b/test/encode_test_driver.cc
@@ -52,10 +52,11 @@
}
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 @@
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 @@
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 @@
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 @@
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;
--- a/test/error_resilience_test.cc
+++ b/test/error_resilience_test.cc
@@ -152,23 +152,27 @@
}
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_; }
--- a/test/fdct4x4_test.cc
+++ b/test/fdct4x4_test.cc
@@ -170,8 +170,9 @@
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_));
--- a/test/fdct8x8_test.cc
+++ b/test/fdct8x8_test.cc
@@ -51,8 +51,9 @@
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 @@
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 @@
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 @@
}
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 @@
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];
--- a/test/idct8x8_test.cc
+++ b/test/idct8x8_test.cc
@@ -28,8 +28,9 @@
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 @@
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];
--- a/test/idct_test.cc
+++ b/test/idct_test.cc
@@ -43,11 +43,12 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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));
--- a/test/keyframe_test.cc
+++ b/test/keyframe_test.cc
@@ -35,10 +35,12 @@
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) {
--- a/test/partial_idct_test.cc
+++ b/test/partial_idct_test.cc
@@ -100,9 +100,10 @@
// 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));
--- a/test/sad_test.cc
+++ b/test/sad_test.cc
@@ -114,9 +114,10 @@
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;
}
--- a/test/sixtap_predict_test.cc
+++ b/test/sixtap_predict_test.cc
@@ -146,10 +146,11 @@
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 @@
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);
+ }
}
}
}
--- a/test/test_libvpx.cc
+++ b/test/test_libvpx.cc
@@ -45,10 +45,12 @@
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
--- a/test/util.h
+++ b/test/util.h
@@ -28,12 +28,13 @@
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) {
--- a/test/video_source.h
+++ b/test/video_source.h
@@ -218,10 +218,11 @@
// 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_);
+ }
}
}
--- a/test/vp8_fdct4x4_test.cc
+++ b/test/vp8_fdct4x4_test.cc
@@ -80,24 +80,27 @@
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 @@
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 @@
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);
--- a/test/vp9_arf_freq_test.cc
+++ b/test/vp9_arf_freq_test.cc
@@ -68,10 +68,11 @@
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 @@
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_;
--- a/test/vp9_encoder_parms_get_to_decoder.cc
+++ b/test/vp9_encoder_parms_get_to_decoder.cc
@@ -87,8 +87,9 @@
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);
+ }
}
}
--- a/test/vp9_end_to_end_test.cc
+++ b/test/vp9_end_to_end_test.cc
@@ -67,10 +67,11 @@
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
--- a/test/yuv_video_source.h
+++ b/test/yuv_video_source.h
@@ -45,8 +45,9 @@
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();