标签:data 指针数组 col color member sizeof mem repr value
int Rawdata_PreProcess(const void **in_frame, int n, int frame_size, void *out_frame) { const short **iframe = (const short **)in_frame; short *oframe = (short *)out_frame; int member = frame_size / sizeof(short); for (int m = 0; m < member; m++) { int sum = 0; for(int i = 0; i < n; i++) { short point = iframe[i][m]; printf("frame:%d, index:%d, value:%d\n", i, m, (int)point); sum += point; } oframe[m] = sum / n; } return 0; } short frame1[4] = {1, 4, 6, 7}; short frame2[4] = {3, 6, 2, 9}; short frame3[4] = {1, 5, 3, 4}; short out[4]; int main(void) { short *group[3] = {frame1, frame2, frame3}; Rawdata_PreProcess(group, 3, 8, out); printf("a:%d, b:%d, c:%d, d:%d\n", out[0], out[1], out[2], out[3]); }
标签:data 指针数组 col color member sizeof mem repr value
原文地址:https://www.cnblogs.com/hjj-fighting/p/10795542.html