@@ -132,6 +132,15 @@ namespace ipa {
* values in the range [0.0, 1.992] with a resolution of 1/128.
*/
+/**
+ * \typedef Q5_4
+ * \brief 5.4 signed fixed-point quantizer
+ *
+ * A Quantized type using 5 bit for the integer part and 4 bits for the
+ * fractional part, stored in an signed 16-bit integer (\c int16_t). Represents
+ * values in the range [-16.0, 15.9375] with a resolution of 1/16.
+ */
+
/**
* \typedef Q12_4
* \brief 12.4 signed fixed-point quantizer
@@ -103,6 +103,8 @@ struct FixedPointQTraits {
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 Q12_4 = Quantized<FixedPointQTraits<12, 4, int16_t>>;
using UQ12_4 = Quantized<FixedPointQTraits<12, 4, 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 */
+ /* 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);
+ fails += quantizedCheck<Q5_4>( 15.94f, 0b01111'1111, 15.9375f);
+
/* 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.4 format representing values in the range [-16.0, 15.9375] with a resolution of 1/16. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- This format is used by the RKISP1/i.MX8MP for Chromatic Abberation Correction handling src/ipa/libipa/fixedpoint.cpp | 9 +++++++++ src/ipa/libipa/fixedpoint.h | 2 ++ test/ipa/libipa/fixedpoint.cpp | 5 +++++ 3 files changed, 16 insertions(+)