2012-09-20 98 views
1

我有一个一般的工作函数,我将使用GNU Radio的历史记录功能。在块的构造函数中,我打电话set_history(m)。我投的输入缓冲区以标准方式:GNU Radio历史记录

const float *in = (const float *) input_items[0]; 

我的问题是wheere in[0]是指在缓冲区中。对我来说,noutput_items新的项要消耗的块的数量,ninput_items[0]是指缓冲区中的数据总数。因此,in[noutput_items-1]是数组的最后一个元素,in[0]项的开始,而in[-m]是指历史块的开始。因此,ninput_items[0]大于或等于m + noutput_items

我不知道这个假设是否属实,如果有人知道这是如何工作,会很高兴。 GNU Radio API在这方面有些模糊。提前致谢!

回答

1

Tom Rondeau在GNU Radio wiki的帮助下回答了这个问题。 in[0]指的是历史的开始。为了使in[0]指的数据的开始,申报in这样:

const float *in = (const float *) &((const float*)input_items[0])[history()-1]; 
0

只是为了@克里斯的完整性,set_history()项目数量,就像noutput_itmes参数。

in[0]指的是历史的第一项。为了跳过历史,得到的第一个新项目,这是正确的方法:

const <TYPE> *in = (const <TYPE> *) &((const <TYPE>*)input_items[0])[(history()-1) * VEC_SIZE];

VEC_SIZE是指在输入签名指定类型的样本数量。

因此,例如,如果一个块的输入签名是

io_signature::make(1, 1, vec_len * sizeof(float))

每个项目是从vec_len浮点数构成。历史可以正确跳过:

const float *in_new = (const float *) &((const float*)input_items[0])[(history()-1) * vec_len];