pub fn assert_perception_level(
reference: &ImgVec<RGB8>,
encoded: &ImgVec<RGB8>,
min_level: PerceptionLevel,
) -> Result<()>Expand description
Assert that quality is at the specified perception level or better.
This is a more semantic way to assert quality thresholds based on perceptual categories rather than raw metric values.
§Arguments
reference- Reference image (original)encoded- Encoded/decoded image to comparemin_level- Minimum acceptable perception level
§Returns
Ok(()) if quality is at the specified level or better.
§Errors
Returns an error if:
- Images have different dimensions
- Quality is below the specified perception level
- Metric calculation fails
§Example
ⓘ
use codec_eval::eval::helpers::assert_perception_level;
use codec_eval::metrics::PerceptionLevel;
// Assert quality is at least "Subtle" (DSSIM < 0.0015)
assert_perception_level(&reference, &encoded, PerceptionLevel::Subtle)?;
// Assert quality is "Imperceptible" (DSSIM < 0.0003)
assert_perception_level(&reference, &encoded, PerceptionLevel::Imperceptible)?;