Skip to content

Commit

Permalink
[PTZ] Simplify fitness distances for PTZ constrainable properties
Browse files Browse the repository at this point in the history
This changes pan, tilt and zoom constrainable properties so that for
each them there is a single constrainable property which can be
constrained either with a boolean constraint (resulting in a fitness
distance of 0 or 1) or with a numeric constraint (resulting in a fitness
distance from 0.0 to 1.0).

Spec:
w3c/mediacapture-image#271
w3c/mediacapture-main#766

Change-Id: Iebb0a4f42c518286cefa6b39b2a42f6dbcd30521
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2814545
Commit-Queue: Guido Urdaneta <[email protected]>
Auto-Submit: Eero Häkkinen <[email protected]>
Reviewed-by: Guido Urdaneta <[email protected]>
Cr-Commit-Position: refs/heads/master@{#872352}
  • Loading branch information
eehakkin authored and Chromium LUCI CQ committed Apr 14, 2021
1 parent bb205e3 commit b6a7545
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ double NumericValueFitness(const NumericConstraint& constraint,

// Returns the fitness distance between the ideal value of |constraint| and the
// closest value to it in the range [min, max] if the constraint is supported.
// If the constraint is present but not supported, returns 1 if there is no
// ideal value (to account the failed boolean capability constraint) or 2
// otherwise (to account the failed boolean capability constraint and failed
// numeric ideal value constraint).
// If the constraint is present but not supported, returns 1.
// If the ideal value is contained in the range, returns 0.
// If there is no ideal value, returns 0;
// Based on https://w3c.github.io/mediacapture-main/#dfn-fitness-distance.
Expand All @@ -81,7 +78,7 @@ double NumericRangeSupportFitness(
DCHECK(!range.IsEmpty());

if (constraint_present && !constraint_supported)
return 1.0 + (constraint.HasIdeal() ? 1.0 : 0.0);
return 1.0;

if (!constraint.HasIdeal())
return 0.0;
Expand Down

0 comments on commit b6a7545

Please sign in to comment.