Skip to main content

Codec

Trait Codec 

Source
pub trait Codec {
    // Required methods
    fn name(&self) -> &str;
    fn declared_lossless(&self) -> bool;
    fn encode(&self, signal: &[Vec<i64>], fs: f64) -> Vec<u8> ;
    fn decode(&self, blob: &[u8]) -> Vec<Vec<i64>>;
}
Expand description

The codec-agnostic interface every benchmarked codec implements.

signal is one Vec<i64> of samples per channel; fs is the sample rate in Hz (metadata the codec may use or ignore). encode returns an opaque blob and decode reconstructs the per-channel samples.

A codec that advertises declared_lossless == true is claiming bit-exact reconstruction; the harness verifies that claim against the L-tier gate. The claim is what is graded — it is not assumed true.

Required Methods§

Source

fn name(&self) -> &str

Short, stable identifier used in reports (e.g. "store").

Source

fn declared_lossless(&self) -> bool

Whether the codec claims bit-exact reconstruction.

Source

fn encode(&self, signal: &[Vec<i64>], fs: f64) -> Vec<u8>

Compress a per-channel integer signal into an opaque blob.

Source

fn decode(&self, blob: &[u8]) -> Vec<Vec<i64>>

Reconstruct the per-channel integer signal from a blob.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§