diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2024-11-26 23:27:11 +0100 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2024-11-26 23:27:11 +0100 |
commit | c73a0e24a0d5c510a65efbe5c2fbc7fd39a3c003 (patch) | |
tree | ceea2f6addb0c052cb0c32e3f07ef9e0bb4a9b4e | |
parent | 7e745ed7fc514751ad05b1976ccafac9c02cbf58 (diff) | |
download | atracdenc-c73a0e24a0d5c510a65efbe5c2fbc7fd39a3c003.tar.gz |
[AT3P] Tune GHA to extract more sine waves and bugfix
-rw-r--r-- | src/atrac/at3p/at3p_gha.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/atrac/at3p/at3p_gha.cpp b/src/atrac/at3p/at3p_gha.cpp index c101b72..bc9973e 100644 --- a/src/atrac/at3p/at3p_gha.cpp +++ b/src/atrac/at3p/at3p_gha.cpp @@ -264,7 +264,7 @@ void TGhaProcessor::CheckResuidalAndApply(float* resuidal, size_t size, void* d) return; } - const float threshold = 1.4; //TODO: tune it + const float threshold = 1.05; //TODO: tune it if (static_cast<bool>(ctx->Data->LastResuidalEnergy[sb]) == false) { ctx->Data->LastResuidalEnergy[sb] = resuidalEnergy; } else if (ctx->Data->LastResuidalEnergy[sb] < resuidalEnergy * threshold) { @@ -427,23 +427,13 @@ bool TGhaProcessor::DoRound(TChannelData& data, size_t& totalTones) const } auto it = cit; + for (size_t i = 0; i < tmp.size(); i++) { + it = data.GhaInfos.erase(it); + } for (const auto& x : tmp) { data.MaxToneMagnitude[sb] = std::max(data.MaxToneMagnitude[sb], x.magnitude); const auto newIndex = GhaFreqToIndex(x.frequency, sb); - //std ::cerr << "after adjust, idx: " << it->first << " -> " << newIndex << " info: " << it->second.frequency << " -> " << x.frequency << " " << it->second.magnitude << " -> " << x.magnitude << " phase: " << x.phase << std::endl; - if (newIndex != it->first) { - bool skip = newIndex > it->first; - //std::cerr << "erase: " << it->first << "skip: " << skip << std::endl; - data.GhaInfos.insert(it, {newIndex, x}); - it = data.GhaInfos.erase(it); - if (skip && it != data.GhaInfos.end()) { - it++; - } - } else { - //std::cerr << "replace" << std::endl; - it->second = x; - it++; - } + data.GhaInfos.insert({newIndex, x}); } } else { std::cerr << "jackpot! same freq index after adjust call, sb: " << sb << " " << std::endl; @@ -467,7 +457,6 @@ bool TGhaProcessor::DoRound(TChannelData& data, size_t& totalTones) const gha_analyze_one(b, &res, LibGhaCtx); auto freqIndex = GhaFreqToIndex(res.frequency, sb); - //std::cerr << "sb: " << sb << " findex: " << freqIndex << " magn " << res.magnitude << std::endl; if (PsyPreCheck(sb, res, data) == false) { data.MarkSubbandDone(sb); } else { @@ -497,6 +486,10 @@ bool TGhaProcessor::DoRound(TChannelData& data, size_t& totalTones) const continue; } } + if (data.SubbandDone[sb] == 15) { + data.MarkSubbandDone(sb); + continue; + } data.GhaInfos.insert(it, {freqIndex, res}); data.LastAddedFreqIdx[sb] = freqIndex; } |