bs_bcu_app/kit/kit_table.h

50 lines
983 B
C
Raw Normal View History

2024-11-07 17:24:19 +08:00
#ifndef _KIT_TABLE_H_
#define _KIT_TABLE_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "kit_macro.h"
typedef enum
{
kTabDataType_8Bit = 1,
kTabDataType_16Bit = 2,
kTabDataType_32Bit = 4,
}TabDataType;
typedef struct
{
uint8_t len;
TabDataType type;
uint8_t *tab;
}TabItem;
typedef struct
{
TabItem x;
TabItem y;
}TwoDTabItem;
typedef struct
{
TabItem x;
TabItem y;
TabItem z;
}ThreeDTabItem;
KitResult kit_table_search_index(TabItem* item, int32_t input_value, uint8_t* left_idx, uint8_t* right_idx);
KitResult kit_table_linear_search(TwoDTabItem* item, int32_t input_value, uint32_t factor, int32_t* output_value);
KitResult kit_table_bilinear_search(ThreeDTabItem* item, int32_t x_input, int32_t y_input, int32_t* z_output);
KitResult kit_table_bilinear_search_by_yz(ThreeDTabItem* item, int32_t y_input, int32_t z_input, uint32_t factor, int32_t* x_output);
#ifdef __cplusplus
}
#endif
#endif