summaryrefslogtreecommitdiffstats
path: root/src/atrac3denc.cpp
diff options
context:
space:
mode:
authorDaniil Cherednik <[email protected]>2018-07-04 02:21:25 +0300
committerDaniil Cherednik <[email protected]>2018-07-04 02:21:25 +0300
commit4eade436667b31dd27f6bec7588c523d571eb664 (patch)
treefb871fdea6f2bbd4863653effe257fda4388d94a /src/atrac3denc.cpp
parent005877ed1be0012444e6086d3d5d04d61c00a92f (diff)
Scale float values to (-1; 1) for internal processing
Diffstat (limited to 'src/atrac3denc.cpp')
-rw-r--r--src/atrac3denc.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/atrac3denc.cpp b/src/atrac3denc.cpp
index 0dc9e4f..85b0c31 100644
--- a/src/atrac3denc.cpp
+++ b/src/atrac3denc.cpp
@@ -147,8 +147,8 @@ TAtrac3Data::TTonalComponents TAtrac3Processor::ExtractTonalComponents(TFloat* s
//TODO:
TFloat absValue = std::abs(specs[n]);
//std::cerr << n << " " << absValue << " " << level << std::endl;
- if (absValue > 65535.0) {
- TFloat shift = (specs[n] > 0) ? 65535.0 : -65535.0;
+ if (absValue > 0.999999) {
+ TFloat shift = (specs[n] > 0) ? 0.999999 : -0.999999;
std::cerr << "overflow: " << specs[n] << " at: " << n << std::endl;
//res.push_back({n, specs[n] - shift});
specs[n] = shift;
@@ -385,7 +385,7 @@ TPCMEngine<TFloat>::TProcessLambda TAtrac3Processor::GetEncodeLambda()
}
float median = CalcMedian(magnitude.data(), len);
for (uint16_t i = 0; i < len; ++i) {
- if (median > 1.0) {
+ if (median > 0.000015) {
return median;
}
}