/* * Copyright (c) 2020, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
using libaom_test::ACMRandom; using libaom_test::FunctionEquivalenceTest; using ::testing::Combine; using ::testing::Range; using ::testing::Values; using ::testing::ValuesIn;
namespace { constint kNumIterations = 10000;
typedef uint64_t (*SSI16Func)(const int16_t *src, int src_stride, int width, int height, int *sum); typedef libaom_test::FuncParam<SSI16Func> TestFuncs;
void SumSSETest::RunTest(int isRandom) { for (int k = 0; k < kNumIterations; k++) { constint width = 4 * (rnd_(31) + 1); // Up to 128x128 constint height = 4 * (rnd_(31) + 1); // Up to 128x128 int stride = 4 << rnd_(7); // Up to 256 stride while (stride < width) { // Make sure it's valid
stride = 4 << rnd_(7);
} if (isRandom) {
GenRandomData(width, height, stride);
} else {
GenExtremeData(width, height, stride);
} int sum_ref = 0, sum_tst = 0; const uint64_t sse_ref =
params_.ref_func(src_, stride, width, height, &sum_ref); const uint64_t sse_tst =
params_.tst_func(src_, stride, width, height, &sum_tst);
EXPECT_EQ(sse_ref, sse_tst)
<< "Error: SumSSETest [" << width << "x" << height
<< "] C SSE does not match optimized output.";
EXPECT_EQ(sum_ref, sum_tst)
<< "Error: SumSSETest [" << width << "x" << height
<< "] C Sum does not match optimized output.";
}
}
void SumSSETest::RunSpeedTest() { for (int block = BLOCK_4X4; block < BLOCK_SIZES_ALL; block++) { constint width = block_size_wide[block]; // Up to 128x128 constint height = block_size_high[block]; // Up to 128x128 int stride = 4 << rnd_(7); // Up to 256 stride while (stride < width) { // Make sure it's valid
stride = 4 << rnd_(7);
}
GenExtremeData(width, height, stride); constint num_loops = 1000000000 / (width + height); int sum_ref = 0, sum_tst = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.