From: Alex G. <mr....@gm...> - 2012-12-14 22:55:38
|
I'm trying to figure out how analog data coming from a device with more than one probe should be arranged. I wasn't able to find any documentation on this. Since this isn't written in stone (yet!) I want to bring up for some chatter. I can imagine two way to organize the data: i) Interleaved (P1[0],P2[0],P3[0],P1[1],P2[1],P3[1], etc) --- Array of structures like ii) Sequential (P1[0],P1[1],P1[2],...,P2[0],P2[1], etc) --- Structure of arrays like Hantek-DSO seems to use the interleaved approach. I think that from a technical point of view, working with a sequential arrangement is easier. Why? Memory access is much more linear. It's very easy to get data out of the array source = &analog->data[probe_num * num_samples]; memcpy ( probe_data, source, num_samples*sizeof(float) ); Whereas with the interleaved arrangement it takes a more complicated double for loop. either the read is linear, or the writes are linear, but not both. Personally, I think the advantages of method (ii) are worth a second look. I'd like to know what your thoughts are. Alex |