Skip to main content

Crate zenpsy_api

Crate zenpsy_api 

Source
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 Implementation at score_revision, CPU backend, with the build id from the ZENMETRICS_BUILD_ID environment 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.
ErasedEvaluation
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.
EvalOpts
Operation-local controls. Diagnostic arrays are off by default.
EvaluationRef
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.
MetricError
The error every generic-surface call returns, inside At<…>.
MetricId
Full identity of one configured metric instance. See the crate documentation.
PairedEvaluation
Both original native assessments, sharing cached reference work without cloning native arrays. The common view exposes candidate scores/maps first.
PairedNoReference
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.
PairedReference
Actual cached reference result and exclusive borrow of a one-image scorer. Construct through crate::prepare_reference on PairedNoReference.
PreparedPlanarReference
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.
PreparedReference
Checked prepared work with retained geometry and no per-call identity copies.
Score
Unmodified scalar with borrowed semantics.
ScoreSpec
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.
ErrorKind
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§

DynPreparePlanarReference
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.
DynPrepareReference
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.
NoReferenceMetric
A configured one-image quality metric. Uses the same native assessments, optional maps and operation controls as full-reference scoring.
PlanarMetric
Optional native planar input. The packed Metric contract stays usable independently; no implicit conversion or packed replay is supplied.
PlanarWarmReference
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.
PreparePlanarReference
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.
PrepareReference
Optional actual reference precomputation, never implicit cold replay.
ResultMetricExt
Convert a metric crate’s own Result into a MetricResult, locating the error at the caller.
WarmReference
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 MetricError from any error chain — after erasure to Box<dyn Error> or wrapping by a consumer. Looks for At<MetricError>, MetricError and one Box layer at every level of source().
is_stopped
The how-far classifier: pass is_stopped to Stages::run_classified and friends so a stopped metric records Outcome::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 AsStopReason off At<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::score for checked evaluation.
DynNoReferenceMetric
A heterogeneous one-image metric object. Scorer configuration may be borrowed; the erased owned native assessment must be static for downcasting.
MetricResult
Result<T, At<MetricError>> — the return type of every fallible generic-surface call.