Best Use & Engineering Application Guide

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.

Hardware _rdtsc: 2304431/200000 cycles/op
Latency: 2195113/400000 ns/op
Throughput: 400000000/2195113 ops/us
Compiled ELF64 .text: 96 B (30 x86_64 insns)
C64 64KB RAM Budget: 119/16384 (476 B source)
Ternary Vote: + (score 1) | Salience: 159391/1872
Pure-Rust Capsule Source Code (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

Head-to-Head Functional Equivalence Class Peers (1 Implementation(s) Matching 64 Test Vectors)

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#1344determine_opus_frame_samples (THIS CAPSULE)
domain: liquid-rust-x86_64 | id: 2deaaa6ec61c646fe12d851eb725a60c
2304431/200000 cyc/op2195113/400000 ns/op400000000/2195113 ops/us96 B .text (30 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz