pub struct TranscodeBenchmark { /* private fields */ }Expand description
Utility for benchmarking and comparing multiple codec configurations.
TranscodeBenchmark accumulates BenchmarkResults and provides sorting /
reporting helpers. The actual encoding is driven by the caller; this type
manages the result lifecycle and report generation.
Implementations§
Source§impl TranscodeBenchmark
impl TranscodeBenchmark
Sourcepub fn new(content_duration_secs: f64) -> Self
pub fn new(content_duration_secs: f64) -> Self
Creates a new benchmark for content with the given duration.
Sourcepub fn start_timing(&self) -> BenchmarkTimer
pub fn start_timing(&self) -> BenchmarkTimer
Starts timing for a candidate. Returns a BenchmarkTimer that records
the elapsed time when dropped or when BenchmarkTimer::finish is called.
Sourcepub fn record_result(&mut self, result: BenchmarkResult)
pub fn record_result(&mut self, result: BenchmarkResult)
Records a result from an already-completed encode.
Sourcepub fn record(
&mut self,
candidate: BenchmarkCandidate,
elapsed: Duration,
file_size_bytes: u64,
psnr: Option<f64>,
ssim: Option<f64>,
)
pub fn record( &mut self, candidate: BenchmarkCandidate, elapsed: Duration, file_size_bytes: u64, psnr: Option<f64>, ssim: Option<f64>, )
Convenience: build a BenchmarkResult from timing and file-size data and
record it.
Sourcepub fn result_count(&self) -> usize
pub fn result_count(&self) -> usize
Returns the number of recorded results.
Sourcepub fn by_speed(&self) -> Vec<&BenchmarkResult>
pub fn by_speed(&self) -> Vec<&BenchmarkResult>
Returns results sorted by encoding speed (fastest first).
Sourcepub fn by_file_size(&self) -> Vec<&BenchmarkResult>
pub fn by_file_size(&self) -> Vec<&BenchmarkResult>
Returns results sorted by file size (smallest first).
Sourcepub fn by_psnr(&self) -> Vec<&BenchmarkResult>
pub fn by_psnr(&self) -> Vec<&BenchmarkResult>
Returns results sorted by PSNR (highest first).
Results without PSNR data are sorted to the end.
Sourcepub fn by_composite_score(&self) -> Vec<&BenchmarkResult>
pub fn by_composite_score(&self) -> Vec<&BenchmarkResult>
Returns results sorted by composite score (best first).
Sourcepub fn best(&self) -> Option<&BenchmarkResult>
pub fn best(&self) -> Option<&BenchmarkResult>
Returns the result with the best composite score, if any.
Sourcepub fn report(&self) -> Result<String>
pub fn report(&self) -> Result<String>
Generates a human-readable Markdown report table.
§Errors
Returns an error if there are no results to report.
Sourcepub fn results(&self) -> &[BenchmarkResult]
pub fn results(&self) -> &[BenchmarkResult]
Returns all raw results.
Auto Trait Implementations§
impl Freeze for TranscodeBenchmark
impl RefUnwindSafe for TranscodeBenchmark
impl Send for TranscodeBenchmark
impl Sync for TranscodeBenchmark
impl Unpin for TranscodeBenchmark
impl UnsafeUnpin for TranscodeBenchmark
impl UnwindSafe for TranscodeBenchmark
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more