前言
最近做sensor二供料的兼容,发现,两个料的sensor sample rate不一致,会影响到算法的滤波器效果,因此需要做一下resample,借鉴了一下高通的resample方式,此篇文章做一个简单的分析
一、高通resample方式
高通resample的实现函数是在resampler/src/sns_resampler_sensor_instance_island.c
中
static sns_rc
resampler_process_sample( resampler_instance_state *state,
resampler_sample * restrict input_sample,
resampler_sample * restrict output_sample, int32_t axis_cnt)
{
sns_rc rc = SNS_RC_SUCCESS;
//allocating the required space using uint64_t (so that the start address is aligned) and typecasting to resampler_sample
uint64_t t_sample[((ALIGN_8(sizeof(resampler_sample)) + axis_cnt*sizeof(float))/sizeof(uint64_t))+1];
resampler_sample* tmp_sample=(resampler_sample*)t_sample;
tmp_sample->axis_cnt_bytes=axis_cnt * sizeof(float);
tmp_sample->data=(float*)((ui