#include #include #include #include #include #include #include // This function concatenates, potentially non-continuous frames together along track using a last-in-last-out paradigm. // output is the name of the file, // Width should be the number of bytes per line, not the number of samples. int frame_concatenate(char *output, int * pwidth, int * plast_line_num, int * pnumber_of_frames, char **input, int *start_line) { FILE * in; FILE * out; int lineAddr; char *inData,*outData; int width,last_line_num,number_of_frames; int i,j,k,number_of_lines,number_valid_lines,total_line_num; width= (*pwidth); last_line_num = (*plast_line_num); number_of_frames = (*pnumber_of_frames); // Create a memory map of the output file out = fopen(output,"w"); char * oneLine = (char *) malloc(width*sizeof(char)); // turned out that is better to use one line at the time instead of a bunch of them so we don not // interfere with the OS I/O buffering int cnt = 0; for(i=0;i