// 秒寻科技
// 循环队列读写模块
// zt
// 2023-02-27

#ifndef __LOOPLIST_H__
#define __LOOPLIST_H__

#include "../sysdefine/sysdef.h"

// 外部使用接口
uint32 util_cal_list_len(uint32 dwGenerateIndex, uint32 dwConsumeIndex, uint32 dwDataListTotalLen);

// 生产队列
void util_looplist_insert_int16(void *pvDataList, uint32 dwGenerateIndex, uint32 dwDataListTotalLen, void *pvInsertDataList, uint32 dwInsertDataLen, uint32 *pdwGeneratedIndex);
void util_looplist_insert_int32(void *pvDataList, uint32 dwGenerateIndex, uint32 dwDataListTotalLen, void *pvInsertDataList, uint32 dwInsertDataLen, uint32 *pdwGeneratedIndex);
void util_looplist_insert_flt32(flt32 *pfDataList, uint32 dwGenerateIndex, uint32 dwDataListTotalLen, flt32 *pfInsertDataList, uint32 dwInsertDataLen, uint32 *pdwGeneratedIndex);

// 消费队列
void util_looplist_get_int16(void *pvDataList, uint32 dwDataListTotalLen, uint32 dwConsumeIndex, void *pvGetDataList, uint32 dwGetLen, uint32 *pdwConsumedIndex);
void util_looplist_get_int32(void *pvDataList, uint32 dwDataListTotalLen, uint32 dwConsumeIndex, void *pvGetDataList, uint32 dwGetLen, uint32 *pdwConsumedIndex);
void util_looplist_get_flt32(flt32 *pfDataList, uint32 dwDataListTotalLen, uint32 dwConsumeIndex, flt32 *pfGetDataList, uint32 dwGetLen, uint32 *pdwConsumedIndex);

// 调整队列索引
uint32 util_looplist_adjust_index(uint32 dwIndex, uint32 dwListTotalLen, int32 dwOffset);

// 查找最大值
int32 util_looplist_find_max_value_int32(int32 *pdwDataList, uint16 wLen);
flt32 util_looplist_find_max_value_flt32(flt32 *pfDataList, uint16 wLen);

// 查找最大值索引
int16 util_looplist_find_max_value_index_int32(int32 *pdwDataList, uint16 wLen);
int16 util_looplist_find_max_value_index_flt32(flt32 *pfDataList, uint16 wLen);

// 均值滤波
void util_looplist_mean_filter_flt32(flt32 *pfInputDataList, flt32 *pfOutputDataList, uint16 wListLen, uint16 wMeanPointNum);

#endif