<feed xmlns='http://www.w3.org/2005/Atom'>
<title>atracdenc/src, 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-05-03T18:47:07Z</updated>
<entry>
<title>Drop FileModeToWide allow-list</title>
<updated>2026-05-03T18:47:07Z</updated>
<author>
<name>Daniil Cherednik</name>
<email>dan.cherednik@gmail.com</email>
</author>
<published>2026-05-03T18:47:07Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=412629c19112d97c1ef56a75cdeee06fb3eb7f7f'/>
<id>urn:sha1:412629c19112d97c1ef56a75cdeee06fb3eb7f7f</id>
<content type='text'>
Widen the ASCII fopen mode string with std::wstring's iterator-pair
constructor instead of maintaining a hand-coded mapping. ASCII (0-127)
codepoints are valid wchar_t code units on Windows, which is the only
alphabet fopen modes use.

Co-Authored-By: Claude Opus 4.7 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>Clean up UTF-8 path handling</title>
<updated>2026-05-03T18:37:20Z</updated>
<author>
<name>Daniil Cherednik</name>
<email>dan.cherednik@gmail.com</email>
</author>
<published>2026-05-03T18:37:20Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=84c58f18c908defb95494e86d0c7c36750dac01b'/>
<id>urn:sha1:84c58f18c908defb95494e86d0c7c36750dac01b</id>
<content type='text'>
Reuse the shared UTF-8 path helper in Media Foundation, normalize compressed output open errors, cover AEA encode/decode paths, and expand integration tests for ATRAC1 and decode filenames.
</content>
</entry>
<entry>
<title>Fix UTF-8 input and output paths</title>
<updated>2026-05-03T18:20:31Z</updated>
<author>
<name>Daniil Cherednik</name>
<email>dan.cherednik@gmail.com</email>
</author>
<published>2026-05-03T18:20:31Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=2f96a97c070ecd6475900ffbe4bf9ee52f6b27e4'/>
<id>urn:sha1:2f96a97c070ecd6475900ffbe4bf9ee52f6b27e4</id>
<content type='text'>
Report libsndfile open failures before sample-rate validation, use UTF-16 Windows opens for PCM and compressed containers, and add integration tests for missing input plus UTF-8 input/output filenames.
</content>
</entry>
<entry>
<title>Add MSYS2 build support (#70)</title>
<updated>2026-05-03T12:41:21Z</updated>
<author>
<name>Daniil Cherednik</name>
<email>dan.cherednik@gmail.com</email>
</author>
<published>2026-05-03T12:41:21Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=3e04903c35c61a0f0be0c2db409f5fd5f58d6e12'/>
<id>urn:sha1:3e04903c35c61a0f0be0c2db409f5fd5f58d6e12</id>
<content type='text'>
* Add MSYS2 build support

Add a selectable PCM I/O backend so MSVC builds can keep Media Foundation while MSYS2/MinGW builds use libsndfile.

Teach the libsndfile finder about MINGW_PREFIX and add a Windows MSYS2 CI job that builds the libsndfile backend.

Fix and enable tests for MSYS2 builds</content>
</entry>
<entry>
<title>Fix mono AT3 RIFF channel count. issues/67</title>
<updated>2026-05-02T21:42:38Z</updated>
<author>
<name>Daniil Cherednik</name>
<email>dan.cherednik@gmail.com</email>
</author>
<published>2026-05-02T21:40:10Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=93e92ee09faa942eefa997e244a7e7b519a51119'/>
<id>urn:sha1:93e92ee09faa942eefa997e244a7e7b519a51119</id>
<content type='text'>
AT3 RIFF output always stores a two-channel ATRAC3 stream.
Mono input is encoded as duplicated single channels or as joint stereo with an empty side channel.
</content>
</entry>
<entry>
<title>Initialize bit allocator LastLambda during the start allocation. Fix issues/69</title>
<updated>2026-05-02T20:34:24Z</updated>
<author>
<name>Daniil Cherednik</name>
<email>dan.cherednik@gmail.com</email>
</author>
<published>2026-05-02T20:32:03Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=1186ae7be5c5a4f335dbf6f3a768e3792ee4bcb2'/>
<id>urn:sha1:1186ae7be5c5a4f335dbf6f3a768e3792ee4bcb2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge pull request #66 from dcherednik/new_psy</title>
<updated>2026-04-19T22:49:22Z</updated>
<author>
<name>Daniil Cherednik</name>
<email>dan.cherednik@gmail.com</email>
</author>
<published>2026-04-19T22:49:22Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=d557341f131c4b531500d879b9003dcfbc43f678'/>
<id>urn:sha1:d557341f131c4b531500d879b9003dcfbc43f678</id>
<content type='text'>
Conservative initial implementation of ATRAC3 tonal extraction.

This is a safe first step tuned for stability and bitstream compatibility, not maximum aggressiveness. It gives the most benefit on synthetic signals and material with strong, steady pure tones (for example simple electronic leads and solo tonal instruments).</content>
</entry>
<entry>
<title>atrac3: reimplement tonal encoding. Use flatness-based tonal extraction</title>
<updated>2026-04-19T22:27:45Z</updated>
<author>
<name>Daniil Cherednik</name>
<email>dan.cherednik@gmail.com</email>
</author>
<published>2026-04-18T14:51:23Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=e784b79cfef682059cf5cc8cf9bed635e714c439'/>
<id>urn:sha1:e784b79cfef682059cf5cc8cf9bed635e714c439</id>
<content type='text'>
- Add shared CalcSpectralFlatnessPerBfu helper in atrac_psy_common
  with BFU-table mapping.
- Implement ATRAC3 tonal extraction: compute MDCT energy, estimate
  per-BFU flatness, extract up to 5-bin strongest tonal run in
  low-flatness BFUs, and zero extracted bins in residual.
- Map extracted tonal bins into TTonalBlocks and integrate them into
  bitstream coding.
- Update ATRAC3 bit allocation - reduce residual bits for BFUs with tonal
  blocks, and increase tonal quantizer selection.
- Restore --notonal CLI option in main.cpp for A/B comparison.
</content>
</entry>
<entry>
<title>at3: write fact chunk, fix bytes_per_frame and chunk sizes</title>
<updated>2026-04-16T23:20:59Z</updated>
<author>
<name>hilman2</name>
<email>hilman2@gmail.com</email>
</author>
<published>2026-04-16T20:04:41Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=9980dc484d58fa574e6e2f4c1cfc50f908e6344f'/>
<id>urn:sha1:9980dc484d58fa574e6e2f4c1cfc50f908e6344f</id>
<content type='text'>
The AT3-in-WAV writer produces headers that Sony's psp_at3tool rejects for
files longer than around forty seconds. The tool prints "input file is
illegal file or over 2G Byte" and refuses to decode. ffmpeg accepts the
file but decodes it without any encoder-delay compensation, leaving a
variable lag of several hundred samples relative to the source. The two
observations have a common root cause: the header we write is missing
fields that downstream decoders rely on.

This patch addresses three concrete issues in src/at3.cpp.

First, the writer emits no fact chunk. The fact chunk is optional in the
general RIFF specification but is how WAVEFORMATEX based codecs announce
the total number of decoded samples per channel. psp_at3tool uses the
sample count together with samples-per-frame to decide how much PCM to
produce and where to stop. Without a fact chunk the tool falls back to a
short default and either truncates output or, for longer streams, rejects
the file outright. ffmpeg uses the same field to skip encoder priming
samples. Sony's own AT3 files carry this chunk with a fixed eight byte
payload containing total_samples and samples_per_frame. We now write the
same structure.

Second, the bytes_per_frame field in the ATRAC3 extradata was hardcoded
to 0x10 with an XXX comment. The correct value for standard ATRAC3 is
0x1000, that is 4096, which corresponds to the PCM bytes represented by
one frame (1024 samples per channel times two channels times two bytes
per sample). Sony's encoder writes 4096 at this offset and both ffmpeg
and psp_at3tool validate against that number. The previous value of
sixteen bytes per frame is nonsensical and was part of why psp_at3tool
misestimated the playback length.

Third, the RIFF chunk_size field was being written as the full file size.
By the RIFF specification this field should hold the size of everything
that follows the field itself, that is file_size minus eight. Writing the
full size is tolerated by ffmpeg but violates the specification and makes
the file look larger than it is to strict parsers.

Because the PCM engine can flush additional frames after the initially
estimated numFrames count (due to look-ahead tail during encoding), the
three length fields chunk_size, total_samples, and subchunk2_size were
stale by one to three frames relative to the actual data on disk. To
keep them consistent, TAt3 now counts frames as WriteFrame is called and
seeks back to overwrite the three length fields in the destructor, so
the final file describes its real contents.

The patch is purely a container metadata fix. The encoded AT3 payload is
byte-identical to before. After this change, output from atracdenc for
long test tracks (90 and 186 seconds, 132 kbps LP2) is accepted and fully
decoded by psp_at3tool in a single pass, and ffmpeg decodes with a
constant small codec latency instead of the previous variable drift.
This made it possible to run a proper triple comparison against Sony's
reference encoder, which previously looked catastrophic (gap around
-22 dB SNR) purely due to the alignment problem but sits at roughly
-0.5 to -1.4 dB SNR once the container headers are correct.

Signed-off-by: hilman2 &lt;hilman2@gmail.com&gt;
</content>
</entry>
<entry>
<title>[AT3] refactor bitstream allocation loop to bs_encode</title>
<updated>2026-04-11T21:20:06Z</updated>
<author>
<name>Daniil Cherednik</name>
<email>dan.cherednik@gmail.com</email>
</author>
<published>2026-04-11T21:18:36Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/atracdenc/commit/?id=a958b27a43f0a436406dc51b942ca2f3a417e7a7'/>
<id>urn:sha1:a958b27a43f0a436406dc51b942ca2f3a417e7a7</id>
<content type='text'>
</content>
</entry>
</feed>
