Files
external_libcamera/test/ipa/libipa/interpolator.cpp
Stefan Klug ee1d93d8aa ipa: libipa: interpolator: Drop key quantization
The quantization of the interpolation key was only used by the LSC
algorithm. There it lead to difficult to read code was removed. As there
is no remaining user of it, drop it from the Interpolator class.

While at it, cleanup the includes.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-01-28 17:10:01 +01:00

48 lines
1.0 KiB
C++

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2024, Ideas on Board Oy
*
* Interpolator tests
*/
#include "../src/ipa/libipa/interpolator.h"
#include <cmath>
#include <iostream>
#include <map>
#include <stdint.h>
#include <stdio.h>
#include "test.h"
using namespace std;
using namespace libcamera;
using namespace ipa;
#define ASSERT_EQ(a, b) \
if ((a) != (b)) { \
printf(#a " != " #b "\n"); \
return TestFail; \
}
class InterpolatorTest : public Test
{
protected:
int run()
{
Interpolator<int> interpolator;
interpolator.setData({ { 10, 100 }, { 20, 200 }, { 30, 300 } });
ASSERT_EQ(interpolator.getInterpolated(0), 100);
ASSERT_EQ(interpolator.getInterpolated(10), 100);
ASSERT_EQ(interpolator.getInterpolated(20), 200);
ASSERT_EQ(interpolator.getInterpolated(25), 250);
ASSERT_EQ(interpolator.getInterpolated(30), 300);
ASSERT_EQ(interpolator.getInterpolated(40), 300);
return TestPass;
}
};
TEST_REGISTER(InterpolatorTest)