Merge changes from topic 'clang-tidy'

* changes:
  *_perf_test.cc: correct DoDecode signature
  test: apply clang-tidy google-readability-braces-around-statements
This commit is contained in:
James Zern 2016-08-08 20:12:42 +00:00 committed by Gerrit Code Review
commit cfd92dab18
28 changed files with 179 additions and 102 deletions

View File

@ -37,8 +37,9 @@ int CheckMb(const vpx_image_t &current, 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;
}
}
}
}

View File

@ -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);
}

View File

@ -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);
}
}
}
}

View File

@ -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 << ")";
}
}
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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

View File

@ -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; }

View File

@ -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;
}

View File

@ -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();

View File

@ -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;

View File

@ -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_; }

View File

@ -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_));

View File

@ -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];

View File

@ -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];

View File

@ -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));

View File

@ -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) {

View File

@ -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));

View File

@ -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;
}

View File

@ -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);
}
}
}
}

View File

@ -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

View File

@ -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) {

View File

@ -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_);
}
}
}

View File

@ -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);

View File

@ -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_;

View File

@ -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);
}
}
}

View File

@ -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

View File

@ -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();