20template<
typename Traits>
24 static_assert(std::is_arithmetic_v<QuantizedType>,
25 "Quantized: QuantizedType must be arithmetic");
36 : quantized_(x), value_(Traits::toFloat(x))
52 constexpr float value()
const {
return value_; }
57 return quantized_ == other.quantized_;
62 return !(*
this == other);
69 <<
":" << q.
value() <<
"]";
Top-level libcamera namespace.
Definition backtrace.h:17
Wrapper that stores a value in both quantized and floating-point form.
Definition quantized.h:21
friend std::ostream & operator<<(std::ostream &out, const Quantized< Traits > &q)
Insert a text representation of a Quantized into an output stream.
Definition quantized.h:65
constexpr float value() const
Retrieve the floating-point representation.
Definition quantized.h:52
constexpr QuantizedType quantized() const
Retrieve the quantized integer representation.
Definition quantized.h:53
Traits TraitsType
The traits policy type defining the quantization behaviour.
Definition quantized.h:22
constexpr bool operator==(const Quantized &other) const
Compare two Quantized objects for equality.
Definition quantized.h:55
constexpr Quantized(QuantizedType x)
Construct a Quantized value from an existing quantized integer.
Definition quantized.h:35
typename Traits::QuantizedType QuantizedType
The integer type used for the quantized representation.
Definition quantized.h:23
constexpr Quantized(float x)
Construct a Quantized value from a floating-point number.
Definition quantized.h:30
constexpr Quantized & operator=(QuantizedType x)
Assign a quantized integer value to the Quantized object.
Definition quantized.h:46
constexpr bool operator!=(const Quantized &other) const
Compare two Quantized objects for inequality.
Definition quantized.h:60
constexpr Quantized & operator=(float x)
Assign a floating-point value to the Quantized object.
Definition quantized.h:40
Miscellaneous utility functions.