summaryrefslogtreecommitdiffstats
path: root/src/atrac3denc.cpp
diff options
context:
space:
mode:
authorDaniil Cherednik <[email protected]>2026-06-25 23:48:15 +0200
committerDaniil Cherednik <[email protected]>2026-06-25 23:48:15 +0200
commitbd270db9f2efca6d71959f1e60bc4f3a6867a03a (patch)
treecb95db5a729a9438e5b6a71d30cf7b3bd6cf5bbb /src/atrac3denc.cpp
parent01234b09a2fb3e7fc6746ace7554383b0caa97e1 (diff)
Add BFU encode cache and use it in ATRAC3 bit allocationatrac3_enc_cache
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.
Diffstat (limited to 'src/atrac3denc.cpp')
0 files changed, 0 insertions, 0 deletions