<feed xmlns='http://www.w3.org/2005/Atom'>
<title>atracdenc/src/transient_spectral_upsampler.cpp, branch fix_input_file_path</title>
<subtitle>OpenSource ATRAC1 ATRAC3 Encoder</subtitle>
<id>https://code.mastervirt.ru/atracdenc/atom?h=fix_input_file_path</id>
<link rel='self' href='https://code.mastervirt.ru/atracdenc/atom?h=fix_input_file_path'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/'/>
<updated>2026-03-05T22:44:12Z</updated>
<entry>
<title>Add CalcCurve and TSpectralUpsampler for transient detection</title>
<updated>2026-03-05T22:44:12Z</updated>
<author>
<name>Daniil Cherednik</name>
<email>dan.cherednik@gmail.com</email>
</author>
<published>2026-03-05T22:44:12Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=7607e6c47490e3d5c74949e7f7d90ef6f9c0b5f0'/>
<id>urn:sha1:7607e6c47490e3d5c74949e7f7d90ef6f9c0b5f0</id>
<content type='text'>
CalcCurve (transient_detector.cpp/h):
- Recursive divide-and-conquer FindTransients scans the gain vector for
  monotonic 3-subframe windows (rising or falling); kMinScore=2.0 filters
  out oscillations smaller than a factor of 2 (no-op at Level 4).
- RelationToIdx maps an amplitude ratio to an ATRAC3 gain Level index.
- TCurveBuilderCtx carries LastLevel across frames; CalcCurve prepends it
  as a virtual boundary element to detect Location=0 attacks.
- budget=8 matches ATRAC3 SubbandInfo::MaxGainPointsNum.

TSpectralUpsampler (transient_spectral_upsampler.cpp/h):
- Applies a Planck-taper window (ε=0.15) to a 512-sample context window,
  forward-FFTs, applies a 3-bin raised-cosine HPF, zero-pads to 4096 bins,
  and inverse-FFTs to give an 8× upsampled output.
- Returns highFreqRatio = Σ|X[k]·H[k]|²/Σ|X[k]|²; callers skip CalcCurve
  when this is below kHighFreqThreshold=0.05, preventing false transients
  from Planck noise-floor variation in sub-cutoff frames.

Tests:
- gain_processor_ut: upsampled-path blocks added to all FreqDomain tests;
  CalcCurve negative tests (NegativeTests suite).
- transient_spectral_upsampler_ut: OutputSize, DCIsRemovedByLowCutFilter,
  HighFreqSinePreservesRMS (parametrised), ChirpNoTransient (0→5510 Hz
  sweep at 689 Hz low-cut, Len1024/16384/262144).

Co-Authored-By: Claude Sonnet 4.6 &lt;noreply@anthropic.com&gt;
</content>
</entry>
</feed>
