summaryrefslogtreecommitdiffstats
path: root/src/atrac/atrac_enc_cache.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add BFU encode cache and use it in ATRAC3 bit allocationDaniil Cherednik3 days1-0/+51
Introduce a generic TEncCache/TUnit library (src/atrac/atrac_enc_cache.*) that memoizes per-unit quantization results keyed by a user-supplied function. Units are owned via unique_ptr in a flat vector pre-sized to a known key bound; the codec supplies both the unit factory (which also performs the computation, avoiding an extra virtual call on the hot path) and the key packing. Wire it into the ATRAC3 allocator: during the lambda binary search the same (bfu, wordlen) block is quantized repeatedly. TAt3SpecUnit now caches the mantissas plus the CLC/VLC spectrum costs and energy error, so each (bfu, wordlen) is computed once per channel. The cache is reset in TAlloc::Dump (once per channel) so no stale spectrum is reused. Output is bit-exact with the previous encoder; ~36% faster encode.