test/: apply clang-format
Change-Id: I1138fbeff5f63beb5c0de2c357793da12502d453
diff --git a/test/hbd_metrics_test.cc b/test/hbd_metrics_test.cc
index 14a8815..f8c0517 100644
--- a/test/hbd_metrics_test.cc
+++ b/test/hbd_metrics_test.cc
@@ -22,7 +22,6 @@
#include "vpx_ports/msvc.h"
#include "vpx_scale/yv12config.h"
-
using libvpx_test::ACMRandom;
namespace {
@@ -30,70 +29,65 @@
typedef double (*LBDMetricFunc)(const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *dest);
typedef double (*HBDMetricFunc)(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest,
- uint32_t in_bd, uint32_t bd);
+ const YV12_BUFFER_CONFIG *dest, uint32_t in_bd,
+ uint32_t bd);
double compute_hbd_psnr(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest,
- uint32_t in_bd, uint32_t bd) {
+ const YV12_BUFFER_CONFIG *dest, uint32_t in_bd,
+ uint32_t bd) {
PSNR_STATS psnr;
vpx_calc_highbd_psnr(source, dest, &psnr, bd, in_bd);
return psnr.psnr[0];
}
double compute_psnr(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest) {
+ const YV12_BUFFER_CONFIG *dest) {
PSNR_STATS psnr;
vpx_calc_psnr(source, dest, &psnr);
return psnr.psnr[0];
}
double compute_hbd_psnrhvs(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest,
- uint32_t in_bd, uint32_t bd) {
+ const YV12_BUFFER_CONFIG *dest, uint32_t in_bd,
+ uint32_t bd) {
double tempy, tempu, tempv;
- return vpx_psnrhvs(source, dest,
- &tempy, &tempu, &tempv, bd, in_bd);
+ return vpx_psnrhvs(source, dest, &tempy, &tempu, &tempv, bd, in_bd);
}
double compute_psnrhvs(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest) {
+ const YV12_BUFFER_CONFIG *dest) {
double tempy, tempu, tempv;
- return vpx_psnrhvs(source, dest,
- &tempy, &tempu, &tempv, 8, 8);
+ return vpx_psnrhvs(source, dest, &tempy, &tempu, &tempv, 8, 8);
}
double compute_hbd_fastssim(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest,
- uint32_t in_bd, uint32_t bd) {
+ const YV12_BUFFER_CONFIG *dest, uint32_t in_bd,
+ uint32_t bd) {
double tempy, tempu, tempv;
- return vpx_calc_fastssim(source, dest,
- &tempy, &tempu, &tempv, bd, in_bd);
+ return vpx_calc_fastssim(source, dest, &tempy, &tempu, &tempv, bd, in_bd);
}
double compute_fastssim(const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *dest) {
double tempy, tempu, tempv;
- return vpx_calc_fastssim(source, dest,
- &tempy, &tempu, &tempv, 8, 8);
+ return vpx_calc_fastssim(source, dest, &tempy, &tempu, &tempv, 8, 8);
}
double compute_hbd_vpxssim(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest,
- uint32_t in_bd, uint32_t bd) {
+ const YV12_BUFFER_CONFIG *dest, uint32_t in_bd,
+ uint32_t bd) {
double ssim, weight;
ssim = vpx_highbd_calc_ssim(source, dest, &weight, bd, in_bd);
return 100 * pow(ssim / weight, 8.0);
}
double compute_vpxssim(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest) {
+ const YV12_BUFFER_CONFIG *dest) {
double ssim, weight;
ssim = vpx_calc_ssim(source, dest, &weight);
return 100 * pow(ssim / weight, 8.0);
}
-
class HBDMetricsTestBase {
public:
virtual ~HBDMetricsTestBase() {}
@@ -126,8 +120,8 @@
// Create some distortion for dst buffer.
dpel = rnd.Rand8();
lbd_dst.buffer_alloc[i] = (uint8_t)dpel;
- ((uint16_t*)(hbd_src.buffer_alloc))[i] = spel << (bit_depth_ - 8);
- ((uint16_t*)(hbd_dst.buffer_alloc))[i] = dpel << (bit_depth_ - 8);
+ ((uint16_t *)(hbd_src.buffer_alloc))[i] = spel << (bit_depth_ - 8);
+ ((uint16_t *)(hbd_dst.buffer_alloc))[i] = dpel << (bit_depth_ - 8);
i++;
}
@@ -141,7 +135,7 @@
// Create some small distortion for dst buffer.
dpel = 120 + (rnd.Rand8() >> 4);
lbd_dst.buffer_alloc[i] = (uint8_t)dpel;
- ((uint16_t*)(hbd_dst.buffer_alloc))[i] = dpel << (bit_depth_ - 8);
+ ((uint16_t *)(hbd_dst.buffer_alloc))[i] = dpel << (bit_depth_ - 8);
i++;
}
@@ -155,7 +149,7 @@
// Create some small distortion for dst buffer.
dpel = 126 + (rnd.Rand8() >> 6);
lbd_dst.buffer_alloc[i] = (uint8_t)dpel;
- ((uint16_t*)(hbd_dst.buffer_alloc))[i] = dpel << (bit_depth_ - 8);
+ ((uint16_t *)(hbd_dst.buffer_alloc))[i] = dpel << (bit_depth_ - 8);
i++;
}
@@ -176,11 +170,10 @@
HBDMetricFunc hbd_metric_;
};
-typedef std::tr1::tuple<LBDMetricFunc,
- HBDMetricFunc, int, int, double> MetricTestTParam;
-class HBDMetricsTest
- : public HBDMetricsTestBase,
- public ::testing::TestWithParam<MetricTestTParam> {
+typedef std::tr1::tuple<LBDMetricFunc, HBDMetricFunc, int, int, double>
+ MetricTestTParam;
+class HBDMetricsTest : public HBDMetricsTestBase,
+ public ::testing::TestWithParam<MetricTestTParam> {
public:
virtual void SetUp() {
lbd_metric_ = GET_PARAM(0);
@@ -192,9 +185,7 @@
virtual void TearDown() {}
};
-TEST_P(HBDMetricsTest, RunAccuracyCheck) {
- RunAccuracyCheck();
-}
+TEST_P(HBDMetricsTest, RunAccuracyCheck) { RunAccuracyCheck(); }
// Allow small variation due to floating point operations.
static const double kSsim_thresh = 0.001;
@@ -205,47 +196,41 @@
INSTANTIATE_TEST_CASE_P(
VPXSSIM, HBDMetricsTest,
- ::testing::Values(
- MetricTestTParam(&compute_vpxssim, &compute_hbd_vpxssim, 8, 10,
- kSsim_thresh),
- MetricTestTParam(&compute_vpxssim, &compute_hbd_vpxssim, 10, 10,
- kPhvs_thresh),
- MetricTestTParam(&compute_vpxssim, &compute_hbd_vpxssim, 8, 12,
- kSsim_thresh),
- MetricTestTParam(&compute_vpxssim, &compute_hbd_vpxssim, 12, 12,
- kPhvs_thresh)));
+ ::testing::Values(MetricTestTParam(&compute_vpxssim, &compute_hbd_vpxssim,
+ 8, 10, kSsim_thresh),
+ MetricTestTParam(&compute_vpxssim, &compute_hbd_vpxssim,
+ 10, 10, kPhvs_thresh),
+ MetricTestTParam(&compute_vpxssim, &compute_hbd_vpxssim,
+ 8, 12, kSsim_thresh),
+ MetricTestTParam(&compute_vpxssim, &compute_hbd_vpxssim,
+ 12, 12, kPhvs_thresh)));
INSTANTIATE_TEST_CASE_P(
FASTSSIM, HBDMetricsTest,
- ::testing::Values(
- MetricTestTParam(&compute_fastssim, &compute_hbd_fastssim, 8, 10,
- kFSsim_thresh),
- MetricTestTParam(&compute_fastssim, &compute_hbd_fastssim, 10, 10,
- kFSsim_thresh),
- MetricTestTParam(&compute_fastssim, &compute_hbd_fastssim, 8, 12,
- kFSsim_thresh),
- MetricTestTParam(&compute_fastssim, &compute_hbd_fastssim, 12, 12,
- kFSsim_thresh)));
+ ::testing::Values(MetricTestTParam(&compute_fastssim, &compute_hbd_fastssim,
+ 8, 10, kFSsim_thresh),
+ MetricTestTParam(&compute_fastssim, &compute_hbd_fastssim,
+ 10, 10, kFSsim_thresh),
+ MetricTestTParam(&compute_fastssim, &compute_hbd_fastssim,
+ 8, 12, kFSsim_thresh),
+ MetricTestTParam(&compute_fastssim, &compute_hbd_fastssim,
+ 12, 12, kFSsim_thresh)));
INSTANTIATE_TEST_CASE_P(
PSNRHVS, HBDMetricsTest,
- ::testing::Values(
- MetricTestTParam(&compute_psnrhvs, &compute_hbd_psnrhvs, 8, 10,
- kPhvs_thresh),
- MetricTestTParam(&compute_psnrhvs, &compute_hbd_psnrhvs, 10, 10,
- kPhvs_thresh),
- MetricTestTParam(&compute_psnrhvs, &compute_hbd_psnrhvs, 8, 12,
- kPhvs_thresh),
- MetricTestTParam(&compute_psnrhvs, &compute_hbd_psnrhvs, 12, 12,
- kPhvs_thresh)));
+ ::testing::Values(MetricTestTParam(&compute_psnrhvs, &compute_hbd_psnrhvs,
+ 8, 10, kPhvs_thresh),
+ MetricTestTParam(&compute_psnrhvs, &compute_hbd_psnrhvs,
+ 10, 10, kPhvs_thresh),
+ MetricTestTParam(&compute_psnrhvs, &compute_hbd_psnrhvs,
+ 8, 12, kPhvs_thresh),
+ MetricTestTParam(&compute_psnrhvs, &compute_hbd_psnrhvs,
+ 12, 12, kPhvs_thresh)));
INSTANTIATE_TEST_CASE_P(
PSNR, HBDMetricsTest,
::testing::Values(
- MetricTestTParam(&compute_psnr, &compute_hbd_psnr, 8, 10,
- kPhvs_thresh),
+ MetricTestTParam(&compute_psnr, &compute_hbd_psnr, 8, 10, kPhvs_thresh),
MetricTestTParam(&compute_psnr, &compute_hbd_psnr, 10, 10,
kPhvs_thresh),
- MetricTestTParam(&compute_psnr, &compute_hbd_psnr, 8, 12,
- kPhvs_thresh),
+ MetricTestTParam(&compute_psnr, &compute_hbd_psnr, 8, 12, kPhvs_thresh),
MetricTestTParam(&compute_psnr, &compute_hbd_psnr, 12, 12,
kPhvs_thresh)));
} // namespace
-