00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <stdlib.h>
00024 #include <stdio.h>
00025 #include <time.h>
00026 #include <ctype.h>
00027 #include <math.h>
00028 #include <errno.h>
00029 #include <unistd.h>
00030 #include <string.h>
00031 #include <sys/types.h>
00032 #include <sys/stat.h>
00033 #include <assert.h>
00034 #include <fcntl.h>
00035 #include <dirent.h>
00036
00037 #include "common.h"
00038
00042
00043 unsigned char ProcessOffsetFrame(const unsigned char *frame)
00044 {
00045 int triplet,i;
00046 PrintDebug("offset frame !!!\n");
00047 if (doOffset==0)
00048 {
00049 return(0);
00050 }
00051
00052 if (frame[10]&(1<<4))
00053 {
00054 PrintError("OFFSET FRAMES FOR 1-CHANNEL DATA ARE NOT "
00055 "SUPPORTED (file: %s) "
00056 "contact Agecodagis if this is really an "
00057 "offset frame for 1-channel data\n",
00058 currentFile);
00059 return(0);
00060 }
00061
00062
00063 triplet=(frame[9]&0xf0)>>4;
00064
00065 if ((triplet<0)||(triplet>3))
00066 {
00067 PrintError("corrupted offset frame, skipping\n");
00068 return(0);
00069 }
00070
00071
00072
00073
00074 if (frame[10]&(1<<5))
00075 {
00076 for (i=0; i<3; i++)
00077 {
00078 HWConfig.absOffset[i]=HWConfig.absOffset[i+6]=frame2i24(frame,i*3);
00079 }
00080 PrintDebug("Aoffset (ch%d): %d %d %d\n", triplet,
00081 frame2i24(frame,0),
00082 frame2i24(frame,3),
00083 frame2i24(frame,6));
00084 }
00085 else
00086 {
00087 for (i=0; i<3; i++)
00088 {
00089 HWConfig.relOffset[i]=HWConfig.relOffset[i+6]=frame2i24(frame,i*3);
00090 }
00091 PrintDebug("Roffset (ch%d): %d %d %d\n", triplet,
00092 frame2i24(frame,0),
00093 frame2i24(frame,3),
00094 frame2i24(frame,6));
00095 }
00096 return(0);
00097 }