#include <limits.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include "aom_dsp/noise_model.h"
#include "aom_dsp/noise_util.h"
#include "config/aom_dsp_rtcd.h"
#include "gtest/gtest.h"
#include "test/acm_random.h"
namespace {
double randn(libaom_test::ACMRandom *random, double sigma) { … }
void noise_synth(libaom_test::ACMRandom *random, int lag, int n,
const int (*coords)[2], const double *coeffs, double *data,
int w, int h) { … }
std::vector<float> get_noise_psd(double *noise, int width, int height,
int block_size) { … }
}
TEST(NoiseStrengthSolver, GetCentersTwoBins) { … }
TEST(NoiseStrengthSolver, GetCentersTwoBins10bit) { … }
TEST(NoiseStrengthSolver, GetCenters256Bins) { … }
TEST(NoiseStrengthSolver, ObserveIdentity) { … }
TEST(NoiseStrengthSolver, SimplifiesCurve) { … }
TEST(NoiseStrengthLut, LutInitNegativeOrZeroSize) { … }
TEST(NoiseStrengthLut, LutEvalSinglePoint) { … }
TEST(NoiseStrengthLut, LutEvalMultiPointInterp) { … }
TEST(NoiseModel, InitSuccessWithValidSquareShape) { … }
TEST(NoiseModel, InitSuccessWithValidDiamondShape) { … }
TEST(NoiseModel, InitFailsWithTooLargeLag) { … }
TEST(NoiseModel, InitFailsWithTooSmallLag) { … }
TEST(NoiseModel, InitFailsWithInvalidShape) { … }
TEST(NoiseModel, InitFailsWithInvalidBitdepth) { … }
template <typename T, int bit_depth, bool use_highbd>
struct BitDepthParams { … };
template <typename T>
class FlatBlockEstimatorTest : public ::testing::Test, public T { … };
TYPED_TEST_SUITE_P(…);
TYPED_TEST_P(FlatBlockEstimatorTest, ExtractBlock) { … }
TYPED_TEST_P(FlatBlockEstimatorTest, FindFlatBlocks) { … }
REGISTER_TYPED_TEST_SUITE_P(…);
AllBitDepthParams;
INSTANTIATE_TYPED_TEST_SUITE_P(…);
template <typename T>
class NoiseModelUpdateTest : public ::testing::Test, public T { … };
TYPED_TEST_SUITE_P(…);
TYPED_TEST_P(…) …
TYPED_TEST_P(…) …
TYPED_TEST_P(…) …
TYPED_TEST_P(NoiseModelUpdateTest, UpdateSuccessForWhiteRandomNoise) { … }
TYPED_TEST_P(NoiseModelUpdateTest, UpdateSuccessForScaledWhiteNoise) { … }
TYPED_TEST_P(NoiseModelUpdateTest, UpdateSuccessForCorrelatedNoise) { … }
TYPED_TEST_P(NoiseModelUpdateTest,
NoiseStrengthChangeSignalsDifferentNoiseType) { … }
TYPED_TEST_P(NoiseModelUpdateTest, NoiseCoeffsSignalsDifferentNoiseType) { … }
REGISTER_TYPED_TEST_SUITE_P(…);
INSTANTIATE_TYPED_TEST_SUITE_P(…);
TEST(NoiseModelGetGrainParameters, TestLagSize) { … }
TEST(NoiseModelGetGrainParameters, TestARCoeffShiftBounds) { … }
TEST(NoiseModelGetGrainParameters, TestNoiseStrengthShiftBounds) { … }
TEST(NoiseModelGetGrainParameters, GetGrainParametersReal) { … }
template <typename T>
class WienerDenoiseTest : public ::testing::Test, public T { … };
TYPED_TEST_SUITE_P(…);
TYPED_TEST_P(WienerDenoiseTest, InvalidBlockSize) { … }
TYPED_TEST_P(WienerDenoiseTest, InvalidChromaSubsampling) { … }
TYPED_TEST_P(WienerDenoiseTest, GradientTest) { … }
REGISTER_TYPED_TEST_SUITE_P(…);
INSTANTIATE_TYPED_TEST_SUITE_P(…);