@@ -139,6 +139,15 @@ namespace ipa {
* values in the range [0.0, 1.992] with a resolution of 1/128.
*/
+/**
+ * \typedef UQ4_8
+ * \brief 4.8 unsigned fixed-point quantizer
+ *
+ * A Quantized type using 4 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, 15.9961] with a resolution of 1/256.
+ */
+
/**
* \typedef Q5_4
* \brief 5.4 signed fixed-point quantizer
@@ -105,6 +105,8 @@ struct FixedPointQTraits {
using Q1_7 = Quantized<FixedPointQTraits<1, 7, int8_t>>;
using UQ1_7 = Quantized<FixedPointQTraits<1, 7, uint8_t>>;
+using UQ4_8 = Quantized<FixedPointQTraits<4, 8, uint16_t>>;
+
using Q5_4 = Quantized<FixedPointQTraits<5, 4, int16_t>>;
using UQ5_8 = Quantized<FixedPointQTraits<5, 8, uint16_t>>;
@@ -190,6 +190,11 @@ protected:
fails += quantizedCheck<Q4_7>(-0.4f, 0b1111'1001101, -0.398438f); /* 0x7cd */
fails += quantizedCheck<Q4_7>(-1.4f, 0b1110'1001101, -1.39844f); /* 0x74d */
+ /* UQ4_8(0 .. 15.9961) Min: [0x0000:0] -- Max: [0x0fff:15.9961] Step:0.00390625 */
+ introduce<UQ4_8>("UQ4_8");
+ fails += quantizedCheck<UQ4_8>( 0.0f, 0b0000'00000000, 0.00f);
+ fails += quantizedCheck<UQ4_8>(16.0f, 0b1111'11111111, 15.9961f);
+
/* Q5_4(-16 .. 15.9375) Min: [0x0100:-16] -- Max: [0x00ff:15.9375] Step:0.0625 */
introduce<Q5_4>("Q5_4");
fails += quantizedCheck<Q5_4>(-16.00f, 0b10000'0000, -16.00f);
Provide a FixedPoint Quantized type to support the Q4.8 format representing values in the range [0 .. 15.9961] with a resolution of 1/256. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- This type is used by the Mali-C55 AWB Gains src/ipa/libipa/fixedpoint.cpp | 9 +++++++++ src/ipa/libipa/fixedpoint.h | 2 ++ test/ipa/libipa/fixedpoint.cpp | 5 +++++ 3 files changed, 16 insertions(+)