diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2024-11-30 13:32:34 +0100 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2024-12-01 22:28:26 +0100 |
commit | 2ca3d7fb3cfdc0b311bb20426d53782910dee64e (patch) | |
tree | 3db4ea83192bf999e0afb5039e9d1441069a259b /src/atrac/atrac3_bitstream.h | |
parent | 4be2e387a494b1c02d2ca0747dd64b6ba8980d21 (diff) | |
download | atracdenc-2ca3d7fb3cfdc0b311bb20426d53782910dee64e.tar.gz |
Tiny quality improvements for ATRAC3 compatible mode:
* Use adaptive ATH, but efficient is limited due to qmf aliasing.
* Use loudness instead of energy to split M/S frame size.
Diffstat (limited to 'src/atrac/atrac3_bitstream.h')
-rw-r--r-- | src/atrac/atrac3_bitstream.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/atrac/atrac3_bitstream.h b/src/atrac/atrac3_bitstream.h index 152437b..e67f726 100644 --- a/src/atrac/atrac3_bitstream.h +++ b/src/atrac/atrac3_bitstream.h @@ -45,9 +45,10 @@ public: TAtrac3Data::SubbandInfo SubbandInfo; std::vector<TTonalBlock> TonalBlocks; std::vector<TScaledBlock> ScaledBlocks; - TFloat Energy; + TFloat Loudness; }; private: + static std::vector<TFloat> ATH; struct TTonalComponentsSubGroup { std::vector<uint8_t> SubGroupMap; @@ -65,10 +66,10 @@ private: const uint32_t blockSize, NBitStream::TBitStream* bitStream); std::vector<uint32_t> CalcBitsAllocation(const std::vector<TScaledBlock>& scaledBlocks, - uint32_t bfuNum, TFloat spread, TFloat shift); + uint32_t bfuNum, TFloat spread, TFloat shift, TFloat loudness); std::pair<uint8_t, std::vector<uint32_t>> CreateAllocation(const TSingleChannelElement& sce, - uint16_t targetBits, int mt[MaxSpecs]); + uint16_t targetBits, int mt[MaxSpecs], float laudness); std::pair<uint8_t, uint32_t> CalcSpecsBitsConsumption(const TSingleChannelElement& sce, const std::vector<uint32_t>& precisionPerEachBlocks, @@ -85,15 +86,9 @@ private: const std::vector<uint32_t>& allocTable, NBitStream::TBitStream* bitStream); public: - TAtrac3BitStreamWriter(ICompressedOutput* container, const TContainerParams& params, uint32_t bfuIdxConst) //no mono mode for atrac3 - : Container(container) - , Params(params) - , BfuIdxConst(bfuIdxConst) - { - NEnv::SetRoundFloat(); - } + TAtrac3BitStreamWriter(ICompressedOutput* container, const TContainerParams& params, uint32_t bfuIdxConst); - void WriteSoundUnit(const std::vector<TSingleChannelElement>& singleChannelElements); + void WriteSoundUnit(const std::vector<TSingleChannelElement>& singleChannelElements, float laudness); }; } // namespace NAtrac3 |