libcamera v0.7.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
libcamera::ipa::Quantized< Traits > Struct Template Reference

Wrapper that stores a value in both quantized and floating-point form. More...

## Public Types
using | TraitsType = Traits
| The traits policy type defining the quantization behaviour.
using | QuantizedType = typename Traits::QuantizedType
| The integer type used for the quantized representation.

## Public Member Functions
constexpr | Quantized (float x)
| Construct a Quantized value from a floating-point number.
constexpr | Quantized (QuantizedType x)
| Construct a Quantized value from an existing quantized integer.
constexpr Quantized & | operator= (float x)
| Assign a floating-point value to the Quantized object.
constexpr Quantized & | operator= (QuantizedType x)
| Assign a quantized integer value to the Quantized object.
constexpr float | value () const
| Retrieve the floating-point representation.
constexpr QuantizedType | quantized () const
| Retrieve the quantized integer representation.
constexpr bool | operator== (const Quantized &other) const
| Compare two Quantized objects for equality.
constexpr bool | operator!= (const Quantized &other) const
| Compare two Quantized objects for inequality.

## Friends
std::ostream & | operator<< (std::ostream &out, const Quantized< Traits > &q)
| Insert a text representation of a Quantized into an output stream.

## Detailed Description

template<typename Traits>
struct libcamera::ipa::Quantized< Traits >

Wrapper that stores a value in both quantized and floating-point form.

Template Parameters

  Traits | The traits class defining the quantization behaviour

The Quantized struct template provides a thin wrapper around a quantized representation of a floating-point value. It uses a traits type Traits to define the conversion policy between the floating-point domain and the quantized integer domain.

Each Quantized instance maintains two synchronized members:

- the quantized integer representation, and
- the corresponding floating-point value.

The traits type defines:

- the integer storage type used for quantization,
- the static conversion functions `fromFloat()` and `toFloat()`, and
- optional metadata such as value ranges.

Quantized provides convenient constructors and assignment operators from either representation, as well as comparison and string formatting utilities.

## Member Typedef Documentation

## ◆ QuantizedType

template<typename Traits>

using libcamera::ipa::Quantized< Traits >::QuantizedType = typename Traits::QuantizedType

The integer type used for the quantized representation.

This alias corresponds to `TraitsType::QuantizedType`, as defined by the traits class.

## ◆ TraitsType

template<typename Traits>

using libcamera::ipa::Quantized< Traits >::TraitsType = Traits

The traits policy type defining the quantization behaviour.

Exposes the associated traits type used by this Quantized instance. This allows external code to refer to constants or metadata defined in the traits, such as `TraitsType::min` or `TraitsType::max`.

## Constructor & Destructor Documentation

## ◆ Quantized() [1/2]

template<typename Traits>

libcamera::ipa::Quantized< Traits >::Quantized | ( | float | x | ) |
| inline constexpr

Construct a Quantized value from a floating-point number.

Parameters

  [in] | x | The floating-point value to be quantized

Converts the floating-point input x to its quantized integer representation using the associated traits policy, and initializes both the quantized and floating-point members.

## ◆ Quantized() [2/2]

template<typename Traits>

libcamera::ipa::Quantized< Traits >::Quantized | ( | QuantizedType | x | ) |
| inline constexpr

Construct a Quantized value from an existing quantized integer.

Parameters

  [in] | x | The quantized integer value

Converts the quantized integer x to its corresponding floating-point value using the traits policy, and initializes both internal members.

## Member Function Documentation

## ◆ operator!=()

template<typename Traits>

bool libcamera::ipa::Quantized< Traits >::operator!= | ( | const Quantized< Traits > & | other | ) | const
| inline constexpr

Compare two Quantized objects for inequality.

Parameters

  [in] | other | The other Quantized object to compare against

Returns
  True if the quantized integer values differ

## ◆ operator=() [1/2]

template<typename Traits>

Quantized & libcamera::ipa::Quantized< Traits >::operator= | ( | float | x | ) |
| inline constexpr

Assign a floating-point value to the Quantized object.

Parameters

  [in] | x | The floating-point value to assign

Returns
  A reference to the updated Quantized object

Converts the floating-point value x to its quantized integer representation using the traits policy and updates both members.

## ◆ operator=() [2/2]

template<typename Traits>

Quantized & libcamera::ipa::Quantized< Traits >::operator= | ( | QuantizedType | x | ) |
| inline constexpr

Assign a quantized integer value to the Quantized object.

Parameters

  [in] | x | The quantized integer value to assign

Returns
  A reference to the updated Quantized object

Converts the quantized integer x to its corresponding floating-point value using the traits policy and updates both members.

## ◆ operator==()

template<typename Traits>

bool libcamera::ipa::Quantized< Traits >::operator== | ( | const Quantized< Traits > & | other | ) | const
| inline constexpr

Compare two Quantized objects for equality.

Parameters

  [in] | other | The other Quantized object to compare against

Returns
  True if both objects have the same quantized integer value

## ◆ quantized()

template<typename Traits>

QuantizedType libcamera::ipa::Quantized< Traits >::quantized | ( |  | ) | const
| inline constexpr

Retrieve the quantized integer representation.

Returns
  The quantized integer value

## ◆ value()

template<typename Traits>

float libcamera::ipa::Quantized< Traits >::value | ( |  | ) | const
| inline constexpr

Retrieve the floating-point representation.

Returns
  The floating-point value corresponding to the quantized value

## Friends And Related Symbol Documentation

## ◆ operator<<

template<typename Traits>

std::ostream & operator<< | ( | std::ostream & | out,
|  | const Quantized< Traits > & | q )
| friend

Insert a text representation of a Quantized into an output stream.

Parameters

  [in] | out | The output stream
  [in] | q | The Quantized

Returns
  The output stream out

The documentation for this struct was generated from the following files:

- src/ipa/libipa/quantized.h
- src/ipa/libipa/quantized.cpp