pub struct QualityComparison {
pub candidate_a: EncodeCandidate,
pub candidate_b: EncodeCandidate,
pub psnr_diff: f32,
pub ssim_diff: f32,
pub bitrate_diff_pct: f32,
}Expand description
Quality metrics comparison between two encode candidates.
Fields§
§candidate_a: EncodeCandidateFirst candidate.
candidate_b: EncodeCandidateSecond candidate.
psnr_diff: f32PSNR difference (A - B) in dB. Positive means A is better.
ssim_diff: f32SSIM difference (A - B). Positive means A is better.
bitrate_diff_pct: f32Bitrate difference as a percentage: (bitrate_a - bitrate_b) / bitrate_b * 100.
Implementations§
Source§impl QualityComparison
impl QualityComparison
Sourcepub fn new(
candidate_a: EncodeCandidate,
candidate_b: EncodeCandidate,
psnr_diff: f32,
ssim_diff: f32,
bitrate_diff_pct: f32,
) -> Self
pub fn new( candidate_a: EncodeCandidate, candidate_b: EncodeCandidate, psnr_diff: f32, ssim_diff: f32, bitrate_diff_pct: f32, ) -> Self
Creates a new QualityComparison.
Sourcepub fn winner_by_psnr(&self) -> &str
pub fn winner_by_psnr(&self) -> &str
Returns the name of the candidate with higher PSNR.
Returns "tie" if the difference is within 0.01 dB.
Sourcepub fn winner_by_efficiency(&self) -> &str
pub fn winner_by_efficiency(&self) -> &str
Returns the name of the candidate with the better quality/bitrate trade-off.
“Efficiency” is defined as PSNR gain relative to bitrate increase.
If A has higher PSNR but also higher bitrate, efficiency is
psnr_diff / bitrate_diff_pct. If the score is ≥ 0 A wins; otherwise B wins.
Returns "tie" if both PSNR and bitrate differences are negligible.
Trait Implementations§
Source§impl Clone for QualityComparison
impl Clone for QualityComparison
Source§fn clone(&self) -> QualityComparison
fn clone(&self) -> QualityComparison
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for QualityComparison
impl RefUnwindSafe for QualityComparison
impl Send for QualityComparison
impl Sync for QualityComparison
impl Unpin for QualityComparison
impl UnsafeUnpin for QualityComparison
impl UnwindSafe for QualityComparison
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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