|
ocssw
1.0
|
00001 /* 00002 00003 $Header: /app/shared/RCS/irix-5.2/seawifsd/src/hdfio/Shared.V4.4/L012_Util/util/data/fillframe.h,v 4.13 1995/08/03 20:49:00 seawifsd Exp seawifsd $ 00004 $Log: fillframe.h,v $ 00005 Revision 4.13 1995/08/03 20:49:00 seawifsd 00006 added support to handle duplicate frames. 00007 00008 Revision 4.12 1995/05/04 15:39:57 seawifsd 00009 added FFM_MSEC_MOD and MSEC_OFFSET macros to find out what's the errors 00010 in msec field of each minorframe. 00011 00012 Revision 4.11 1995/04/28 15:54:27 seawifsd 00013 modifications were due to the change in minorframe numbering scheme for GAC. 00014 00015 Revision 4.10 1995/01/17 19:57:57 seawifsd 00016 Jan. 17, 1994, V4.10 00017 00018 Revision 4.1 1995/01/17 14:14:16 seawifsd 00019 Jan. 9, 1994, 4.0 00020 00021 Revision 3.18 1994/12/06 19:14:46 seawifsd 00022 fixed macro definition of XMEMCPY(dst,src) so that it will get the right 00023 size to copy from src to dst. 00024 00025 Revision 3.17 1994/11/30 18:17:49 seawifsd 00026 added yet another filltype FILL_TYPE_LAST_DATA. 00027 defined XCALLOC(). 00028 00029 Revision 3.16 1994/11/28 18:54:16 seawifsd 00030 added one extra filltype FILL_TYPE_LAST and fixed all related statements. 00031 00032 Revision 3.15 1994/11/18 21:18:51 seawifsd 00033 defined XMALLOC(x) and XMEMCPY(dst,src). 00034 renamed fill_info structure elements names. 00035 00036 Revision 3.14 1994/11/18 15:34:37 seawifsd 00037 defined macro FFM2SCAN(ffm,dtype) to convert number of minor frame to 00038 equivalent number of scan lines. 00039 00040 Revision 3.13 1994/11/18 14:11:36 seawifsd 00041 modified definition of FILL_TYPE_STATUS() because the additional element 00042 FILL_TYPE_ERR. 00043 added macros for NOREWIND and REWIND for use in ffm_preview(). 00044 added macros for additional status reports even when the status is in 00045 normal condition. 00046 added several equivalent macros lik SCENE_TAB, FRAME_TAB, ... 00047 added frame_sync_status and time_sync_status to fill_info structure. 00048 00049 Revision 3.12 1994/11/16 16:33:16 seawifsd 00050 added 'scene_no_off' and 'rec_no_off' in fill_info structure. 00051 added 'navindex' and 'rec_no' in ffm_info structure. 00052 00053 Revision 3.11 1994/11/16 15:44:08 seawifsd 00054 fixed a bug in macro definition of ADD_FRAME(prev,add). 00055 defined strings for different FILL_BAND_*. 00056 defined strings for different type of fill. 00057 added FILL_TAB, SET_FILL_TAB,... for fill type related messaging. 00058 00059 Revision 3.10 1994/11/15 22:07:48 seawifsd 00060 moved macros that are related to different printout message tab from 00061 l01.c to this file. Macros involved are SET_SCNE_TAB(tab), SET_FRAME_TAB(tab) 00062 SET_TIME_TAB(tab), SCENE_TAB(), FRAME_TAB(), and TIME_TAB(). 00063 00064 Revision 3.9 1994/11/15 18:30:13 seawifsd 00065 added macro definitions to return character strings that describe the 00066 meaning of each time/frame sync status. 00067 00068 Revision 3.8 1994/11/15 16:41:00 seawifsd 00069 defined different FRAME/TIME sync status code. 00070 00071 Revision 3.7 1994/11/15 16:36:19 seawifsd 00072 added macro CALC_FRAME_DISTANCE(prev,next). 00073 00074 Revision 3.6 1994/11/14 20:50:31 seawifsd 00075 defined macros for different type of fill operations. 00076 modified definition of fill_infoType to include 'fill_type' a pointer to 00077 the next fill_infoType. 00078 00079 Revision 3.5 1994/11/14 20:30:33 seawifsd 00080 defined ffm_infoType structure. 00081 defined fill_infoType structure. 00082 defined macro READ_AHEAD_BUFFER for the size of read-ahead-buffer. 00083 defined macro constants FILL_BAND_* used in s_flags[1] field of L1A file. 00084 00085 Revision 3.4 1994/11/08 19:54:26 seawifsd 00086 added definition of SCAN_MSEC_INC(dtype). 00087 00088 Revision 3.3 1994/11/08 18:46:22 seawifsd 00089 Nov. 8, 1994, 3.3a3 00090 00091 Revision 3.3 1994/11/08 15:04:19 seawifsd 00092 Nov. 8, 1994, 3.3a2 00093 00094 Revision 1.1.1.2 1994/11/03 20:09:11 frank 00095 typo in the definition of SAME_TIMECODE() : datatype -> dtype. 00096 00097 Revision 1.1.1.1 1994/11/03 19:37:53 frank 00098 defined macros NEXT_TIMECODE, PREV_TIMECODE, SAME_TIMECODE, and MSEC_ERR, 00099 FFM_SEC_INC to deal with timecode for each minor frame. 00100 00101 Revision 1.2 1994/05/10 18:47:40 seawifst 00102 May 6, 1994 version 1.2 00103 00104 Revision 1.1 1994/04/19 13:30:13 seawifst 00105 Initial revision 00106 00107 00108 */ 00109 00110 #ifndef FILLFRAME_H 00111 #define FILLFRAME_H 00112 00113 #include "ffm.h" 00114 00115 #define IS_FRAME_VALID(x) (((x) == 1) || ((x) == 2) || ((x) == 3)) 00116 #ifndef OLD_SOH 00117 #define NEXT_LAC_FRAME(x) (((x) % 3) + 1) 00118 #define PREV_LAC_FRAME(x) ((((x)+1) % 3) + 1) 00119 #define NEXT_GAC_FRAME(x) ((((x)+1) % 3) + 1) 00120 #define PREV_GAC_FRAME(x) (((x) % 3) + 1) 00121 #define IS_FRAME_JUMP(prev,next,dtype) (((dtype != GACTYPE)?NEXT_LAC_FRAME(prev):NEXT_GAC_FRAME(prev)) != (next)) 00122 #define NEXT_FRAME(x,dtype) ((dtype != GACTYPE)?NEXT_LAC_FRAME(x):NEXT_GAC_FRAME(x)) 00123 #define PREV_FRAME(x,dtype) ((dtype != GACTYPE)?PREV_LAC_FRAME(x):PREV_GAC_FRAME(x)) 00124 #else 00125 #define NEXT_FRAME(x) (((x) % 3) + 1) 00126 #define PREV_FRAME(x) ((((x)+1) % 3) + 1) 00127 #define IS_FRAME_JUMP(prev,next) (NEXT_FRAME(prev) != (next)) 00128 #endif /* !OLD_SOH */ 00129 /* return frame number after 'add' frame(s) are added */ 00130 /* if 'add' equal to zero, the result is the same as NEXT_FRAME */ 00131 #ifndef OLD_SOH 00132 #define MOD3(x) (((x)-1)%3+1) 00133 #define ADD_GAC_FRAME(prev,add) MOD3(3 + (prev) - MOD3(add)) 00134 #define ADD_LAC_FRAME(prev,add) ((((prev-1)+(add)) % 3)+1) 00135 #define ADD_FRAME(prev,add,dtype) ((dtype != GACTYPE)?ADD_LAC_FRAME(prev,add):ADD_GAC_FRAME(prev,add)) 00136 #else 00137 #define ADD_FRAME(prev,add) ((((prev-1)+(add)) % 3)+1) 00138 #endif /* !OLD_SOH */ 00139 #define CALC_FRAME_GAP(ptime,ntime,delta) (((ntime) - (ptime))/(delta)) 00140 /* frame distance will be -1, 0, 1, or 2, the actual distance will */ 00141 /* be that number plus 3*n where n is an integer number */ 00142 #ifndef OLD_SOH 00143 #define CALC_FRAME_DISTANCE(prev,next,dtype) (((dtype) != GACTYPE)?(CALC_LAC_FRAME_DISTANCE(prev,next)):(CALC_GAC_FRAME_DISTANCE(prev,next))) 00144 #define CALC_GAC_FRAME_DISTANCE(prev,next) (((next) > (prev))?3:0)+((prev)-(next)) 00145 #define CALC_LAC_FRAME_DISTANCE(prev,next) (((next - prev) == -2)?(1):(next-prev)) 00146 #else 00147 #define CALC_FRAME_DISTANCE(prev,next) (((next - prev) == -2)?(1):(next-prev)) 00148 #endif /* !OLD_SOH */ 00149 #define FILL_FRAME(pframe,nframe,ptime,ntime,delta) 00150 00151 00152 #define SCAN_MSEC_INC(dtype) ((dtype == GACTYPE)?(GAC_MSEC_INC):(LAC_MSEC_INC)) 00153 #define FFM_MSEC_INC(dtype) ((dtype == GACTYPE)?(GAC_FFM_MSEC_INC):(LAC_FFM_MSEC_INC)) 00154 #define MSEC_ERR(dtype) ((dtype == GACTYPE)?(GAC_MSEC_ERR):(LAC_MSEC_ERR)) 00155 #define FFM2SCAN(ffm,dtype) (ffm*((dtype == GACTYPE)?(GAC_PER_FFM):1)) 00156 00157 #define FFM_MSEC_MOD(msec,dtype) fmodf((msec),FFM_MSEC_INC(dtype)) 00158 #define MSEC_OFFSET(msec,ref) (((msec) > (ref/2))?(msec-ref):msec) 00159 00160 #define NEXT_TIMECODE(timecode,dtype) (timecode + FFM_MSEC_INC(dtype)) 00161 #define PREV_TIMECODE(timecode,dtype) (timecode - FFM_MSEC_INC(dtype)) 00162 #define SAME_TIMECODE(timecodeA,timecodeB,dtype) ((-MSEC_ERR(dtype) <= (timecodeA - timecodeB)) && ((timecodeA - timecodeB) <= MSEC_ERR(dtype))) 00163 00164 #ifndef READ_AHEAD_BUFFER 00165 #define READ_AHEAD_BUFFER MAXV(LAC_FFM_GAP_MAX,GAC_FFM_GAP_MAX) 00166 #endif /* READ_AHEAD_BUFFER */ 00167 00168 #define FRAME_ERR -1 00169 #define FRAME_SYNC 0 00170 #define FRAME_NOSYNC 1 00171 00172 static char *frame_status_str[]={"FRAME_ERR","FRAME_SYNC","FRAME_NOSYNC"}; 00173 #define FRAME_STATUS(n) frame_status_str[n+1] 00174 00175 /* 00176 Number of fill segments might be for each scene. The value of 100 is 00177 acceptable for Fred. Smaller might be possible.(30 is the number based 00178 on the current DCF file drop out situation. 00179 This limitation is based on the practical point of view and for easy 00180 of implementation(less pitfall and faster speed). 00181 */ 00182 #define MAX_FILL_SEG 100 00183 00184 #define TIME_ERR -1 00185 #define TIME_SYNC 0 00186 #define TIME_SYNC_FRAME 1 00187 #define TIME_SYNC_SCAN 2 00188 #define TIME_SYNC_SAME 3 00189 #define TIME_NOSYNC 4 00190 00191 static char *time_sync_status_str[]={ "TIME_ERR","TIME_SYNC","TIME_SYNC_FRAME","TIME_SYNC_SCAN","TIME_SYNC_SAME","TIME_NOSYNC"}; 00192 #define TIME_STATUS(n) time_sync_status_str[n+1] 00193 00194 #define FILL_BAND_NONE 0 00195 #define FILL_BAND_1 1 00196 #define FILL_BAND_2 2 00197 #define FILL_BAND_3 4 00198 #define FILL_BAND_4 8 00199 #define FILL_BAND_5 16 00200 #define FILL_BAND_6 32 00201 #define FILL_BAND_7 64 00202 #define FILL_BAND_8 128 00203 #define FILL_BAND_ALL 255 00204 static char *fill_band_status_str[]={ 00205 "FILL_BAND_NONE","FILL_BAND_1","FILL_BAND_2","FILL_BAND_3", 00206 "FILL_BAND_4","FILL_BAND_5","FILL_BAND_6","FILL_BAND_7", 00207 "FILL_BAND_8","FILL_BAND_ALL"}; 00208 00209 /* can not find out how to fill, break up into another scene */ 00210 #define FILL_TYPE_ERR -2 00211 /* can not find out how to fill yet, but still can try other ways */ 00212 #define FILL_TYPE_UNKNOWN -1 00213 /* no fill is necessary */ 00214 #define FILL_TYPE_NONE 0 00215 /* frame number is wrong. Need to adjust that */ 00216 #define FILL_TYPE_FRAME_NO 1 00217 /* time code is incorrect. Need to adjust that */ 00218 #define FILL_TYPE_TIME 2 00219 /* repeat use data in the buffer that was read in last time */ 00220 #define FILL_TYPE_LAST 3 00221 /* same as FILL_TYPE_LAST except fixing sc_id and timetag field */ 00222 #define FILL_TYPE_LAST_DATA 4 00223 /* drop last minor frame of data */ 00224 #define FILL_TYPE_LAST_DROP 5 00225 /* drop current minor frame of data */ 00226 #define FILL_TYPE_CURR_DROP 6 00227 /* fill zero value */ 00228 #define FILL_TYPE_ALL 255 00229 00230 /* define to the macro before FILL_TYPE_ALL */ 00231 #define FILL_TYPE_ERR_INDEX FILL_TYPE_CURR_DROP 00232 00233 static char *fill_type_status_str[]={"FILL_TYPE_ERR","FILL_TYPE_UNKNOWN", 00234 "FILL_TYPE_NONE", "FILL_TYPE_FRAME_NO", "FILL_TYPE_TIME", 00235 "FILL_TYPE_LAST","FILL_TYPE_LAST_DATA", 00236 "FILL_TYPE_LAST_DROP","FILL_TYPE_CURR_DROP", 00237 "FILL_TYPE_ALL"}; 00238 #define FILL_TYPE_STATUS(n) fill_type_status_str[(n > FILL_TYPE_ERR_INDEX)?(FILL_TYPE_ERR_INDEX+3):(n+2)] 00239 00240 #define REWIND 0 00241 #define NOREWIND 1 00242 00243 static int good_fill_report; 00244 00245 #define GOOD_FILL_REPORT (good_fill_report == 1) 00246 #define GOOD_FILL_REPORT_ON() good_fill_report = 1 00247 #define GOOD_FILL_REPORT_OFF() good_fill_report = 0 00248 #define GOOD_FILL_REPORT_TOGGLE() good_fill_report = 1 - good_fill_report 00249 00250 static const char *default_scene_tab = "-->\t"; 00251 static const char *default_frame_tab = "f->\t"; 00252 static const char *default_time_tab = "t->\t"; 00253 static const char *default_fill_tab = "x->\t"; 00254 static char *scene_tab = "-->\t"; 00255 static char *frame_tab = "f->\t"; 00256 static char *time_tab = "t->\t"; 00257 static char *fill_tab = "x->\t"; 00258 #define SET_SCENE_TAB(tab) strcpy(scene_tab,tab) 00259 #define SET_FRAME_TAB(tab) strcpy(frame_tab,tab) 00260 #define SET_TIME_TAB(tab) strcpy(time_tab,tab) 00261 #define SET_FILL_TAB(tab) strcpy(fill_tab,tab) 00262 #define F_SCENE_TAB(fp) fprintf(fp,"%s",scene_tab) 00263 #define F_FRAME_TAB(fp) fprintf(fp,"%s",frame_tab) 00264 #define F_TIME_TAB(fp) fprintf(fp,"%s",time_tab) 00265 #define F_FILL_TAB(fp) fprintf(fp,"%s",fill_tab) 00266 #define SCENE_TAB() printf("%s",scene_tab) 00267 #define FRAME_TAB() printf("%s",frame_tab) 00268 #define TIME_TAB() printf("%s",time_tab) 00269 #define FILL_TAB() printf("%s",fill_tab) 00270 00271 typedef struct fill_infoStruct { 00272 int frame_no; /* frame sequence number 0,1,2,... */ 00273 int nframe; /* number of filled frame */ 00274 int scene_no; /* which scene is belong to, 0,1,... */ 00275 int rec_no; /* rec no offset within the scene */ 00276 int scene_seq; /* which fill within each scene, 0,1,...*/ 00277 int file_seq; /* which fill within the L0 file, 0,1,2,*/ 00278 int fill_status; /* what kind of fill is performed */ 00279 int time_status; 00280 int frame_status; 00281 struct fill_infoStruct *next; /* pointer to the next */ 00282 } fill_infoType; 00283 00284 typedef struct ffm_infoStruct { 00285 int flag; 00286 int year; 00287 int yday; 00288 int msec; 00289 int mfnum; 00290 int dtype; 00291 int navindex; 00292 int rec_no; 00293 short sc_id[ID_LEN/2]; 00294 short ttag[TAG_LEN/2]; 00295 } ffm_infoType; 00296 00297 #define XMALLOC(x) (x *)malloc(sizeof(x)) 00298 #define XCALLOC(x) (x *)calloc(1,sizeof(x)) 00299 #define XMEMCPY(dst,src) memcpy(dst,src,sizeof(*src)) 00300 00301 #include "usrhdr.h" 00302 #include "usrmac.h" 00303 #include "fillframe_proto.h" 00304 00305 #endif /* FILLFRAME_H */
1.7.6.1