Leaked source code of windows server 2003
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.

1000 lines
38 KiB

  1. /*
  2. * @DEC_COPYRIGHT@
  3. */
  4. /*
  5. * HISTORY
  6. * $Log: SC.h,v $
  7. * Revision 1.1.8.10 1996/12/03 23:15:11 Hans_Graves
  8. * Added ScBSBufferedBytes() macros.
  9. * [1996/12/03 23:11:06 Hans_Graves]
  10. *
  11. * Revision 1.1.8.9 1996/11/13 16:10:47 Hans_Graves
  12. * Addition of ScBitstreamSave_t.
  13. * [1996/11/13 15:58:26 Hans_Graves]
  14. *
  15. * Revision 1.1.8.8 1996/11/08 21:50:36 Hans_Graves
  16. * Protos fixed for use with C++. Added bitstream protos for AC3.
  17. * [1996/11/08 21:17:23 Hans_Graves]
  18. *
  19. * Revision 1.1.8.7 1996/10/28 17:32:20 Hans_Graves
  20. * MME-01402. Added TimeStamp support to Callbacks.
  21. * [1996/10/28 16:56:21 Hans_Graves]
  22. *
  23. * Revision 1.1.8.6 1996/10/12 17:18:11 Hans_Graves
  24. * Added ScImageSize().
  25. * [1996/10/12 16:53:38 Hans_Graves]
  26. *
  27. * Revision 1.1.8.5 1996/09/18 23:45:46 Hans_Graves
  28. * Added ScFileClose() proto; ISIZE() macro
  29. * [1996/09/18 23:37:33 Hans_Graves]
  30. *
  31. * Revision 1.1.8.4 1996/08/20 22:11:48 Bjorn_Engberg
  32. * For NT - Made several routines public to support JV3.DLL and SOFTJPEG.DLL.
  33. * [1996/08/20 21:53:23 Bjorn_Engberg]
  34. *
  35. * Revision 1.1.8.3 1996/05/24 22:21:27 Hans_Graves
  36. * Added ScPatScaleIDCT8x8i_S proto
  37. * [1996/05/24 21:56:31 Hans_Graves]
  38. *
  39. * Revision 1.1.8.2 1996/05/07 19:55:49 Hans_Graves
  40. * Added BI_DECHUFFDIB
  41. * [1996/05/07 17:24:17 Hans_Graves]
  42. *
  43. * Revision 1.1.6.9 1996/04/17 16:38:36 Hans_Graves
  44. * Change NT bitstream buffer sizes from 32 to 64-bit
  45. * [1996/04/17 16:37:04 Hans_Graves]
  46. *
  47. * Revision 1.1.6.8 1996/04/15 21:08:39 Hans_Graves
  48. * Define ScBitBuff_t and ScBitString_t as dword or qword
  49. * [1996/04/15 21:05:46 Hans_Graves]
  50. *
  51. * Revision 1.1.6.7 1996/04/10 21:47:16 Hans_Graves
  52. * Added definition for EXTERN
  53. * [1996/04/10 21:23:23 Hans_Graves]
  54. *
  55. * Revision 1.1.6.6 1996/04/09 16:04:32 Hans_Graves
  56. * Added USE_C ifdef.
  57. * [1996/04/09 14:48:04 Hans_Graves]
  58. *
  59. * Revision 1.1.6.5 1996/04/01 16:23:09 Hans_Graves
  60. * NT porting
  61. * [1996/04/01 16:15:48 Hans_Graves]
  62. *
  63. * Revision 1.1.6.4 1996/03/20 22:32:46 Hans_Graves
  64. * {** Merge Information **}
  65. * {** Command used: bsubmit **}
  66. * {** Ancestor revision: 1.1.6.2 **}
  67. * {** Merge revision: 1.1.6.3 **}
  68. * {** End **}
  69. * Added protos for IDCT1x1,1x2,2x1,2x2,3x3,4x4,6x6
  70. * [1996/03/20 22:25:47 Hans_Graves]
  71. *
  72. * Revision 1.1.6.3 1996/03/16 19:22:51 Karen_Dintino
  73. * added NT port changes
  74. * [1996/03/16 19:20:07 Karen_Dintino]
  75. *
  76. * Revision 1.1.6.2 1996/03/08 18:46:27 Hans_Graves
  77. * Added proto for ScScaleIDCT8x8m_S()
  78. * [1996/03/08 18:41:45 Hans_Graves]
  79. *
  80. * Revision 1.1.4.14 1996/02/07 23:23:50 Hans_Graves
  81. * Added prototype for ScFileSeek()
  82. * [1996/02/07 23:18:32 Hans_Graves]
  83. *
  84. * Revision 1.1.4.13 1996/02/01 17:15:50 Hans_Graves
  85. * Added ScBSSkipBitsFast() and ScBSPeekBitsFast() macros
  86. * [1996/02/01 17:14:17 Hans_Graves]
  87. *
  88. * Revision 1.1.4.12 1996/01/24 19:33:18 Hans_Graves
  89. * Added prototype for ScScaleIDCT8x8i_S
  90. * [1996/01/24 18:13:51 Hans_Graves]
  91. *
  92. * Revision 1.1.4.11 1996/01/08 20:15:13 Bjorn_Engberg
  93. * Added one more cast to avoid warnings.
  94. * [1996/01/08 20:14:55 Bjorn_Engberg]
  95. *
  96. * Revision 1.1.4.10 1996/01/08 16:41:21 Hans_Graves
  97. * Added protos for more IDCT routines.
  98. * [1996/01/08 15:44:17 Hans_Graves]
  99. *
  100. * Revision 1.1.4.9 1996/01/02 18:31:13 Bjorn_Engberg
  101. * Added casts to avoid warning messages when compiling.
  102. * [1996/01/02 15:02:16 Bjorn_Engberg]
  103. *
  104. * Revision 1.1.4.8 1995/12/07 19:31:18 Hans_Graves
  105. * Added protos for ScFDCT8x8s_C() and ScIDCT8x8s_C(), Added ScBSAlignPutBits() macro.
  106. * [1995/12/07 17:58:36 Hans_Graves]
  107. *
  108. * Revision 1.1.4.7 1995/11/16 12:33:34 Bjorn_Engberg
  109. * Add BI_BITFIELDS to IsRGBPacked macro
  110. * [1995/11/16 12:33:17 Bjorn_Engberg]
  111. *
  112. * Revision 1.1.4.6 1995/10/13 21:01:42 Hans_Graves
  113. * Added macros for format classes.
  114. * [1995/10/13 20:59:15 Hans_Graves]
  115. *
  116. * Revision 1.1.4.5 1995/09/22 19:41:00 Hans_Graves
  117. * Moved ValidBI_BITFIELDSKinds to SC_convert.h
  118. * [1995/09/22 19:40:42 Hans_Graves]
  119. *
  120. * Revision 1.1.4.4 1995/09/20 18:27:59 Hans_Graves
  121. * Added Bjorn's NT defs
  122. * [1995/09/15 13:21:00 Hans_Graves]
  123. *
  124. * Revision 1.1.4.3 1995/09/14 12:35:22 Hans_Graves
  125. * Added ScCopyClipToPacked422() prototypes.
  126. * [1995/09/14 12:34:58 Hans_Graves]
  127. *
  128. * Revision 1.1.4.2 1995/09/13 14:51:45 Hans_Graves
  129. * Added ScScaleIDCT8x8(). Added buffer Type to queues.
  130. * [1995/09/13 14:29:10 Hans_Graves]
  131. *
  132. * Revision 1.1.2.18 1995/09/11 19:17:23 Hans_Graves
  133. * Moved ValidateBI_BITFIELDS() prototype to SC_convert.h - Removed mmsystem.h include.
  134. * [1995/09/11 19:14:27 Hans_Graves]
  135. *
  136. * Revision 1.1.2.17 1995/09/11 18:51:25 Farokh_Morshed
  137. * Support BI_BITFIELDS format
  138. * [1995/09/11 18:50:48 Farokh_Morshed]
  139. *
  140. * Revision 1.1.2.16 1995/08/31 14:15:43 Farokh_Morshed
  141. * transfer BI_BITFIELDS stuff to SV.h
  142. * [1995/08/31 14:15:20 Farokh_Morshed]
  143. *
  144. * Revision 1.1.2.15 1995/08/31 13:51:53 Farokh_Morshed
  145. * {** Merge Information **}
  146. * {** Command used: bsubmit **}
  147. * {** Ancestor revision: 1.1.2.13 **}
  148. * {** Merge revision: 1.1.2.14 **}
  149. * {** End **}
  150. * Add BI_BITFIELDS support
  151. * [1995/08/31 13:50:46 Farokh_Morshed]
  152. *
  153. * Revision 1.1.2.14 1995/08/29 22:17:05 Hans_Graves
  154. * Fixed-up Bitstream prototypes. Added BI_ image formats and defined BI_DECSEPYUV411DIB == BI_YU12SEP
  155. * [1995/08/29 22:15:27 Hans_Graves]
  156. *
  157. * Revision 1.1.2.13 1995/08/14 19:40:26 Hans_Graves
  158. * Added Flush, ScCopySubClip_S() and ScCopyRev_S() prototypes.
  159. * [1995/08/14 18:43:11 Hans_Graves]
  160. *
  161. * Revision 1.1.2.12 1995/07/21 17:41:01 Hans_Graves
  162. * Mirrored Callbacks with MME structure/naming.
  163. * [1995/07/21 17:30:04 Hans_Graves]
  164. *
  165. * Revision 1.1.2.11 1995/07/17 22:01:31 Hans_Graves
  166. * Added BufSize and BufType to ScCallback_t.
  167. * [1995/07/17 21:42:45 Hans_Graves]
  168. *
  169. * Revision 1.1.2.10 1995/07/12 19:48:23 Hans_Graves
  170. * Added H261_FILE type.
  171. * [1995/07/12 19:33:18 Hans_Graves]
  172. *
  173. * Revision 1.1.2.9 1995/07/11 15:24:30 Hans_Graves
  174. * Fixed ScCopySubClip and ScCopyRev macros.
  175. * [1995/07/11 15:24:09 Hans_Graves]
  176. *
  177. * Revision 1.1.2.8 1995/07/11 14:50:44 Hans_Graves
  178. * Added prototypes for sc_mc2.s and sc_copy2.s
  179. * [1995/07/11 14:23:18 Hans_Graves]
  180. *
  181. * Revision 1.1.2.7 1995/06/27 13:54:21 Hans_Graves
  182. * Added STREAM_USE_NET and prototype for ScBSCreateFromNet()
  183. * [1995/06/26 21:00:17 Hans_Graves]
  184. *
  185. * Revision 1.1.2.6 1995/06/22 21:35:03 Hans_Graves
  186. * Moved filetypes from SV.h to here
  187. * [1995/06/22 21:29:11 Hans_Graves]
  188. *
  189. * Revision 1.1.2.5 1995/06/21 18:37:58 Hans_Graves
  190. * Added prototype for ScBSPutBytes()
  191. * [1995/06/21 18:36:43 Hans_Graves]
  192. *
  193. * Revision 1.1.2.4 1995/06/15 21:17:59 Hans_Graves
  194. * Added prototypes for sc_copy.c
  195. * [1995/06/15 20:41:40 Hans_Graves]
  196. *
  197. * Revision 1.1.2.3 1995/06/01 19:35:36 Hans_Graves
  198. * Added prototype for ScCopyClip()
  199. * [1995/06/01 19:31:28 Hans_Graves]
  200. *
  201. * Revision 1.1.2.2 1995/05/31 18:09:20 Hans_Graves
  202. * Inclusion in new SLIB location.
  203. * [1995/05/31 15:17:35 Hans_Graves]
  204. *
  205. * Revision 1.1.2.2 1995/05/03 19:26:38 Hans_Graves
  206. * Included in SLIB (Oct 95)
  207. * [1995/05/03 19:26:26 Hans_Graves]
  208. *
  209. * Revision 1.1.2.3 1995/04/17 18:04:26 Hans_Graves
  210. * Added math prototypes and defs. Expanding Bitstream defs.
  211. * [1995/04/17 18:02:16 Hans_Graves]
  212. *
  213. * Revision 1.1.2.2 1995/04/07 19:18:43 Hans_Graves
  214. * Inclusion in SLIB
  215. * [1995/04/07 19:04:13 Hans_Graves]
  216. *
  217. * $EndLog$
  218. */
  219. /*****************************************************************************
  220. ** Copyright (c) Digital Equipment Corporation, 1995 **
  221. ** **
  222. ** All Rights Reserved. Unpublished rights reserved under the copyright **
  223. ** laws of the United States. **
  224. ** **
  225. ** The software contained on this media is proprietary to and embodies **
  226. ** the confidential technology of Digital Equipment Corporation. **
  227. ** Possession, use, duplication or dissemination of the software and **
  228. ** media is authorized only pursuant to a valid written license from **
  229. ** Digital Equipment Corporation. **
  230. ** **
  231. ** RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the U.S. **
  232. ** Government is subject to restrictions as set forth in Subparagraph **
  233. ** (c)(1)(ii) of DFARS 252.227-7013, or in FAR 52.227-19, as applicable. **
  234. ******************************************************************************/
  235. #ifndef _SC_H_
  236. #define _SC_H_
  237. #define SLIB_VERSION 0x300
  238. /************************* Debug Handling ***********************/
  239. #ifdef _VERBOSE_
  240. #define sc_vprintf printf
  241. #else
  242. #define sc_vprintf
  243. #endif
  244. #ifdef _DEBUG_
  245. #define sc_dprintf printf
  246. #else
  247. #define sc_dprintf
  248. #endif
  249. #ifdef _TEST_
  250. #define sc_tprintf(test, msg) if (test) printf(msg)
  251. #else
  252. #define sc_tprintf
  253. #endif
  254. #ifdef _SLIBDEBUG_
  255. #define _SlibDebug(test, statements) { if (test) { statements; } }
  256. #else
  257. #define _SlibDebug(test, statements)
  258. #endif
  259. #ifndef EXTERN
  260. #ifdef __cplusplus
  261. #if !defined(WIN32) || defined(STATIC_BUILD)
  262. #define EXTERN extern "C"
  263. #else
  264. #define EXTERN __declspec( dllexport ) extern "C"
  265. #endif
  266. #else
  267. #if !defined(WIN32) || defined(STATIC_BUILD)
  268. #define EXTERN extern
  269. #else
  270. #define EXTERN __declspec( dllexport ) extern
  271. #endif
  272. #endif /* __cplusplus */
  273. #endif /* EXTERN */
  274. #ifndef PRIVATE_EXTERN
  275. #ifdef __cplusplus
  276. #define PRIVATE_EXTERN extern "C"
  277. #else /* __cplusplus */
  278. #define PRIVATE_EXTERN extern
  279. #endif /* __cplusplus */
  280. #endif /* PRIVATE_EXTERN */
  281. #ifdef WIN32
  282. /*
  283. * These b* routines are mem* routines on NT.
  284. */
  285. #define bcopy(_src_,_dst_,_len_) memcpy(_dst_,_src_,_len_)
  286. #define bzero(_dst_,_len_) memset(_dst_,0,_len_)
  287. #define bcmp(_src_,_dst_,_len_) memcmp(_src_,_dst_,_len_)
  288. /*
  289. * These cma routines are doing nothing for NT.
  290. * Avoid lots of ifdefs on the code by defining
  291. * null macros for them.
  292. */
  293. #define cma_mutex_lock(foo)
  294. #define cma_mutex_unlock(foo)
  295. #endif /* WIN32 */
  296. /************************* Elementary Types ***********************/
  297. #ifndef UNALIGNED
  298. #if defined(WIN95) || defined(INTEL)
  299. #define UNALIGNED
  300. #else
  301. #define UNALIGNED __unaligned
  302. #endif
  303. #endif
  304. #ifndef u_char
  305. #if defined( __VMS ) || defined( WIN32 )
  306. typedef unsigned char u_char; /* 8 bits */
  307. typedef unsigned short u_short; /* 16 bits */
  308. typedef unsigned int u_int; /* 32 bits */
  309. typedef unsigned long u_long; /* 32 bits */
  310. #else
  311. typedef unsigned char u_char; /* 8 bits */
  312. typedef unsigned short u_short; /* 16 bits */
  313. typedef unsigned int u_int; /* 32 bits */
  314. typedef unsigned long u_long; /* 64 bits */
  315. #endif
  316. #endif /* u_char */
  317. #ifndef WIN32
  318. #ifndef byte /* 8 bit */
  319. #define byte char
  320. #endif
  321. #endif /* !WIN32 */
  322. #ifndef word /* 16 bit */
  323. #define word short
  324. #endif /* word */
  325. #ifndef dword /* 32 bit */
  326. #define dword int
  327. #endif /* dword */
  328. #ifndef qword /* 64 bit */
  329. #if defined(__VMS) || defined(WIN32)
  330. #define qword _int64
  331. #else
  332. #define qword long
  333. #endif
  334. #endif /* qword */
  335. #define MIN_WORD ((-32767)-1)
  336. #define MAX_WORD ( 32767)
  337. #define MIN_DWORD ((-2147483647)-1)
  338. #define MAX_DWORD ( 2147483647)
  339. /************************** Definitions ****************************/
  340. #define RETURN_ON_ERROR(A) {if (A) return (A);}
  341. #ifndef NULL
  342. #define NULL 0L
  343. #endif
  344. #ifndef TRUE
  345. #define TRUE 1
  346. #define FALSE 0
  347. #endif
  348. #ifndef WIN32
  349. #ifndef FAR
  350. #define FAR
  351. #endif
  352. #endif
  353. #ifndef PI
  354. #define PI 3.14159265358979
  355. #define PI4 PI/4
  356. #define PI64 PI/64
  357. #endif
  358. /*
  359. ** public parameter settings
  360. */
  361. /* Algorithm Flags - video */
  362. #define PARAM_ALGFLAG_HALFPEL 0x0001 /* Half pixel accuracy */
  363. #define PARAM_ALGFLAG_SKIPPEL 0x0002 /* Skip-pixel error calculation */
  364. #define PARAM_ALGFLAG_PB 0x0004 /* PB frame encoding */
  365. #define PARAM_ALGFLAG_SAC 0x0008 /* Syntax Arithmetic Coding */
  366. #define PARAM_ALGFLAG_UMV 0x0010 /* Unrestricted Motion Vectors */
  367. #define PARAM_ALGFLAG_ADVANCED 0x0020 /* Advanced Prediction Mode */
  368. /* Algorithm Flags - audio */
  369. #define PARAM_ALGFLAG_VAD 0x1000 /* Voice Activity Detection (G.723) */
  370. /* Format Extensions */
  371. #define PARAM_FORMATEXT_RTPA 0x0001 /* RTP Mode A */
  372. #define PARAM_FORMATEXT_RTPB 0x0002 /* RTP Mode B */
  373. #define PARAM_FORMATEXT_RTPC 0x0004 /* RTP Mode C */
  374. /* Frame types */
  375. #define FRAME_TYPE_NONE 0x0000
  376. #define FRAME_TYPE_I 0x0001 /* Key frame */
  377. #define FRAME_TYPE_P 0x0002 /* Partial frame */
  378. #define FRAME_TYPE_B 0x0004 /* Bi-directional frame */
  379. #define FRAME_TYPE_D 0x0008 /* Preview frame */
  380. /************************** Formats (FOURCC's) ***************************/
  381. /*
  382. ** Image formats
  383. */
  384. #define BI_MSH261DIB mmioFOURCC('M','2','6','1')
  385. #define BI_MSH263DIB mmioFOURCC('M','2','6','3')
  386. #define BI_DECH261DIB mmioFOURCC('D','2','6','1')
  387. #define BI_DECH263DIB mmioFOURCC('D','2','6','3')
  388. #define BI_DECJPEGDIB mmioFOURCC('J','P','E','G')
  389. #define BI_DECMJPGDIB mmioFOURCC('M','J','P','G')
  390. #define BI_DECYUVDIB mmioFOURCC('D','Y','U','V')
  391. #define BI_DECXIMAGEDIB mmioFOURCC('D','X','I','M')
  392. #define BI_DECSEPYUVDIB mmioFOURCC('D','S','Y','U')
  393. #define BI_DECMPEGDIB mmioFOURCC('D','M','P','G')
  394. #define BI_DECHUFFDIB mmioFOURCC('D','H','U','F')
  395. #define BI_DECSEPRGBDIB mmioFOURCC('D','S','R','G')
  396. #define BI_DECGRAYDIB mmioFOURCC('D','G','R','Y')
  397. #define BI_YVU9SEP mmioFOURCC('Y','V','U','9')
  398. #define BI_YU12SEP mmioFOURCC('Y','U','1','2')
  399. #define BI_YU16SEP mmioFOURCC('Y','U','1','6')
  400. #define BI_DECSEPYUV411DIB mmioFOURCC('Y','U','1','2')
  401. #define BI_S422 mmioFOURCC('S','4','2','2')
  402. #define BI_YUY2 mmioFOURCC('Y','U','Y','2')
  403. /*
  404. * FYI - Other image formats that are defined elsewhere:
  405. */
  406. #if 0
  407. #define BI_RGB 0
  408. #define BI_BITFIELDS 3
  409. #define BICOMP_JFIF mmioFOURCC('J','F','I','F')
  410. #endif
  411. /*
  412. * Macros to identify classes of image formats.
  413. */
  414. #define IsJPEG(s) (((s) == JPEG_DIB) || \
  415. ((s) == MJPG_DIB))
  416. #define IsYUV422Packed(s) (((s) == BI_DECYUVDIB) || \
  417. ((s) == BI_S422) || \
  418. ((s) == BI_YUY2))
  419. #define IsYUV422Sep(s) (((s) == BI_DECSEPYUVDIB) || \
  420. ((s) == BI_YU16SEP))
  421. #define IsYUV411Sep(s) (((s) == BI_DECSEPYUV411DIB) || \
  422. ((s) == BI_YU12SEP))
  423. #define IsYUV1611Sep(s) (((s) == BI_YVU9SEP))
  424. #define IsYUVSep(s) ((IsYUV422Sep(s)) || \
  425. (IsYUV411Sep(s)) || \
  426. (IsYUV1611Sep(s)))
  427. #define IsYUV(s) ((IsYUV422Packed(s)) || \
  428. (IsYUVSep(s)))
  429. #define IsRGBPacked(s) (((s) == BI_RGB) || \
  430. ((s) == BI_DECXIMAGEDIB) || \
  431. ((s) == BI_BITFIELDS))
  432. #define IsRGBSep(s) (((s) == BI_DECSEPRGBDIB))
  433. #define IsRGB(s) ((IsRGBPacked(s)) || \
  434. (IsRGBSep(s)))
  435. #define IsGray(s) (((s) == BI_DECGRAYDIB))
  436. #define ISIZE(w,h,c) \
  437. (IsYUV411Sep(c)) ? ((w) * (h) * 3 / 2) : \
  438. ((IsYUV1611Sep(c)) ? \
  439. ((w) * (h) * 9 / 8) : \
  440. ((IsYUV422Sep(c) || IsYUV422Packed(c)) ? \
  441. ((w) * (h) * 2) : ((w) * (h) * 3)));
  442. /*
  443. ** File Types (returned from ScGetFileType)
  444. */
  445. #define UNKNOWN_FILE 0
  446. #define AVI_FILE 201
  447. #define MPEG_VIDEO_FILE 202
  448. #define MPEG_AUDIO_FILE 203
  449. #define MPEG_SYSTEM_FILE 204
  450. #define JFIF_FILE 205
  451. #define QUICKTIME_JPEG_FILE 206
  452. #define GSM_FILE 207
  453. #define WAVE_FILE 208
  454. #define PCM_FILE 209
  455. #define H261_FILE 210
  456. #define AC3_FILE 211
  457. /*
  458. ** Callback messages
  459. */
  460. #define CB_RELEASE_BUFFER 1 /* buffer finished */
  461. #define CB_END_BUFFERS 2 /* no more buffers */
  462. #define CB_RESET_BUFFERS 3 /* reset to beginning */
  463. #define CB_SEQ_HEADER 4 /* sequence header */
  464. #define CB_SEQ_END 5 /* sequence end */
  465. #define CB_FRAME_FOUND 6 /* frame found */
  466. #define CB_FRAME_READY 7 /* frame completed */
  467. #define CB_FRAME_START 8 /* frame starting to be processed */
  468. #define CB_PROCESSING 9 /* processing data */
  469. #define CB_CODEC_DONE 10 /* codec done ended */
  470. /*
  471. ** Data types for callback message
  472. */
  473. #define CB_DATA_NONE 0x0000 /* no data */
  474. #define CB_DATA_COMPRESSED 0x0001 /* data is compressed */
  475. #define CB_DATA_IMAGE 0x0002 /* data is decompressed image */
  476. #define CB_DATA_AUDIO 0x0004 /* data is decompressed audio */
  477. /*
  478. ** Frame flags for callback message
  479. */
  480. #define CB_FLAG_TYPE_KEY 0x0001 /* key frame */
  481. #define CB_FLAG_TYPE_MPEGB 0x0002 /* MPEG B-Frame */
  482. #define CB_FLAG_FRAME_DROPPED 0x0008 /* frame dropped */
  483. #define CB_FLAG_FRAME_BAD 0x0010 /* could not de/compress */
  484. /*
  485. ** Action values in response to callback message
  486. */
  487. #define CB_ACTION_WAIT 0x0000 /* wait - callback still busy */
  488. #define CB_ACTION_CONTINUE 0x0001 /* accept a frame */
  489. #define CB_ACTION_DROP 0x0002 /* drop a frame */
  490. #define CB_ACTION_DUPLICATE 0x0004 /* duplicate a frame */
  491. #define CB_ACTION_END 0x0080 /* end de/compression */
  492. /* These are old definitions
  493. #define CLIENT_CONTINUE CB_ACTION_CONTINUE
  494. #define CLIENT_ABORT CB_ACTION_END
  495. #define CLIENT_PROCESS CB_ACTION_CONTINUE
  496. #define CLIENT_DROP CB_ACTION_DROP
  497. #define CB_IMAGE_BUFFER_READY CB_FRAME_READY
  498. #define CB_PICTURE_FOUND CB_FRAME_FOUND
  499. #define CB_PICTURE_PROCEESSED CB_FRAME_READY
  500. #define CB_FRAME CB_FRAME_FOUND
  501. */
  502. /*
  503. * Stream sources/destinations
  504. */
  505. #define STREAM_USE_SAME -1
  506. #define STREAM_USE_NULL 0
  507. #define STREAM_USE_QUEUE 1
  508. #define STREAM_USE_FILE 2
  509. #define STREAM_USE_BUFFER 3
  510. #define STREAM_USE_DEVICE 4
  511. #define STREAM_USE_STDOUT 5
  512. #define STREAM_USE_NET 6
  513. #define STREAM_USE_NET_TCP 6 /* reliable transport */
  514. #define STREAM_USE_NET_UDP 7 /* unreliable transport */
  515. /************************** Type Definitions *******************************/
  516. typedef int ScStatus_t;
  517. typedef void *ScHandle_t;
  518. typedef unsigned char ScBoolean_t;
  519. #if !defined( _VMS ) && !defined( WIN32 )
  520. typedef long _int64;
  521. #endif
  522. /*
  523. ** Bitstream stuff
  524. */
  525. #if defined( _VMS ) || defined( WIN95 )
  526. #define SC_BITBUFFSZ 32
  527. typedef unsigned dword ScBitBuff_t;
  528. typedef unsigned dword ScBitString_t;
  529. #else
  530. #define SC_BITBUFFSZ 64
  531. typedef unsigned qword ScBitBuff_t;
  532. typedef unsigned qword ScBitString_t;
  533. #endif
  534. #define SC_BITBUFFMASK (ScBitBuff_t)-1
  535. #define ALIGNING 8
  536. #define ScBSPreLoad(bs, bits) if ((int)bs->shift<(bits)) sc_BSLoadDataWord(bs);
  537. #define ScBSPreLoadW(bs, bits) if ((int)bs->shift<(bits)) sc_BSLoadDataWordW(bs);
  538. #define ScBSByteAlign(bs) { \
  539. int len=bs->shift%8; \
  540. if (len) { \
  541. bs->OutBuff=(bs->OutBuff<<len)|(bs->InBuff>>(SC_BITBUFFSZ-len)); \
  542. bs->InBuff<<=len; bs->CurrentBit+=len; bs->shift-=len; } \
  543. }
  544. #define ScBSAlignPutBits(bs) if (bs->shift%8) \
  545. ScBSPutBits(bs, 0, 8-(bs->shift%8));
  546. #define ScBSBitPosition(bs) (bs->CurrentBit)
  547. #define ScBSBytePosition(bs) (bs->CurrentBit>>3)
  548. #define ScBSBufferedBytes(bs) (bs->bufftop)
  549. #define ScBSBufferedBytesUsed(bs) (bs->buffp)
  550. #define ScBSBufferedBytesUnused(bs) (bs->bufftop-bs->buffp)
  551. #define ScBSSkipBit(bs) ScBSSkipBits(bs, 1)
  552. #define ScBSSkipBitsFast(bs, len) { if ((u_int)(len)<=bs->shift) { \
  553. if ((len)==SC_BITBUFFSZ) \
  554. { bs->OutBuff=bs->InBuff; bs->InBuff=0; } \
  555. else { \
  556. bs->OutBuff=(bs->OutBuff<<(len))|(bs->InBuff>>(SC_BITBUFFSZ-(len))); \
  557. bs->InBuff<<=(len); } \
  558. bs->CurrentBit+=len; bs->shift-=len; \
  559. } else ScBSSkipBits(bs, len); }
  560. #define ScBSSkipBitFast(bs) ScBSSkipBitsFast(bs, 1)
  561. #define ScBSPeekBitsFast(bs, len) (!(len) ? 0 \
  562. : (((len)<=bs->shift || !sc_BSLoadDataWord(bs)) && (len)==SC_BITBUFFSZ \
  563. ? bs->OutBuff : (bs->OutBuff >> (SC_BITBUFFSZ-len))) )
  564. #define ScBSPeekBitsFull(bs, result) \
  565. { ScBSPreLoad(bs, SC_BITBUFFSZ); result = bs->OutBuff; }
  566. /*
  567. ** Sort stuff
  568. */
  569. typedef struct ScSortDouble_s {
  570. int index; /* index to actual data */
  571. double num; /* the number to sort by */
  572. } ScSortDouble_t;
  573. typedef struct ScSortFloat_s {
  574. int index; /* index to actual data */
  575. double num; /* the number to sort by */
  576. } ScSortFloat_t;
  577. /*
  578. ** ScBuf_s structure used in Buffer/Image Queue management.
  579. ** Contains info for one buffer.
  580. */
  581. struct ScBuf_s {
  582. u_char *Data; /* Pointer to buffer's data */
  583. int Size; /* Length of buffer in bytes */
  584. int Type; /* Type of buffer */
  585. struct ScBuf_s *Prev; /* Pointer to previous buffer in queue */
  586. };
  587. /*
  588. ** Buffer queue structure. One for each queue.
  589. */
  590. typedef struct ScQueue_s {
  591. int NumBufs; /* Number of buffers currently in queue */
  592. struct ScBuf_s *head, *tail; /* pointers to head & tail of queue */
  593. } ScQueue_t;
  594. /*
  595. ** ScCallbackInfo_t passes info back & forth during callback
  596. */
  597. typedef struct ScCallbackInfo_s {
  598. int Message; /* Callback reason: CB_FRAME_READY, etc. */
  599. int DataType; /* Buffer data type */
  600. u_char *Data; /* Pointer to data buffer. */
  601. dword DataSize; /* Length of data buffer */
  602. dword DataUsed; /* Actual bytes used in buffer */
  603. void *UserData; /* User defined data */
  604. qword TimeStamp; /* Timestamp of decompressed img/audio */
  605. /* relative to start of sequence */
  606. dword Flags; /* decomp/compression details */
  607. int Action; /* drop frame or continue */
  608. dword Value; /* a value for special flags/actions */
  609. void *Format; /* BITMAPINFOHEADER or WAVEFORMATEX */
  610. } ScCallbackInfo_t;
  611. typedef qword ScBSPosition_t;
  612. /*
  613. ** State info for the input bitstream
  614. */
  615. typedef struct ScBitstream_s {
  616. dword DataSource; /* STREAM_USE_BUFFER, _USE_QUEUE,_USE_FILE, */
  617. /* or _USE_DEVICE */
  618. char Mode; /* 'r'=read, 'w'=write, 'b'=both */
  619. ScQueue_t *Q; /* Buffer Queue (STREAM_USE_QUEUE) */
  620. int (*Callback)(ScHandle_t, /* Callback to supply Bufs (STREAM_USE_QUEUE) */
  621. ScCallbackInfo_t *, void *);
  622. int (*FilterCallback)(struct /* Callback to filter data from bitstream */
  623. ScBitstream_s *);
  624. unsigned qword FilterBit; /* Bit to call filter callback at */
  625. unsigned char InFilterCallback; /* TRUE when FilterCallback is busy */
  626. ScHandle_t Sch; /* Handle passed to Callback */
  627. dword DataType; /* Data type passed to Callback */
  628. void *UserData; /* User Data passed to Callback */
  629. int FileFd; /* File descriptor (STREAM_USE_FILE/NET) */
  630. unsigned char *RdBuf; /* Buf to use if (_USE_BUFFER,_USE_FILE) */
  631. unsigned dword RdBufSize; /* Size of RdBuf */
  632. char RdBufAllocated;/* = TRUE if RdBuf was internally allocated */
  633. dword Device; /* Device to use (STREAM_USE_DEVICE) */
  634. ScBitBuff_t InBuff, OutBuff; /* 64-bit or 32-bit data buffers */
  635. unsigned int shift; /* Shift value for current bit position */
  636. ScBSPosition_t CurrentBit; /* Current bit position in bitstream */
  637. unsigned char *buff; /* pointer to bitstream data buffer */
  638. unsigned dword buffstart; /* byte offset of start of buff */
  639. unsigned dword buffp; /* byte offset in buffer */
  640. unsigned dword bufftop; /* number of bytes in buffer */
  641. ScBoolean_t EOI; /* = TRUE when no more data in data source */
  642. ScBoolean_t Flush; /* = TRUE to signal a flush at next 32/64 bit */
  643. } ScBitstream_t;
  644. /*
  645. ** Bitstream context block to save current position of input stream
  646. */
  647. typedef struct ScBitstreamSave_s {
  648. ScBitBuff_t InBuff, OutBuff; /* 64-bit or 32-bit data buffers */
  649. unsigned dword shift; /* Shift value for current bit position */
  650. ScBSPosition_t CurrentBit; /* Current bit position in bitstream */
  651. unsigned char *buff; /* pointer to bitstream data buffer */
  652. unsigned dword buffp; /* byte offset in buffer */
  653. ScBoolean_t EOI; /* = TRUE when no more data in data source */
  654. ScBoolean_t Flush; /* = TRUE to signal a flush at next 32/64 bit */
  655. } ScBitstreamSave_t;
  656. /************************** Prototypes *****************************/
  657. /*
  658. * sc_file.c
  659. */
  660. PRIVATE_EXTERN ScBoolean_t ScFileExists(char *filename);
  661. PRIVATE_EXTERN int ScFileOpenForReading(char *filename);
  662. PRIVATE_EXTERN int ScFileOpenForWriting(char *filename, ScBoolean_t truncate);
  663. PRIVATE_EXTERN ScStatus_t ScFileSize(char *filename, unsigned qword *size);
  664. PRIVATE_EXTERN dword ScFileRead(int fd, void *buffer, unsigned dword bytes);
  665. PRIVATE_EXTERN dword ScFileWrite(int fd, void *buffer, unsigned dword bytes);
  666. PRIVATE_EXTERN ScStatus_t ScFileSeek(int fd, qword bytepos);
  667. PRIVATE_EXTERN void ScFileClose(int fd);
  668. PRIVATE_EXTERN ScStatus_t ScFileMap(char *filename, int *fd, u_char **buffer,
  669. unsigned qword *size);
  670. PRIVATE_EXTERN ScStatus_t ScFileUnMap(int fd, u_char *buffer, unsigned int size);
  671. PRIVATE_EXTERN int ScGetFileType(char *filename);
  672. /*
  673. * sc_mem.c
  674. */
  675. PRIVATE_EXTERN void *ScAlloc(unsigned long bytes);
  676. PRIVATE_EXTERN void *ScAlloc2(unsigned long bytes, char *name);
  677. PRIVATE_EXTERN void *ScCalloc(unsigned long bytes);
  678. PRIVATE_EXTERN void ScFree(void *);
  679. PRIVATE_EXTERN int ScMemCheck(char *array,int test,int num);
  680. EXTERN char *ScPaMalloc(int);
  681. EXTERN void ScPaFree(void *);
  682. EXTERN int getpagesize();
  683. /*
  684. * sc_util.c
  685. */
  686. extern int sc_Dummy();
  687. PRIVATE_EXTERN unsigned int ScImageSize(unsigned int fourcc, int w, int h, int bits);
  688. extern void ScReadCommandSwitches(char *argv[],int argc,
  689. void (*error_routine)(),char *,...);
  690. extern void ScShowBuffer(unsigned char *, int);
  691. extern void ScShowBufferFloat(float *, int);
  692. extern void ScShowBufferInt(int *, int);
  693. extern int ScDumpChar(unsigned char *ptr, int nbytes, int startpos);
  694. /*
  695. * sc_errors.c
  696. */
  697. PRIVATE_EXTERN ScStatus_t ScGetErrorText (int errno, char *ReturnMsg, u_int MaxChars);
  698. PRIVATE_EXTERN char *ScGetErrorStr(int errno);
  699. extern char _serr_msg[80];
  700. /*
  701. * sc_buf.c
  702. */
  703. PRIVATE_EXTERN ScStatus_t ScBSSetFilter(ScBitstream_t *BS,
  704. int (*Callback)(ScBitstream_t *BS));
  705. PRIVATE_EXTERN ScStatus_t ScBSCreate(ScBitstream_t **BS);
  706. PRIVATE_EXTERN ScStatus_t ScBSCreateFromBuffer(ScBitstream_t **BS,
  707. u_char *Buffer, unsigned int BufSize);
  708. PRIVATE_EXTERN ScStatus_t ScBSCreateFromBufferQueue(ScBitstream_t **BS,
  709. ScHandle_t Sch, int DataType, ScQueue_t *Q,
  710. int (*Callback)(ScHandle_t,ScCallbackInfo_t *,void *),
  711. void *UserData);
  712. PRIVATE_EXTERN ScStatus_t ScBSCreateFromFile(ScBitstream_t **BS,int FileFd,
  713. u_char *Buffer, int BufSize);
  714. PRIVATE_EXTERN ScStatus_t ScBSCreateFromNet(ScBitstream_t **BS, int SocketFd,
  715. u_char *Buffer, int BufSize);
  716. PRIVATE_EXTERN ScStatus_t ScBSCreateFromDevice(ScBitstream_t **BS, int device);
  717. PRIVATE_EXTERN ScStatus_t ScBSDestroy(ScBitstream_t *BS);
  718. PRIVATE_EXTERN ScStatus_t ScBSFlush(ScBitstream_t *BS);
  719. PRIVATE_EXTERN ScStatus_t ScBSFlushSoon(ScBitstream_t *BS);
  720. PRIVATE_EXTERN ScStatus_t ScBSReset(ScBitstream_t *BS);
  721. PRIVATE_EXTERN ScStatus_t ScBSResetCounters(ScBitstream_t *BS);
  722. PRIVATE_EXTERN ScStatus_t ScBSSkipBits(ScBitstream_t *BS, u_int length);
  723. PRIVATE_EXTERN ScStatus_t ScBSSkipBitsW(ScBitstream_t *BS, u_int length);
  724. PRIVATE_EXTERN ScStatus_t ScBSSkipBytes(ScBitstream_t *BS, u_int length);
  725. PRIVATE_EXTERN int ScBSPeekBit(ScBitstream_t *BS);
  726. PRIVATE_EXTERN ScBitString_t ScBSPeekBits(ScBitstream_t *BS, u_int length);
  727. PRIVATE_EXTERN ScBitString_t ScBSPeekBytes(ScBitstream_t *BS, u_int length);
  728. PRIVATE_EXTERN int ScBSGetBytes(ScBitstream_t *BS, u_char *buffer, u_int length,
  729. u_int *ret_length);
  730. PRIVATE_EXTERN int ScBSGetBytesStopBefore(ScBitstream_t *BS, u_char *buffer,
  731. u_int length, u_int *ret_length,
  732. ScBitString_t seek_word, int word_len);
  733. PRIVATE_EXTERN ScBitString_t ScBSGetBits(ScBitstream_t *BS, u_int length);
  734. PRIVATE_EXTERN ScBitString_t ScBSGetBitsW(ScBitstream_t *BS, u_int length);
  735. PRIVATE_EXTERN int ScBSGetBitsVarLen(ScBitstream_t *BS, const int *table,
  736. int len);
  737. PRIVATE_EXTERN ScStatus_t ScBSPutBytes(ScBitstream_t *BS, u_char *buffer,
  738. u_int length);
  739. PRIVATE_EXTERN ScStatus_t ScBSPutBits(ScBitstream_t *BS, ScBitString_t bits,
  740. u_int length);
  741. PRIVATE_EXTERN ScStatus_t ScBSPutBit(ScBitstream_t *BS, char bit);
  742. PRIVATE_EXTERN int ScBSGetBit(ScBitstream_t *BS);
  743. PRIVATE_EXTERN ScStatus_t ScBSSeekToPosition(ScBitstream_t *BS, unsigned long pos);
  744. PRIVATE_EXTERN int ScBSSeekStopBefore(ScBitstream_t *BS, ScBitString_t seek_word, int word_len);
  745. PRIVATE_EXTERN int ScBSSeekAlign(ScBitstream_t *BS, ScBitString_t seek_word,int word_len);
  746. PRIVATE_EXTERN int ScBSSeekAlignStopBefore(ScBitstream_t *BS,ScBitString_t seek_word,int word_len);
  747. PRIVATE_EXTERN int ScBSSeekAlignStopBeforeW(ScBitstream_t *BS,ScBitString_t seek_word,int word_len);
  748. PRIVATE_EXTERN int ScBSSeekAlignStopAt(ScBitstream_t *BS,
  749. ScBitString_t seek_word,
  750. int word_len, unsigned long end_byte_pos);
  751. extern ScStatus_t sc_BSLoadDataWord(ScBitstream_t *BS);
  752. extern ScStatus_t sc_BSStoreDataWord(ScBitstream_t *BS, ScBitBuff_t Buff);
  753. PRIVATE_EXTERN ScStatus_t ScBufQueueCreate(ScQueue_t **Q);
  754. PRIVATE_EXTERN ScStatus_t ScBufQueueDestroy(ScQueue_t *Q);
  755. PRIVATE_EXTERN ScStatus_t ScBufQueueAdd(ScQueue_t *Q, u_char *Data, int Size);
  756. PRIVATE_EXTERN ScStatus_t ScBufQueueAddExt(ScQueue_t *Q, u_char *Data, int Size,
  757. int Type);
  758. PRIVATE_EXTERN ScStatus_t ScBufQueueRemove(ScQueue_t *Q);
  759. PRIVATE_EXTERN int ScBufQueueGetNum(ScQueue_t *Q);
  760. PRIVATE_EXTERN ScStatus_t ScBufQueueGetHead(ScQueue_t *Q, u_char **Data,
  761. int *Size);
  762. PRIVATE_EXTERN ScStatus_t ScBufQueueGetHeadExt(ScQueue_t *Q, u_char **Data,
  763. int *Size, int *Type);
  764. /*
  765. ** sc_math.c
  766. */
  767. /* #define ScAbs(val) (val > 0.0) ? val : -val */
  768. extern float ScAbs(float val);
  769. extern double ScSqr(double x);
  770. extern double ScDistance(double x1, double y1, double z1,
  771. double x2, double y2, double z2);
  772. extern void ScDigrv4(float *real, float *imag, int n);
  773. extern float ScArcTan(float Q,float I);
  774. /*
  775. ** sc_dct.c
  776. */
  777. extern void ScFDCT(float in_block[32], float out_block1[32],
  778. float out_block2[32]);
  779. extern void ScIFDCT(float in_block[32], float out_block[32]);
  780. extern void ScFDCT8x8_C(float *ipbuf, float *outbuf);
  781. extern void ScFDCT8x8s_C(short *inbuf, short *outbuf);
  782. /*
  783. ** sc_dct2.c
  784. */
  785. extern void ScFDCT8x8_S(float *ipbuf, float *outbuf);
  786. /*
  787. ** sc_idct.c
  788. */
  789. extern void ScIDCT8x8(int *outbuf);
  790. extern void ScScaleIDCT8x8_C(float *ipbuf, int *outbuf);
  791. extern void ScIDCT8x8s_C(short *inbuf, short *outbuf);
  792. /*
  793. ** sc_idct_scaled.c
  794. */
  795. extern void ScScaleIDCT8x8i_C(int *inbuf, int *outbuf);
  796. extern void ScScaleIDCT8x8i128_C(int *inbuf, int *outbuf);
  797. extern void ScScaleIDCT1x1i_C(int *inbuf, int *outbuf);
  798. extern void ScScaleIDCT1x2i_C(int *inbuf, int *outbuf);
  799. extern void ScScaleIDCT2x1i_C(int *inbuf, int *outbuf);
  800. extern void ScScaleIDCT2x2i_C(int *inbuf, int *outbuf);
  801. extern void ScScaleIDCT3x3i_C(int *inbuf, int *outbuf);
  802. extern void ScScaleIDCT4x4i_C(int *inbuf, int *outbuf);
  803. extern void ScScaleIDCT6x6i_C(int *inbuf, int *outbuf);
  804. /*
  805. ** sc_idct2.s
  806. */
  807. extern void ScIDCT8x8s_S(short *inbuf, short *outbuf);
  808. extern void ScScaleIDCT8x8i_S(int *inbuf, int *outbuf);
  809. /*
  810. ** sc_idct3.s
  811. */
  812. extern void ScScaleIDCT8x8m_S(int *inbuf);
  813. /*
  814. ** sc_idctp2.s
  815. */
  816. extern void ScPatScaleIDCT8x8i_S(int *inbuf, int *outbuf);
  817. /*
  818. ** sc_fft.c
  819. */
  820. extern void ScFFTtrl(float *real,float *imag,int n,int max_fft,float *c1,
  821. float *s1,float *c2,float *s2,float *c3,float *s3);
  822. extern void ScFFTtl(float *real, float *imag, int n, int max_fft, float *c1,
  823. float *s1, float *c2, float *s2, float *c3, float *s3);
  824. extern void ScFFTt4l(float *real, float *imag, int n, int *angle_increment,
  825. int max_fft, float *c1, float *s1, float *c2, float *s2,
  826. float *c3, float *s3);
  827. /*
  828. ** sc_sort.c
  829. */
  830. extern void ScSortDoubles(ScSortDouble_t *a, int n);
  831. /*
  832. ** sc_copy.c
  833. */
  834. extern void ScCopyClip_C(int *buf, unsigned int *pos, int inc);
  835. extern void ScCopyClipToPacked422_C(int *buf, unsigned char *pos, int inc);
  836. extern void ScCopyAddClip_C(unsigned char *mvbuf, int *idctbuf,
  837. unsigned int *pbuf, int mvinc, int pwidth);
  838. extern void ScCopySubClip_C(unsigned char *mvbuf, float *idctbuf,
  839. unsigned int *pbuf, int mvinc, int pwidth);
  840. extern void ScCopyRev_C(unsigned int *yptr, float *Idctptr, int Inc);
  841. extern void ScCopyMV8_C(unsigned char *mvbuf, unsigned int *pbuf,
  842. int mvinc, int pwidth);
  843. extern void ScLoopFilter_C(unsigned char *input, unsigned int *work, int inc);
  844. extern void ScCopyBlock_C(unsigned char *linmemu, unsigned char *linmemv,
  845. int xpos, unsigned char *blkmemu,
  846. unsigned char *blkmemv, int cwidth, int wsis);
  847. extern void ScCopyMB_C(unsigned char *ysrc, int xpos, unsigned char *ymb,
  848. int ywidth, int yywidth);
  849. extern void ScCopyMB8_C(unsigned char *ysrc, unsigned char *ymb,
  850. int ywidth, int yywidth);
  851. extern void ScCopyMB16_C(unsigned char *ysrc, unsigned char *ymb,
  852. int ywidth, int yywidth);
  853. /*
  854. ** sc_copy2.s
  855. */
  856. extern void ScCopyClip_S(int *buf, unsigned int *pos, int inc);
  857. extern void ScCopyClipToPacked422_S(int *buf, unsigned char *pos, int inc);
  858. extern void ScCopyAddClip_S(unsigned char *mvbuf, int *idctbuf,
  859. unsigned int *pbuf, int mvinc, int pwidth);
  860. extern void ScCopySubClip_S(unsigned char *mvbuf, float *idctbuf,
  861. unsigned int *pbuf, int mvinc, int pinc);
  862. extern void ScCopyRev_S(unsigned int *yptr, float *Idctptr, int yinc);
  863. extern void ScLoopFilter_S(unsigned char *input, unsigned int *work, int inc);
  864. extern void ScCopyMV8_S(unsigned char *mvbuf, unsigned int *pbuf,
  865. int mvinc, int pwidth);
  866. extern void ScCopyMV16_S(unsigned char *mvbuf, unsigned int *pbuf,
  867. int mvinc, int pwidth);
  868. extern void ScCopyMB8_S(unsigned char *ysrc, unsigned char *ymb,
  869. int ywidth, int yywidth);
  870. extern void ScCopyMB16_S(unsigned char *ysrc, unsigned char *ymb,
  871. int ywidth, int yywidth);
  872. extern void ScAvgMV_S(unsigned char *, unsigned char *);
  873. /*
  874. ** sc_mc2.s
  875. */
  876. extern void ScMCy8(unsigned char *, unsigned char *, int);
  877. extern void ScMCy16(unsigned char *, unsigned char *, int);
  878. extern void ScMCx8(unsigned char *, unsigned char *, int);
  879. extern void ScMCx16(unsigned char *, unsigned char *, int);
  880. extern void ScMCxy8(unsigned char *, unsigned char *, int);
  881. extern void ScMCxy16(unsigned char *, unsigned char *, int);
  882. /*
  883. ** macros for using C or assembly versions
  884. */
  885. #ifdef USE_C
  886. #define ScCopyClip ScCopyClip_C
  887. #define ScCopyClipToPacked422 ScCopyClipToPacked422_C
  888. #define ScCopyAddClip ScCopyAddClip_C
  889. #define ScCopySubClip ScCopySubClip_C
  890. #define ScCopyRev ScCopyRev_C
  891. #define ScLoopFilter ScLoopFilter_C
  892. #define ScCopyMV8 ScCopyMV8_C
  893. #define ScCopyMV16 ScCopyMV16_C
  894. #define ScCopyMB8 ScCopyMB8_C
  895. #define ScCopyMB16 ScCopyMB16_C
  896. #define ScAvgMV ScAvgMV_C
  897. #define ScScaleIDCT8x8 ScScaleIDCT8x8_C
  898. #define ScScaleIDCT8x8i ScScaleIDCT8x8i_C
  899. #define ScScaleIDCT8x8i128 ScScaleIDCT8x8i128_C
  900. #define ScPatScaleIDCT8x8i ScScaleIDCT8x8i_C
  901. #define ScFDCT8x8 ScFDCT8x8_C
  902. #define ScFDCT8x8s ScFDCT8x8s_C
  903. #define ScIDCT8x8s ScIDCT8x8s_C
  904. #define ScIDCT8x8sAndCopy ScIDCT8x8sAndCopy_C
  905. #else /* USE_C */
  906. #define ScCopyClip ScCopyClip_S
  907. #define ScCopyClipToPacked422 ScCopyClipToPacked422_S
  908. #define ScCopyAddClip ScCopyAddClip_S
  909. #define ScCopySubClip ScCopySubClip_S
  910. #define ScCopyRev ScCopyRev_S
  911. #define ScLoopFilter ScLoopFilter_S
  912. #define ScCopyMV8 ScCopyMV8_S
  913. #define ScCopyMV16 ScCopyMV16_S
  914. #define ScCopyMB8 ScCopyMB8_S
  915. #define ScCopyMB16 ScCopyMB16_S
  916. #define ScAvgMV ScAvgMV_S
  917. #define ScScaleIDCT8x8 ScScaleIDCT8x8_C
  918. #define ScScaleIDCT8x8i ScScaleIDCT8x8i_C
  919. #define ScScaleIDCT8x8i128 ScScaleIDCT8x8i128_C
  920. #define ScPatScaleIDCT8x8i ScPatScaleIDCT8x8i_S
  921. #define ScFDCT8x8 ScFDCT8x8_S
  922. #define ScFDCT8x8s ScFDCT8x8s_C
  923. #define ScIDCT8x8s ScIDCT8x8s_S
  924. #define ScIDCT8x8sAndCopy ScIDCT8x8sAndCopy_S
  925. #endif /* USE_C */
  926. #endif /* _SC_H_ */