@@ -148,6 +148,15 @@ namespace ipa {
* values in the range [-16.0, 15.9375] with a resolution of 1/16.
*/
+/**
+ * \typedef UQ5_8
+ * \brief 5.8 unsigned fixed-point quantizer
+ *
+ * A Quantized type using 5 bits for the integer part and 8 bits for the
+ * fractional part, stored in an unsigned 16-bit integer (\c uint16_t). Represents
+ * values in the range [0.0, 31.9961] with a resolution of 1/256.
+ */
+
/**
* \typedef Q12_4
* \brief 12.4 signed fixed-point quantizer
@@ -106,6 +106,7 @@ using Q1_7 = Quantized<FixedPointQTraits<1, 7, int8_t>>;
using UQ1_7 = Quantized<FixedPointQTraits<1, 7, uint8_t>>;
using Q5_4 = Quantized<FixedPointQTraits<5, 4, int16_t>>;
+using UQ5_8 = Quantized<FixedPointQTraits<5, 8, uint16_t>>;
using Q12_4 = Quantized<FixedPointQTraits<12, 4, int16_t>>;
using UQ12_4 = Quantized<FixedPointQTraits<12, 4, uint16_t>>;
@@ -195,6 +195,11 @@ protected:
fails += quantizedCheck<Q5_4>(-16.00f, 0b10000'0000, -16.00f);
fails += quantizedCheck<Q5_4>( 15.94f, 0b01111'1111, 15.9375f);
+ /* UQ5_8(0 .. 31.9961) Min: [0x0000:0] -- Max: [0x1fff:31.9961] Step:0.00390625 */
+ introduce<UQ5_8>("UQ5_8");
+ fails += quantizedCheck<UQ5_8>( 0.00f, 0b00000'00000000, 0.00f);
+ fails += quantizedCheck<UQ5_8>(32.00f, 0b11111'11111111, 31.9961f);
+
/* Q12.4(-2048 .. 2047.94) Min: [0x8000:-2048] -- Max: [0x7fff:2047.94] Step:0.0625 */
introduce<Q12_4>("Q12_4");
fails += quantizedCheck<Q12_4>(0.0f, 0b000000000000'0000, 0.0f);
Provide a FixedPoint Quantized type to support the Q5.8 format representing values in the range [0 .. 31.9961] with a resolution of 1/256. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- This type is used by the Mali-C55 Digital Gain component. src/ipa/libipa/fixedpoint.cpp | 9 +++++++++ src/ipa/libipa/fixedpoint.h | 1 + test/ipa/libipa/fixedpoint.cpp | 5 +++++ 3 files changed, 15 insertions(+)