Engineering Category: Fixed-Point Audio, Speech & DSP
Best Use in Production: Integer-only digital signal filtering, harmonic resonator stepping, and prosody envelope generation with zero IEEE-754 drift.
When to Select This Capsule: Sole canonical implementation for its 64-vector functional equivalence class. Low-latency L1-resident kernel (2304431/200000 cyc/op); well-suited for high-frequency pipeline stages.
Snap-Circuit Wiring Role: Slice Ingress / Scanner Stage `(&[u8])->usize` — digests raw byte buffers into scalar tokens or checksums.
.text: 96 B (30 x86_64 insns)476 B)pub fn determine_opus_frame_samples(packet: &[u8]) -> usize {
if packet.is_empty() {
return 960;
}
let toc = packet[0];
let config = toc >> 3;
let frame_duration_ms = match config {
0..=3 => 10,
4..=7 => 20,
8..=11 => 40,
12..=13 => 60,
14..=15 => 10,
16..=19 => 20,
20..=23 => 40,
24..=27 => 60,
28..=31 => 10,
_ => 20,
};
(frame_duration_ms * 48000) / 1000
}
rustc -C opt-level=3 x86_64 Disassembly (96 B .text / 30 insns)determine_opus_frame_samples:
mov eax, 960
test rsi, rsi
je .LBB7_10
movzx ecx, byte ptr [rdi]
cmp cl, 32
jae .LBB7_3
mov eax, 480
ret
.LBB7_3:
cmp cl, 64
jb .LBB7_10
mov eax, 1920
cmp cl, 96
jb .LBB7_10
mov eax, 2880
cmp cl, 112
jb .LBB7_10
mov eax, 480
test cl, cl
jns .LBB7_10
mov eax, 960
cmp cl, -96
jb .LBB7_10
mov eax, 1920
cmp cl, -64
jb .LBB7_10
cmp cl, -32
mov ecx, 2880
mov eax, 480
cmovb rax, rcx
.LBB7_10:
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #1344 | determine_opus_frame_samples (THIS CAPSULE) domain: liquid-rust-x86_64 | id: 2deaaa6ec61c646fe12d851eb725a60c | 2304431/200000 cyc/op | 2195113/400000 ns/op | 400000000/2195113 ops/us | 96 B .text (30 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |