# Enable CPU intrinsics for AES-NI + SSSE3 on x86_64 targets only. # # The qbz-cmaf crate does AES-128-CTR decrypt on every offline-cached # audio frame. Without AES-NI the decrypt falls back to a software # implementation that hits ~10 MB/s on a modern CPU; with AES-NI it # clears 400+ MB/s. For HiRes (200 MB+ tracks) this is the difference # between a 20-second gap and a sub-second one. # # Two things needed on x86_64: # 1. `target-cpu=x86-64-v3` = Haswell microarchitecture baseline # (2013+). Every CPU QBZ realistically runs on supports it. This # gives AVX2, BMI2, etc. for general codegen. # 2. `target-feature=+aes,+ssse3` to explicitly enable the AES-NI # instruction set — which is NOT included in x86-64-v3 as a # microarch level. Without this flag the `aes` crate's hardware # dispatch never gets compiled in, no matter how capable the CPU. # # IMPORTANT: these flags MUST be scoped to x86_64 targets. Using # `[build] rustflags = ...` applies them to every target, which on # aarch64-apple-darwin (and any other ARM target) corrupts the CPU # feature inference inside the `ring` crate and fails the build with # `assertion failed: CAPS_STATIC == MIN_STATIC_FEATURES`. ARM targets # get their own AES/crypto extensions automatically via `aes` crate's # armv8 path — we don't need to force anything there. [target.'cfg(target_arch = "x86_64")'] rustflags = ["-C", "target-cpu=x86-64-v3", "-C", "target-feature=+aes,+ssse3"]