Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

544 lines
8.8 KiB

  1. /*
  2. ** Copyright 1992, Silicon Graphics, Inc.
  3. ** All Rights Reserved.
  4. **
  5. ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6. ** the contents of this file may not be disclosed to third parties, copied or
  7. ** duplicated in any form, in whole or in part, without the prior written
  8. ** permission of Silicon Graphics, Inc.
  9. **
  10. ** RESTRICTED RIGHTS LEGEND:
  11. ** Use, duplication or disclosure by the Government is subject to restrictions
  12. ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13. ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14. ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15. ** rights reserved under the Copyright Laws of the United States.
  16. **
  17. */
  18. #include <stdlib.h>
  19. #include <math.h>
  20. #include <setjmp.h>
  21. struct JumpBuffer {
  22. jmp_buf buf;
  23. };
  24. #define mysetjmp(x) setjmp((x)->buf)
  25. #define mylongjmp(x,y) longjmp((x)->buf, y)
  26. /* <<AT&T USL C++ Language System <3.0.1> 02/03/92>> */
  27. /* < ../core/mapdescv.c++ > */
  28. void *__vec_new (void *, int , int , void *);
  29. void __vec_ct (void *, int , int , void *);
  30. void __vec_dt (void *, int , int , void *);
  31. void __vec_delete (void *, int , int , void *, int , int );
  32. typedef int (*__vptp)(void);
  33. struct __mptr {short d; short i; __vptp f; };
  34. typedef unsigned int size_t ;
  35. // extern void *malloc (size_t );
  36. // extern void free (void *);
  37. typedef float REAL ;
  38. typedef void (*Pfvv )(void );
  39. typedef void (*Pfvf )(float *);
  40. typedef int (*cmpfunc )(void *, void *);
  41. typedef REAL Knot ;
  42. typedef REAL *Knot_ptr ;
  43. struct Buffer;
  44. struct Buffer {
  45. struct Buffer *next__6Buffer ;
  46. };
  47. struct Pool;
  48. enum __Q2_4Pool5Magic { is_allocated__Q2_4Pool5Magic = 62369, is_free__Q2_4Pool5Magic = 61858} ;
  49. struct Pool {
  50. struct Buffer *freelist__4Pool ;
  51. char *blocklist__4Pool [32];
  52. int nextblock__4Pool ;
  53. char *curblock__4Pool ;
  54. int buffersize__4Pool ;
  55. int nextsize__4Pool ;
  56. int nextfree__4Pool ;
  57. int initsize__4Pool ;
  58. char *name__4Pool ;
  59. int magic__4Pool ;
  60. };
  61. void __glgrow__4PoolFv (struct Pool *);
  62. struct PooledObj;
  63. struct PooledObj {
  64. char __W3__9PooledObj ;
  65. };
  66. typedef REAL Maxmatrix [5][5];
  67. struct Backend;
  68. struct Mapdesc;
  69. struct Mapdesc {
  70. char __W3__9PooledObj ;
  71. REAL pixel_tolerance__7Mapdesc ;
  72. REAL clampfactor__7Mapdesc ;
  73. REAL minsavings__7Mapdesc ;
  74. REAL maxrate__7Mapdesc ;
  75. REAL maxsrate__7Mapdesc ;
  76. REAL maxtrate__7Mapdesc ;
  77. REAL bboxsize__7Mapdesc [5];
  78. long type__7Mapdesc ;
  79. int isrational__7Mapdesc ;
  80. int ncoords__7Mapdesc ;
  81. int hcoords__7Mapdesc ;
  82. int inhcoords__7Mapdesc ;
  83. int mask__7Mapdesc ;
  84. Maxmatrix bmat__7Mapdesc ;
  85. Maxmatrix cmat__7Mapdesc ;
  86. Maxmatrix smat__7Mapdesc ;
  87. REAL s_steps__7Mapdesc ;
  88. REAL t_steps__7Mapdesc ;
  89. REAL sampling_method__7Mapdesc ;
  90. REAL culling_method__7Mapdesc ;
  91. REAL bbox_subdividing__7Mapdesc ;
  92. struct Mapdesc *next__7Mapdesc ;
  93. struct Backend *backend__7Mapdesc ;
  94. };
  95. void __glcopy__7MapdescSFPA5_flPfN20 (REAL (*)[5], long , float *, long , long );
  96. void __glxformRational__7MapdescFPA0 (struct Mapdesc *, REAL (*)[5], REAL *, REAL *);
  97. void __glxformNonrational__7Mapdesc0 (struct Mapdesc *, REAL (*)[5], REAL *, REAL *);
  98. // extern double sqrt (double );
  99. extern struct __mptr* __ptbl_vec_____core_mapdescv_c___calcPartialVelocity_[];
  100. REAL __glcalcPartialVelocity__7Mapd0 (struct Mapdesc *__0this ,
  101. REAL *__1p ,
  102. int __1stride ,
  103. int __1ncols ,
  104. int __1partial ,
  105. REAL __1range )
  106. {
  107. REAL __1tmp [24][5];
  108. REAL __1mag [24];
  109. int __1j ;
  110. int __1k ;
  111. int __1t ;
  112. ((void )0 );
  113. ;
  114. ;
  115. ;
  116. for(__1j = 0 ;__1j != __1ncols ;__1j ++ )
  117. for(__1k = 0 ;__1k != __0this -> inhcoords__7Mapdesc ;__1k ++ )
  118. ((__1tmp [__1j ])[__1k ])= (__1p [((__1j * __1stride )+ __1k )]);
  119. for(__1t = 0 ;__1t != __1partial ;__1t ++ )
  120. for(__1j = 0 ;__1j != ((__1ncols - __1t )- 1 );__1j ++ )
  121. for(__1k = 0 ;__1k != __0this -> inhcoords__7Mapdesc ;__1k ++
  122. )
  123. ((__1tmp [__1j ])[__1k ])= (((__1tmp [(__1j + 1 )])[__1k ])- ((__1tmp [__1j ])[__1k ]));
  124. for(__1j = 0 ;__1j != (__1ncols - __1partial );__1j ++ ) {
  125. (__1mag [__1j ])= 0.0 ;
  126. for(__1k = 0 ;__1k != __0this -> inhcoords__7Mapdesc ;__1k ++ )
  127. (__1mag [__1j ])+= (((__1tmp [__1j ])[__1k ])* ((__1tmp [__1j ])[__1k ]));
  128. }
  129. { REAL __1fac ;
  130. REAL __1invt ;
  131. __1fac = 1 ;
  132. __1invt = (1.0 / __1range );
  133. for(__1t = (__1ncols - 1 );__1t != ((__1ncols - 1 )- __1partial );__1t -- )
  134. __1fac *= (__1t * __1invt );
  135. { REAL __1max ;
  136. __1max = 0.0 ;
  137. for(__1j = 0 ;__1j != (__1ncols - __1partial );__1j ++ )
  138. if ((__1mag [__1j ])> __1max )__1max = (__1mag [__1j ]);
  139. __1max = (__1fac * sqrt ( (double )(((float )__1max ))) );
  140. return __1max ;
  141. }
  142. }
  143. }
  144. // extern void *memset (void *, int , size_t );
  145. REAL __glcalcPartialVelocity__7Mapd1 (struct Mapdesc *__0this ,
  146. REAL *__1dist ,
  147. REAL *__1p ,
  148. int __1rstride ,
  149. int __1cstride ,
  150. int __1nrows ,
  151. int __1ncols ,
  152. int __1spartial ,
  153. int __1tpartial ,
  154. REAL __1srange ,
  155. REAL __1trange ,
  156. int __1side )
  157. {
  158. REAL __1tmp [24][24][5];
  159. REAL __1mag [24][24];
  160. ((void )0 );
  161. ((void )0 );
  162. { REAL *__1tp ;
  163. REAL *__1mp ;
  164. int __1idist ;
  165. int __1jdist ;
  166. int __1kdist ;
  167. int __1id ;
  168. int __1jd ;
  169. __1tp = (& (((__1tmp [0 ])[0 ])[0 ]));
  170. __1mp = (& ((__1mag [0 ])[0 ]));
  171. __1idist = (__1nrows * 120);
  172. __1jdist = (__1ncols * 5);
  173. __1kdist = (__0this -> inhcoords__7Mapdesc * 1);
  174. __1id = (__1idist - (__1spartial * 120));
  175. __1jd = (__1jdist - (__1tpartial * 5));
  176. {
  177. REAL *__2ti ;
  178. REAL *__2qi ;
  179. REAL *__2til ;
  180. __2ti = __1tp ;
  181. __2qi = __1p ;
  182. __2til = (__1tp + __1idist );
  183. for(;__2ti != __2til ;) {
  184. REAL *__3tj ;
  185. REAL *__3qj ;
  186. REAL *__3tjl ;
  187. __3tj = __2ti ;
  188. __3qj = __2qi ;
  189. __3tjl = (__2ti + __1jdist );
  190. for(;__3tj != __3tjl ;) {
  191. { { int __4k ;
  192. __4k = 0 ;
  193. for(;__4k != __0this -> inhcoords__7Mapdesc ;__4k ++ ) {
  194. (__3tj [__4k ])= (__3qj [__4k ]);
  195. }
  196. __3tj += 5;
  197. __3qj += __1cstride ;
  198. }
  199. }
  200. }
  201. __2ti += 120;
  202. __2qi += __1rstride ;
  203. }
  204. }
  205. {
  206. REAL *__2til ;
  207. REAL *__2till ;
  208. __2til = ((__1tp + __1idist )- 120);
  209. __2till = (float *)(__2til - (__1spartial * 120));
  210. for(;__2til != (float *)__2till ;__2til -= 120)
  211. { { REAL *__2ti ;
  212. __2ti = __1tp ;
  213. for(;__2ti != __2til ;__2ti += 120)
  214. { { REAL *__2tj ;
  215. REAL *__2tjl ;
  216. __2tj = __2ti ;
  217. __2tjl = (__2tj + __1jdist );
  218. for(;__2tj != __2tjl ;__2tj += 5)
  219. { { int __2k ;
  220. __2k = 0 ;
  221. for(;__2k != __0this -> inhcoords__7Mapdesc ;__2k ++ )
  222. (__2tj [__2k ])= ((__2tj [(__2k + 120)])- (__2tj [__2k ]));
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
  229. }
  230. {
  231. REAL *__2tjl ;
  232. REAL *__2tjll ;
  233. __2tjl = ((__1tp + __1jdist )- 5);
  234. __2tjll = (float *)(__2tjl - (__1tpartial * 5));
  235. for(;__2tjl != (float *)__2tjll ;__2tjl -= 5)
  236. { { REAL *__2tj ;
  237. __2tj = __1tp ;
  238. for(;__2tj != __2tjl ;__2tj += 5)
  239. { { REAL *__2ti ;
  240. REAL *__2til ;
  241. __2ti = __2tj ;
  242. __2til = (__2ti + __1id );
  243. for(;__2ti != __2til ;__2ti += 120)
  244. { { int __2k ;
  245. __2k = 0 ;
  246. for(;__2k != __0this -> inhcoords__7Mapdesc ;__2k ++ )
  247. (__2ti [__2k ])= ((__2ti [(__2k + 5)])- (__2ti [__2k ]));
  248. }
  249. }
  250. }
  251. }
  252. }
  253. }
  254. }
  255. { REAL __1max ;
  256. int __1i ;
  257. int __1j ;
  258. REAL __1fac ;
  259. __1max = 0.0 ;
  260. {
  261. memset ( ((void *)__1mp ), 0 , sizeof __1mag ) ;
  262. { { REAL *__2ti ;
  263. REAL *__2mi ;
  264. REAL *__2til ;
  265. __2ti = __1tp ;
  266. __2mi = __1mp ;
  267. __2til = (__1tp + __1id );
  268. for(;__2ti != __2til ;( (__2ti += 120), (__2mi += 24)) )
  269. { { REAL *__2tj ;
  270. REAL *__2mj ;
  271. REAL *__2tjl ;
  272. __2tj = __2ti ;
  273. __2mj = __2mi ;
  274. __2tjl = (__2ti + __1jd );
  275. for(;__2tj != __2tjl ;( (__2tj += 5), (__2mj += 1)) ) {
  276. { { int __3k ;
  277. __3k = 0 ;
  278. for(;__3k != __0this -> inhcoords__7Mapdesc ;__3k ++ )
  279. ((*__2mj ))+= ((__2tj [__3k ])* (__2tj [__3k ]));
  280. if (((*__2mj ))> __1max )__1max = ((*__2mj ));
  281. }
  282. }
  283. }
  284. }
  285. }
  286. }
  287. }
  288. }
  289. ;
  290. ;
  291. __1fac = 1.0 ;
  292. {
  293. REAL __2invs ;
  294. REAL __2invt ;
  295. __2invs = (1.0 / __1srange );
  296. __2invt = (1.0 / __1trange );
  297. { { int __2s ;
  298. int __2slast ;
  299. __2s = (__1nrows - 1 );
  300. __2slast = (__2s - __1spartial );
  301. for(;__2s != __2slast ;__2s -- )
  302. __1fac *= (__2s * __2invs );
  303. { { int __2t ;
  304. int __2tlast ;
  305. __2t = (__1ncols - 1 );
  306. __2tlast = (__2t - __1tpartial );
  307. for(;__2t != __2tlast ;__2t -- )
  308. __1fac *= (__2t * __2invt );
  309. }
  310. }
  311. }
  312. }
  313. }
  314. if (__1side == 0 ){
  315. (__1dist [0 ])= 0.0 ;
  316. (__1dist [1 ])= 0.0 ;
  317. for(__1i = 0 ;__1i != (__1nrows - __1spartial );__1i ++ ) {
  318. __1j = 0 ;
  319. if (((__1mag [__1i ])[__1j ])> (__1dist [0 ]))(__1dist [0 ])= ((__1mag [__1i ])[__1j ]);
  320. __1j = ((__1ncols - __1tpartial )- 1 );
  321. if (((__1mag [__1i ])[__1j ])> (__1dist [1 ]))(__1dist [1 ])= ((__1mag [__1i ])[__1j ]);
  322. }
  323. (__1dist [0 ])= (__1fac * sqrt ( (double )(__1dist [0 ])) );
  324. (__1dist [1 ])= (__1fac * sqrt ( (double )(__1dist [1 ])) );
  325. }
  326. else
  327. if (__1side == 1 ){
  328. (__1dist [0 ])= 0.0 ;
  329. (__1dist [1 ])= 0.0 ;
  330. for(__1j = 0 ;__1j != (__1ncols - __1tpartial );__1j ++ ) {
  331. __1i = 0 ;
  332. if (((__1mag [__1i ])[__1j ])> (__1dist [0 ]))(__1dist [0 ])= ((__1mag [__1i ])[__1j ]);
  333. __1i = ((__1nrows - __1spartial )- 1 );
  334. if (((__1mag [__1i ])[__1j ])> (__1dist [1 ]))(__1dist [1 ])= ((__1mag [__1i ])[__1j ]);
  335. }
  336. (__1dist [0 ])= (__1fac * sqrt ( (double )(__1dist [0 ])) );
  337. (__1dist [1 ])= (__1fac * sqrt ( (double )(__1dist [1 ])) );
  338. }
  339. __1max = (__1fac * sqrt ( (double )(((float )__1max ))) );
  340. return __1max ;
  341. }
  342. }
  343. }
  344. /* the end */