Expand description
Typed still-image quality results over colour-described zenpixels views.
Metric::Output preserves native structured assessments. Evaluation
exposes named scalars; PrepareReference optionally reuses reference work.
Diagnostic arrays remain native data, explicitly requested in EvalOpts;
borrowed MapViews expose common native placement and semantics.
NoReferenceMetric provides the corresponding one-image contract.
Erased composes with typed wrappers and supports heterogeneous metric
collections. Persistence, map processing, scheduling and video composition
belong to consumers. Worker adapters supply any required
Send/Sync bounds; the core imposes none.
Re-exports§
pub use how_far;pub use whereat;pub use zenpixels;
Macros§
- implementation
- The calling crate’s
Implementationatscore_revision, CPU backend, with the build id from theZENMETRICS_BUILD_IDenvironment variable when it was set at compile time.
Structs§
- Erased
- Stackable wrapper normalizing only the result type. It forwards identity, actual pixel views and operation controls. Typed callers keep their native result by omitting this wrapper. No Send/Sync bounds are added.
- Erased
Evaluation - An owned native assessment with common borrowed score access. The native result is moved into a box; scalar descriptors and diagnostic arrays are not copied. Score iteration uses a short-lived erased iterator allocation.
- Eval
Opts - Operation-local controls. Diagnostic arrays are off by default.
- Evaluation
Ref - A temporary assessment borrowed during a lending comparison. The view cannot outlive the callback or retain metric scratch. Native typed results remain available from the ordinary owned scoring interface.
- Implementation
- Which code computed a score. Build it with
crate::implementation!so the crate name and version come from Cargo, not from hand-typed strings. - MapGrid
- Placement of a regular native map grid in input-pixel coordinates. Cells may cover only a cropped interior or extend beyond the image.
- MapView
- A borrowed native numeric map, including reduced grids and strided rows. The assessment owns its storage and descriptors. Undefined native samples (including NaN) are preserved; scalar validity rules do not apply to samples.
- Metric
Error - The error every generic-surface call returns, inside
At<…>. - Metric
Id - Full identity of one configured metric instance. See the crate documentation.
- Paired
Evaluation - Both original native assessments, sharing cached reference work without cloning native arrays. The common view exposes candidate scores/maps first.
- Paired
NoReference - Explicitly run a one-image metric on both inputs. Candidate outputs keep
their keys; reference outputs append
_ref. Only candidate maps are requested. Preparation caches the actual reference assessment once. - Paired
Reference - Actual cached reference result and exclusive borrow of a one-image scorer.
Construct through
crate::prepare_referenceonPairedNoReference. - Prepared
Planar Reference - Checked owned planar work, binding image geometry, per-plane extent and subsampling phase, plane interpretation, and color/luminance to preparation. Strides and phase-equivalent crop origins may differ for every candidate.
- Prepared
Reference - Checked prepared work with retained geometry and no per-call identity copies.
- Score
- Unmodified scalar with borrowed semantics.
- Score
Spec - Native output semantics, shared by scalars and maps. No universal range or normalization is imposed.
Enums§
- Backend
- Where a metric’s arithmetic runs.
- Direction
- Quality ordering; diagnostic features need not have one.
- Error
Kind - Coarse, metric-agnostic classification of a failure. Fixed when the error is created, so routing (retry, skip cell, alert) never parses messages.
- MapRequest
- Explicit native diagnostic request. A named request requires a common map with this exact key; absence is an error, never successful empty output.
Traits§
- DynPrepare
Planar Reference - Object-safe owned planar preparation for heterogeneous metric collections. The returned object retains checked geometry and interpretation. Native prepared state can still lend its map without boxing an assessment.
- DynPrepare
Reference - Object-safe optional preparation. Only metrics with native prepared work implement this extension; a cold metric is not given a replay fallback.
- Evaluation
- Common access to a concrete assessment. Additional native fields remain accessible on its concrete type. Iteration need not allocate. A successful assessment has at least one uniquely named score, in stable output order.
- Metric
- Configured full-reference metric over actual strided, colour-described inputs. Reject unsupported precision, alpha and HDR interpretation explicitly.
- NoReference
Metric - A configured one-image quality metric. Uses the same native assessments, optional maps and operation controls as full-reference scoring.
- Planar
Metric - Optional native planar input. The packed
Metriccontract stays usable independently; no implicit conversion or packed replay is supplied. - Planar
Warm Reference - Prepared native planar scoring. Implementors may override lending to let consumers inspect native scratch before it is recycled, avoiding map export. Workers must join before return. After failure, reuse must succeed correctly or refuse explicitly; stale assessments must never be returned.
- Prepare
Planar Reference - Reusable native planar work owned independently of its factory scorer. The preparation input and its Pulse are not retained. Configuration borrows already held by the factory may be carried in the concrete prepared type.
- Prepare
Reference - Optional actual reference precomputation, never implicit cold replay.
- Result
Metric Ext - Convert a metric crate’s own
Resultinto aMetricResult, locating the error at the caller. - Warm
Reference - Native prepared work. Errors leave it reusable or make later calls refuse; never return stale results after failure.
Functions§
- fail
- Locate a new error at the caller.
- find_
metric_ error - Recover the
MetricErrorfrom any error chain — after erasure toBox<dyn Error>or wrapping by a consumer. Looks forAt<MetricError>,MetricErrorand oneBoxlayer at every level ofsource(). - is_
stopped - The how-far classifier: pass
is_stoppedtoStages::run_classifiedand friends so a stopped metric recordsOutcome::Stopped, not a failure. - prepare_
planar_ reference - Prepare owned planar work, binding candidate interpretation and geometry.
- prepare_
reference - Prepare native reference work with admission and an owned child phase.
- score
- Admit image geometry and validate scores, preserving typed native results and located failures. Native errors take precedence over a later stop.
- score_
image - Admit one image and validate its complete native no-reference assessment.
- score_
planar - Checked native planar pair scoring. Color/encoding support is decided by the metric, which must refuse unsupported interpretation explicitly.
- stop_
reason - The stop reason of a located error, if it is a stop (orphan rules keep
AsStopReasonoffAt<MetricError>itself).
Type Aliases§
- DynMetric
- A heterogeneous metric object with a common structured result. The lifetime
permits a scorer to borrow configuration; only its owned result must be
static for native downcasting. Use
crate::scorefor checked evaluation. - DynNo
Reference Metric - A heterogeneous one-image metric object. Scorer configuration may be borrowed; the erased owned native assessment must be static for downcasting.
- Metric
Result Result<T, At<MetricError>>— the return type of every fallible generic-surface call.