diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2016-06-19 02:58:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2016-06-19 03:31:55 +0300 |
commit | 1151d5831f19a9f24dd0c545a4968606712a62d2 (patch) | |
tree | c978c1b9a3fc86fef531dd412fe6b7668b7c0567 /src/transient_detector_ut.cpp | |
parent | 8d65a0bd0774e03b3d10354e15f2f3361a2ce26a (diff) | |
download | atracdenc-1151d5831f19a9f24dd0c545a4968606712a62d2.tar.gz |
some improvements of ATRAC3 implementation:atrac3
- simple (ATRAC1 like) psychoacoustic added
- possibility to encode tonal components
- simple tonal component extractor
- refactoring
Diffstat (limited to 'src/transient_detector_ut.cpp')
-rw-r--r-- | src/transient_detector_ut.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/transient_detector_ut.cpp b/src/transient_detector_ut.cpp new file mode 100644 index 0000000..3627d7d --- /dev/null +++ b/src/transient_detector_ut.cpp @@ -0,0 +1,36 @@ +#include "transient_detector.h" +#include <gtest/gtest.h> + +#include <vector> +#include <cmath> + +using std::vector; +using namespace NAtracDEnc; +TEST(AnalyzeGain, AnalyzeGainSimple) { + + TFloat in[256]; + for (int i = 0; i < 256; ++i) { + if (i <= 24) { + in[i] = 1.0; + } else if ( i > 24 && i <= 32) { + in[i] = 8.0; + } else if ( i > 32 && i <= 66) { + in[i] = 128.0; + } else { + in[i] = 0.5; + } + } + vector<TFloat> res = AnalyzeGain(in, 256, 32); + EXPECT_EQ(res.size(), 32); + +// for (TFloat v : res) +// std::cout << v << std::endl; + for (int i = 0; i < 3; ++i) + EXPECT_EQ(res[i], 1.0); + for (int i = 3; i < 4; ++i) + EXPECT_EQ(res[i], 8.0); + for (int i = 4; i < 9; ++i) + EXPECT_EQ(res[i], 128.0); + for (int i = 9; i < 32; ++i) + EXPECT_EQ(res[i], 0.5); +} |