summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniil Cherednik <[email protected]>2025-06-16 22:21:54 +0200
committerDaniil Cherednik <[email protected]>2025-07-20 14:01:08 +0200
commit58b4ce18809b8ae0f2d5b3f810ff57df8fc8ea65 (patch)
tree556a936740b192b71ac20e9938184bfc0f6e95b4
parent33d1da0ec9dafe39ae002138b12be6137748a8cc (diff)
0.2 stable branch
- ATH and some bit allocation tuning for ATRAC1 compatible encoding. - ATH, energy aware quanitization and tuning for ATRAC3 compatible encoding. - Noticeable improvements for LP4 mode (but still not perfect on some tracks for LP4 bitrate) - Initial implementation of ATRAC3PLUS compatible encoding.
-rw-r--r--README.md9
-rw-r--r--man/atracdenc.124
-rw-r--r--src/atrac/at3p/at3p_gha.cpp6
-rw-r--r--src/help.cpp9
-rw-r--r--src/main.cpp1
5 files changed, 33 insertions, 16 deletions
diff --git a/README.md b/README.md
index 27366ac..413eb55 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ It is free LGPL implementation of ATRAC1, ATRAC3 encoders.
Building:
You need:
-* C++14 compiler.
+* C++17 compiler.
* cmake >= 3.1
* libsndfiles
@@ -52,8 +52,13 @@ ATRAC3:
./atracdenc -e atrac3 -i ~/01.wav -o /tmp/01.oma
```
+ATRAC3PLUS:
+```
+./atracdenc -e atrac3plus -i ~/01.wav -o /tmp/01.oma
+```
+
+
More information on the [atracdenc man page](https://code.mastervirt.ru/atracdenc/about/man/atracdenc.1)
Limitations:
- - Bit allocation based on the tonality of the signal (see http://www.minidisc.org/aes_atrac.html)
- Only 44100 16bit wav input file
diff --git a/man/atracdenc.1 b/man/atracdenc.1
index 07351d2..7f51d7d 100644
--- a/man/atracdenc.1
+++ b/man/atracdenc.1
@@ -12,11 +12,11 @@
. ftr VB CB
. ftr VBI CBI
.\}
-.TH "ATRACDENC" "1" "9 November 2023" "atracdenc 0.1.0" "User Manual"
+.TH "ATRACDENC" "1" "16 Jun 2025" "atracdenc 0.2.0" "User Manual"
.hy
.SH NAME
.PP
-atracdenc - encode to or decode from ATRAC format
+atracdenc - encode to or decode from ATRAC family formats
.SH SYNOPSIS
.PP
atracdenc [options] {-e <codec> | \[en]encode=<codec> | -d |
@@ -24,8 +24,8 @@ atracdenc [options] {-e <codec> | \[en]encode=<codec> | -d |
.PP
.SH DESCRIPTION
.PP
-atracdenc is an audio converter that can encode into ATRAC1
-or ATRAC3 compatible format and decode from ATRAC1.
+atracdenc is an audio converter that can encode into ATRAC1, ATRAC3
+or ATRAC3PLUS compatible format and decode from ATRAC1.
.PP
For ATRAC1 (also known as ATRAC SP on MiniDisk devices) AEA audio
container is used. Only one bitrate (292 kbit/s) is specified.
@@ -33,6 +33,8 @@ container is used. Only one bitrate (292 kbit/s) is specified.
For ATRCA3 (also known as ATRAC LP on MiniDisk devices) OMA, AT3(riff)
and RealMedia container is supported. In the case of OMA and AT3 container, compatible bitrates are 66150 (LP4), 104738 and 132300 (LP2) bits/s.
The RealMedia container supports 66150, 93713, 104738, 132300, 146081, 176400, 264600 and 352800 bits/s.
+.PP
+For ATRAC3PLUS currently only OMA container is supported with highest bitrate 352800 bits/s
.SH OPTIONS
.TP
.B \-h
@@ -46,7 +48,7 @@ Use - to read from stdin.
Path to the output file. The container format is chosen automaticaly according to the file extension.
.TP
.B \-e <codec>
-Encode mode. <codec> is a codec name must be one of atrac1, atrac3, atrac3_lp2, atrac3_lp4.
+Encode mode. <codec> is a codec name must be one of atrac1, atrac3, atrac3_lp4 or atarc3plus
.TP
.B \--encode=<codec>
Alias for -e.
@@ -68,7 +70,7 @@ Set constant amount of used BFU (ATRAC1, ATRAC3).
.B \--bfuidxfast
Enable fast search of BFU amount (ATRAC1).
.TP
-.B \--notransient[=mask]
+.B \--notransient[=mask] (ATRAC1)
Disable transient detection and use an optional mask \
to set bands with a forced short MDCT window.
.TP
@@ -100,7 +102,6 @@ ATRAC3 LP4 compatible encoding (low quality)
-o
.I out.oma
-
.LP
ATRAC3 + RealAudio container + max supported bitrate
.IP
@@ -109,3 +110,12 @@ ATRAC3 + RealAudio container + max supported bitrate
.I in.wav
-o
.I out.rm
+
+.LP
+ATRAC3PLUS compatible encoding
+.IP
+.B atracdenc \-e atrac3plus
+-i
+.I in.wav
+-o
+.I out.oma
diff --git a/src/atrac/at3p/at3p_gha.cpp b/src/atrac/at3p/at3p_gha.cpp
index b426921..61603fb 100644
--- a/src/atrac/at3p/at3p_gha.cpp
+++ b/src/atrac/at3p/at3p_gha.cpp
@@ -19,7 +19,7 @@
#include "at3p_gha.h"
#include "ff/atrac3plus.h"
-#include <assert.h>
+#include <util.h>
#include <atrac/atrac_psy_common.h>
#include <libgha/include/libgha.h>
@@ -574,7 +574,7 @@ bool TGhaProcessor::DoRound(TChannelData& data, size_t& totalTones) const
data.GhaInfos.insert({newIndex, x});
}
} else {
- std::cerr << "jackpot! same freq index after adjust call, sb: " << sb << " " << std::endl;
+ // std::cerr << "jackpot! same freq index after adjust call, sb: " << sb << " " << std::endl;
data.GhaInfos.erase(data.LastAddedFreqIdx[sb]);
totalTones--;
data.MarkSubbandDone(sb);
@@ -601,7 +601,7 @@ bool TGhaProcessor::DoRound(TChannelData& data, size_t& totalTones) const
if (data.SubbandDone[sb] == 0) {
bool ins = data.GhaInfos.insert({freqIndex, res}).second;
data.LastAddedFreqIdx[sb] = freqIndex;
- assert(ins);
+ ASSERT(ins);
} else {
const auto it = data.GhaInfos.lower_bound(freqIndex);
const size_t minFreqDistanse = 20; // Now we unable to handle tones with close frequency
diff --git a/src/help.cpp b/src/help.cpp
index 45d17b3..5bef9b3 100644
--- a/src/help.cpp
+++ b/src/help.cpp
@@ -3,13 +3,13 @@
const std::string& GetHelp() {
const static std::string txt = R"(
-atracdenc is a tool to encode in to ATRAC1 or ATRAC3, decode from ATRAC1 formats
+atracdenc is a tool to encode in to ATRAC1 or ATRAC3, ATRAC3PLUS, decode from ATRAC1 formats
Usage:
atracdenc {-e <codec> | --encode=<codec> | -d | --decode} -i <in> -o <out>
-e or --encode encode file using one of codecs
- {atrac1 | atrac3 | atrac3_lp}
+ {atrac1 | atrac3 | atrac3_lp | atrac3plus}
-d or --decode decode file (only ATRAC1 supported for decoding)
-i path to input file
-o path to output file
@@ -21,13 +21,16 @@ Advanced options:
--bfuidxconst Set constant amount of used BFU (ATRAC1, ATRAC3).
--bfuidxfast Enable fast search of BFU amount (ATRAC1)
--notransient[=mask] Disable transient detection and use optional mask
- to set bands with forced short MDCT window
+ to set bands with forced short MDCT window (ATRAC1)
Examples:
Encode in to ATRAC1 (SP)
atracdenc -e atrac1 -i my_file.wav -o my_file.aea
Encode in to ATRAC3 (LP2)
atracdenc -e atrac3 -i my_file.wav -o my_file.oma
+Encode in to ATRAC3PLUS
+ atracdenc -e atrac3plus -i my_file.wav -o my_file.oma
+
)";
return txt;
diff --git a/src/main.cpp b/src/main.cpp
index 9f638f3..6cf6ff8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -201,7 +201,6 @@ static void PrepareAtrac3Encoder(const string& inFile,
TPcmEnginePtr* pcmEngine,
TAtracProcessorPtr* atracProcessor)
{
- std::cout << "WARNING: ATRAC3 is uncompleted, result will be not good )))" << std::endl;
const int numChannels = encoderSettings.SourceChannels;
*totalSamples = wavIO->GetTotalSamples();
const uint64_t numFrames = (*totalSamples) / 1024;