aboutsummaryrefslogtreecommitdiffstats
path: root/src/atrac
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2024-07-08 21:42:48 +0000
committerDaniil Cherednik <dan.cherednik@gmail.com>2024-07-09 23:07:40 +0200
commitc4b19af8391640f143aaf446658354dcf01432d1 (patch)
tree68ebb11f38eaec53e16879e59ce776bd249d8491 /src/atrac
parentf8eabde1e1a2fa6bdb2b09dcdee5cecb750beb30 (diff)
downloadatracdenc-c4b19af8391640f143aaf446658354dcf01432d1.tar.gz
Allow to configure atracdenc to use float instead of double
The default is double for hystorical reason. Actually no any reason to use double precision float point calculation for all processing. AT3P encoding will use float except places were we really need double precision. So this default will be changed to float in near future and this option will be removed.
Diffstat (limited to 'src/atrac')
-rw-r--r--src/atrac/atrac1.cpp4
-rw-r--r--src/atrac/atrac1.h4
-rw-r--r--src/atrac/atrac3plus_pqf/ut/ipqf_ut.cpp4
-rw-r--r--src/atrac/atrac_psy_common.h2
4 files changed, 7 insertions, 7 deletions
diff --git a/src/atrac/atrac1.cpp b/src/atrac/atrac1.cpp
index f7e6c61..e128609 100644
--- a/src/atrac/atrac1.cpp
+++ b/src/atrac/atrac1.cpp
@@ -26,8 +26,8 @@ constexpr uint32_t TAtrac1Data::SpecsPerBlock[MaxBfus];
constexpr uint32_t TAtrac1Data::SpecsStartLong[MaxBfus];
constexpr uint32_t TAtrac1Data::SpecsStartShort[MaxBfus];
constexpr uint32_t TAtrac1Data::BfuAmountTab[8];
-double TAtrac1Data::ScaleTable[64] = {0};
-double TAtrac1Data::SineWindow[32] = {0};
+TFloat TAtrac1Data::ScaleTable[64] = {0};
+TFloat TAtrac1Data::SineWindow[32] = {0};
} //namespace NAtrac1
} //namespace NAtracDEnc
diff --git a/src/atrac/atrac1.h b/src/atrac/atrac1.h
index e0d8161..67c869f 100644
--- a/src/atrac/atrac1.h
+++ b/src/atrac/atrac1.h
@@ -78,8 +78,8 @@ protected:
static const uint32_t BitsPerIDWL = 4;
static const uint32_t BitsPerIDSF = 6;
- static double ScaleTable[64];
- static double SineWindow[32];
+ static TFloat ScaleTable[64];
+ static TFloat SineWindow[32];
uint32_t BfuToBand(uint32_t i) {
if (i < 20)
return 0;
diff --git a/src/atrac/atrac3plus_pqf/ut/ipqf_ut.cpp b/src/atrac/atrac3plus_pqf/ut/ipqf_ut.cpp
index ee2d75d..4492cb9 100644
--- a/src/atrac/atrac3plus_pqf/ut/ipqf_ut.cpp
+++ b/src/atrac/atrac3plus_pqf/ut/ipqf_ut.cpp
@@ -233,7 +233,7 @@ TEST(pqf, Chirp_Short) {
ff_atrac3p_ipqf(&sctx, &subbands[0], &tmp[0]);
- const static float err = 1.0 / (float)(1<<22);
+ const static float err = 1.0 / (float)(1<<21);
for (int i = 368; i < 2048; i++) {
EXPECT_NEAR(tmp[i], x[i - 368], err);
@@ -260,7 +260,7 @@ TEST(pqf, Chirp_Long) {
ff_atrac3p_ipqf(&sctx, &subbands[0], &tmp[0]);
ff_atrac3p_ipqf(&sctx, &subbands[2048], &tmp[2048]);
- const static float err = 4096.0 / (float)(1<<22);
+ const static float err = 1.0 / (float)(1<<21);
for (int i = 368; i < 4096; i++) {
EXPECT_NEAR(tmp[i], x[i-368], err);
}
diff --git a/src/atrac/atrac_psy_common.h b/src/atrac/atrac_psy_common.h
index dc1e65e..1a83e74 100644
--- a/src/atrac/atrac_psy_common.h
+++ b/src/atrac/atrac_psy_common.h
@@ -21,6 +21,6 @@
namespace NAtracDEnc {
-double AnalizeScaleFactorSpread(const std::vector<TScaledBlock>& scaledBlocks);
+TFloat AnalizeScaleFactorSpread(const std::vector<TScaledBlock>& scaledBlocks);
} //namespace NAtracDEnc