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.

467 lines
15 KiB

  1. /* *************************************************************************
  2. ** INTEL Corporation Proprietary Information
  3. **
  4. ** This listing is supplied under the terms of a license
  5. ** agreement with INTEL Corporation and may not be copied
  6. ** nor disclosed except in accordance with the terms of
  7. ** that agreement.
  8. **
  9. ** Copyright (c) 1995,1996 Intel Corporation.
  10. ** All Rights Reserved.
  11. **
  12. ** *************************************************************************
  13. */
  14. ////////////////////////////////////////////////////////////////////////////
  15. //
  16. // $Author: JMCVEIGH $
  17. // $Date: 05 Feb 1997 12:14:24 $
  18. // $Archive: S:\h26x\src\common\cdrvdefs.h_v $
  19. // $Header: S:\h26x\src\common\cdrvdefs.h_v 1.39 05 Feb 1997 12:14:24 JMCVEIGH $
  20. // $Log: S:\h26x\src\common\cdrvdefs.h_v $
  21. ;//
  22. ;// Rev 1.39 05 Feb 1997 12:14:24 JMCVEIGH
  23. ;// Support for improved PB-frames custom message handling.
  24. ;//
  25. ;// Rev 1.38 14 Jan 1997 11:17:14 JMCVEIGH
  26. ;// Put flag for old still-frame mode backward compatibility under
  27. ;// #ifdef H263P
  28. ;//
  29. ;// Rev 1.37 06 Jan 1997 17:38:08 JMCVEIGH
  30. ;// Added flag in LPDECINST to ensure backward compatibility with
  31. ;// old still-frame mode (crop CIF image to 320x240).
  32. ;//
  33. ;// Rev 1.36 16 Dec 1996 17:37:00 JMCVEIGH
  34. ;// Added H263Plus state and changed name for true B-frame mode.
  35. ;//
  36. ;// Rev 1.35 16 Dec 1996 13:40:46 MDUDA
  37. ;// Added compression and bit width fields to compress info.
  38. ;//
  39. ;// Rev 1.34 11 Dec 1996 14:56:46 JMCVEIGH
  40. ;//
  41. ;// Added H.263+ options to frame header structure and flags in
  42. ;// configuration structure.
  43. ;//
  44. ;// Rev 1.33 09 Dec 1996 17:43:10 JMCVEIGH
  45. ;// Added support for arbitrary frame size support.
  46. ;//
  47. ;// Rev 1.32 09 Dec 1996 09:24:42 MDUDA
  48. ;//
  49. ;// Re-arranged for H263P.
  50. ;//
  51. ;// Rev 1.31 10 Sep 1996 16:13:06 KLILLEVO
  52. ;// added custom message in decoder to turn block edge filter on or off
  53. ;//
  54. ;// Rev 1.30 10 Sep 1996 10:32:10 KLILLEVO
  55. ;// changed GlobalAlloc/GlobalLock to HeapAlloc
  56. ;//
  57. ;// Rev 1.29 06 Sep 1996 15:00:20 MBODART
  58. ;// Added performance counters for NT's perfmon.
  59. ;// New files: cxprf.cpp, cxprf.h and cxprf.cpp.
  60. ;// New directory: src\perf
  61. ;// Updated files: e1enc.{h,cpp}, d1dec.{h,cpp}, cdrvdefs.h, h261* makefiles.
  62. ;//
  63. ;// Rev 1.28 10 Jul 1996 08:26:38 SCDAY
  64. ;// H261 Quartz merge
  65. ;//
  66. ;// Rev 1.27 19 Jun 1996 14:37:26 RHAZRA
  67. ;// added #define FOURCC_YUY2
  68. ;//
  69. ;// Rev 1.26 06 May 1996 12:56:34 BECHOLS
  70. ;// changed unbitspersecond to unBytesPerSecond.
  71. ;//
  72. ;// Rev 1.25 06 May 1996 00:42:36 BECHOLS
  73. ;//
  74. ;// Added support for the bit rate control in the configure dialog.
  75. ;//
  76. ;// Rev 1.24 26 Apr 1996 11:09:18 BECHOLS
  77. ;//
  78. ;// Added RTP stuff.
  79. ;//
  80. ;// Rev 1.23 02 Feb 1996 18:52:52 TRGARDOS
  81. ;// Added code to enable ICM_COMPRESS_FRAMES_INFO message.
  82. ;//
  83. ;// Rev 1.22 19 Jan 1996 15:32:50 TRGARDOS
  84. ;// Added TRPrev field to PictureHeader structure.
  85. ;//
  86. ;// Rev 1.21 11 Jan 1996 16:52:24 DBRUCKS
  87. ;// added variables to store the aspect ratio correction boolean
  88. ;//
  89. ;// Rev 1.20 04 Jan 1996 18:07:54 TRGARDOS
  90. ;// Added boolean for 320x240 input into COMPINSTINFO.
  91. ;//
  92. ;// Rev 1.19 27 Dec 1995 14:11:54 RMCKENZX
  93. ;//
  94. ;// Added copyright notice
  95. //
  96. // Rev 1.18 06 Dec 1995 09:22:56 DBRUCKS
  97. //
  98. // Added blazer data rate, frame rate, and quality variables to
  99. // COMPINSTINFO inside an H261 ifdef
  100. //
  101. // Rev 1.17 30 Oct 1995 12:02:12 TRGARDOS
  102. // Modified compressor instance structure to add
  103. // 240x180 support.
  104. //
  105. // Rev 1.16 27 Sep 1995 19:09:30 TRGARDOS
  106. // Changed enumeration name for picture code type.
  107. //
  108. // Rev 1.15 20 Sep 1995 12:37:40 DBRUCKS
  109. // save the fcc in uppercase
  110. //
  111. // Rev 1.14 19 Sep 1995 15:41:28 TRGARDOS
  112. // Fixed four cc comparison code.
  113. //
  114. // Rev 1.13 18 Sep 1995 08:42:46 CZHU
  115. //
  116. // Define FOURCC for YUV12
  117. //
  118. // Rev 1.12 13 Sep 1995 17:08:26 TRGARDOS
  119. // Finished adding encoder support for YVU9 160x120 frames.
  120. //
  121. // Rev 1.11 12 Sep 1995 17:01:38 DBRUCKS
  122. // add twocc
  123. //
  124. // Rev 1.10 11 Sep 1995 11:14:48 DBRUCKS
  125. // add h261 ifdef
  126. //
  127. // Rev 1.9 29 Aug 1995 17:18:48 TRGARDOS
  128. // Padded H263HeaderStruct
  129. //
  130. // Rev 1.8 28 Aug 1995 17:45:04 DBRUCKS
  131. // add size defines
  132. //
  133. // Rev 1.7 28 Aug 1995 11:45:52 TRGARDOS
  134. //
  135. // Updated frame size bit field in PTYPE.
  136. //
  137. // Rev 1.6 25 Aug 1995 10:37:12 CZHU
  138. // Changed PITCH from const int to #define, because of compiler bug for inline
  139. //
  140. // Rev 1.5 25 Aug 1995 09:02:32 TRGARDOS
  141. //
  142. // Modified picture header structure.
  143. //
  144. // Rev 1.4 14 Aug 1995 11:34:52 TRGARDOS
  145. // Finished writing picture frame header.
  146. //
  147. // Rev 1.3 11 Aug 1995 17:27:56 TRGARDOS
  148. // Added bitstream writing and defined bitstream fields.
  149. //
  150. // Rev 1.2 07 Aug 1995 16:25:28 TRGARDOS
  151. //
  152. // Moved PITCH definition here from c3dec.h.
  153. //
  154. // Rev 1.1 03 Aug 1995 10:38:40 TRGARDOS
  155. //
  156. // Put picture header structure definition and GOB header
  157. // definition in here.
  158. //
  159. // Rev 1.0 31 Jul 1995 12:56:14 DBRUCKS
  160. // rename files
  161. //
  162. // Rev 1.0 17 Jul 1995 14:43:58 CZHU
  163. // Initial revision.
  164. //
  165. // Rev 1.0 17 Jul 1995 14:14:32 CZHU
  166. // Initial revision.
  167. ;//
  168. ;// Added encoder controls message support.
  169. ;// Modified RTP dialog box.
  170. ;// Change to PercentForcedUpdate
  171. ;// add T_CONFIGURATION
  172. ;// Integrate with build 29
  173. ;//
  174. ////////////////////////////////////////////////////////////////////////////
  175. #ifndef DRV_DEFS_H
  176. #define DRV_DEFS_H
  177. #ifndef WIN32
  178. /*
  179. * Define standard data types.
  180. */
  181. typedef BYTE __huge* HPBYTE;
  182. typedef WORD __huge* HPWORD;
  183. typedef BYTE __far* LPBYTE;
  184. typedef WORD __far* LPWORD;
  185. typedef int __far* LPSHORT;
  186. typedef unsigned char U8;
  187. #ifndef I8
  188. typedef signed char I8;
  189. #endif
  190. #ifndef U16
  191. typedef unsigned int U16;
  192. #endif
  193. #ifndef I16
  194. typedef signed int I16;
  195. #endif
  196. #ifndef U32
  197. typedef unsigned long U32;
  198. #endif
  199. #ifndef INT
  200. #define INT short int /* signed 16 bit */
  201. #endif
  202. #else //WIN32
  203. typedef BYTE * HPBYTE;
  204. typedef WORD * HPWORD;
  205. typedef BYTE * LPBYTE;
  206. typedef WORD * LPWORD;
  207. typedef short int * LPSHORT;
  208. typedef unsigned char U8;
  209. #ifndef I8
  210. typedef signed char I8;
  211. #endif
  212. #ifndef U16
  213. typedef unsigned short int U16;
  214. #endif
  215. #ifndef I16
  216. typedef signed short int I16;
  217. #endif
  218. #ifndef U32
  219. typedef unsigned long U32;
  220. #endif
  221. #ifndef INT
  222. #define INT int /* signed 16 bit */
  223. #endif
  224. #endif //WIN32
  225. /*
  226. * Define custom DRVPROC messages for playback.
  227. */
  228. #define PLAYBACK_CUSTOM_START (ICM_RESERVED_HIGH + 1)
  229. #define PLAYBACK_CUSTOM_END (PLAYBACK_CUSTOM_START + 9)
  230. #define PLAYBACK_CUSTOM_CHANGE_BRIGHTNESS (PLAYBACK_CUSTOM_START + 0)
  231. #define PLAYBACK_CUSTOM_CHANGE_CONTRAST (PLAYBACK_CUSTOM_START + 1)
  232. #define PLAYBACK_CUSTOM_CHANGE_SATURATION (PLAYBACK_CUSTOM_START + 2)
  233. #define PLAYBACK_CUSTOM_RESET_BRIGHTNESS (PLAYBACK_CUSTOM_START + 3)
  234. #define PLAYBACK_CUSTOM_RESET_SATURATION (PLAYBACK_CUSTOM_START + 4)
  235. #define PLAYBACK_CUSTOM_CHANGE_TINT (PLAYBACK_CUSTOM_START + 5)
  236. #define PLAYBACK_CUSTOM_RESET_TINT (PLAYBACK_CUSTOM_START + 6)
  237. #define PLAYBACK_CUSTOM_COLOR_CONVERT (PLAYBACK_CUSTOM_START + 7)
  238. typedef struct { char name[5]; HANDLE h; U16 FAR *log; U16 err; } TimeLog;
  239. /*
  240. * Define various constants.
  241. */
  242. #define TOTAL 0
  243. #define OVERHEAD 1
  244. #define HUFF 2
  245. #define YSLANT 3
  246. #define VSLANT 4
  247. #define USLANT 5
  248. #define YDIFF 6
  249. #define VDIFF 7
  250. #define UDIFF 8
  251. #define TORQUE 9
  252. #define FILTER 10
  253. #define CSC 11
  254. #ifdef H263P
  255. enum FrameSize {FORBIDDEN=0, SQCIF=1, QCIF=2, CIF=3, fCIF=4, ssCIF=5, CUSTOM=6, EPTYPE=7};
  256. #else
  257. enum FrameSize {FORBIDDEN=0, SQCIF=1, QCIF=2, CIF=3, fCIF=4, ssCIF=5};
  258. #endif
  259. #define MAX_WIDTH 352 // CIF
  260. #define MAX_HEIGHT 288 // CIF
  261. #define PITCH (MAX_WIDTH+32)
  262. //** Decompressor Instance information
  263. typedef struct {
  264. BOOL Initialized;
  265. BOOL bProposedCorrectAspectRatio; // proposed
  266. BOOL bCorrectAspectRatio; // whether to correct the aspect ratio
  267. #ifdef H263P
  268. BOOL bCIFto320x240; // whether to crop CIF frames to 320x240 (old still-frame mode)
  269. #endif
  270. WORD xres, yres; // size of image within movie
  271. FrameSize FrameSz; // Which of the supported frame sizes.
  272. int pXScale, pYScale; // proposed scaling (Query)
  273. int XScale, YScale; // current scaling (Begin)
  274. UINT uColorConvertor; // Current Color Convertor
  275. WORD outputDepth; // and bit depth
  276. LPVOID pDecoderInst;
  277. BOOL UseActivePalette; /* decompress to active palette == 1 */
  278. BOOL InitActivePalette; /* active palette initialized == 1 */
  279. BOOL bUseBlockEdgeFilter;/* switch for block edge filter */
  280. RGBQUAD ActivePalette[256]; /* stored active palette */
  281. } DECINSTINFO, FAR *LPDECINST;
  282. //** Configuration Information
  283. typedef struct {
  284. BOOL bInitialized; // Whether custom msgs can be rcv'd.
  285. BOOL bCompressBegin; // Whether the CompressBegin msg was rcv'd.
  286. BOOL bRTPHeader; // Whether to generate RTP header info
  287. /* used if bRTPHeader */
  288. UINT unPacketSize; // Maximum packet size
  289. BOOL bEncoderResiliency; // Whether to use resiliency restrictions
  290. /* used if bEncoderResiliency */
  291. UINT unPacketLoss;
  292. BOOL bBitRateState;
  293. /* used if bBitRateState */
  294. UINT unBytesPerSecond;
  295. /* The following information is determined from the packet loss value. */
  296. /* These values are calculated each time we receive a resiliency msg or */
  297. /* the value is changed through the dialog box. They are not stored in */
  298. /* the registry. Only the above elements are stored in the registry. */
  299. BOOL bDisallowPosVerMVs; // if true, disallow positive vertical MVs
  300. BOOL bDisallowAllVerMVs; // if true, disallow all vertical MVs
  301. UINT unPercentForcedUpdate; // Percent Forced Update per Frame
  302. UINT unDefaultIntraQuant; // Default Intra Quant
  303. UINT unDefaultInterQuant; // Default Inter Quant
  304. #ifdef H263P
  305. BOOL bH263PlusState; // Whether to use H.263+
  306. BOOL bImprovedPBState; // Whether to use improved PB-frames
  307. BOOL bDeblockingFilterState; // Whether to use in-the-loop deblocking filter
  308. #endif
  309. } T_CONFIGURATION;
  310. //** Compressor Instance information
  311. typedef struct{
  312. BOOL Initialized;
  313. WORD xres, yres;
  314. FrameSize FrameSz; // Which of the supported frame sizes.
  315. float FrameRate;
  316. U32 DataRate; // Data rate in bytes per second.
  317. HGLOBAL hEncoderInst; // Instance data private to encoder.
  318. LPVOID EncoderInst;
  319. WORD CompressedSize;
  320. BOOL Is160x120;
  321. BOOL Is240x180;
  322. BOOL Is320x240;
  323. #if defined(H263P)
  324. U32 InputCompression;
  325. U32 InputBitWidth;
  326. #endif
  327. T_CONFIGURATION Configuration;
  328. #ifdef USE_BILINEAR_MSH26X
  329. U32 InputCompression;
  330. U32 InputBitWidth;
  331. #endif
  332. } COMPINSTINFO, FAR *LPCODINST;
  333. //**
  334. //** Instance information
  335. //**
  336. typedef struct tagINSTINFO {
  337. DWORD dwFlags;
  338. DWORD fccHandler; // So we know what codec has been opened.
  339. BOOL enabled;
  340. LPCODINST CompPtr; // ICM
  341. LPDECINST DecompPtr; // ICM
  342. } INSTINFO, FAR *LPINST;
  343. //** local name definitions ***
  344. #ifdef H261
  345. #ifdef QUARTZ
  346. #define FOURCC_H26X mmioFOURCC('M','2','6','1')
  347. #endif /* QUARTZ */
  348. #define FOURCC_H263 mmioFOURCC('M','2','6','1')
  349. #else /* is H263 */
  350. #ifdef QUARTZ
  351. #define FOURCC_H26X mmioFOURCC('M','2','6','3')
  352. #endif /* QUARTZ */
  353. #define FOURCC_H263 mmioFOURCC('M','2','6','3')
  354. #ifdef USE_BILINEAR_MSH26X
  355. #define FOURCC_H26X mmioFOURCC('M','2','6','X')
  356. #endif
  357. #endif /* else is H263 */
  358. #define FOURCC_YUV12 mmioFOURCC('I','4','2','0')
  359. #define FOURCC_IYUV mmioFOURCC('I','Y','U','V')
  360. #define FOURCC_YVU9 mmioFOURCC('Y','V','U','9')
  361. #define FOURCC_IF09 mmioFOURCC('I','F','0','9')
  362. #define FOURCC_YUY2 mmioFOURCC('Y','U','Y','2')
  363. #define FOURCC_UYVY mmioFOURCC('U','Y','V','Y')
  364. #define TWOCC_H26X aviTWOCC('i','v');
  365. #define MOD4(a) ((a/4)*4)
  366. typedef struct {
  367. unsigned short PictureStartCodeZeros:16;
  368. unsigned short PictureStartCode:6;
  369. unsigned short TR:8;
  370. unsigned short Const:2;
  371. unsigned short Split:1;
  372. unsigned short DocCamera:1;
  373. unsigned short PicFreeze:1;
  374. unsigned short SrcFormat:3;
  375. unsigned short Inter:1;
  376. unsigned short UMV:1;
  377. unsigned short SAC:1;
  378. unsigned short AP:1;
  379. unsigned short PB:1;
  380. unsigned short CPM:1;
  381. } T_H263FrameHeader;
  382. enum EnumPicCodType {INTRAPIC=0, INTERPIC=1};
  383. enum EnumOnOff {OFF=0, ON=1};
  384. /*
  385. * If the size of T_H263FrameHeaderStruct is changed, then
  386. * that change must be updated in T_H263EncoderCatalog in e3enc.h
  387. */
  388. typedef struct {
  389. U32 PictureStartCodeZeros; // 0..3
  390. U8 TR; // 4
  391. // PTYPE;
  392. U8 Const; // 5 -- two bit constant: 10
  393. U8 SrcFormat; // 6 -- source format
  394. U8 Unassigned1; // 7
  395. EnumOnOff Split; // 8..11 -- split screen indicator
  396. EnumOnOff DocCamera; // 12..15 -- document camera indicator
  397. EnumOnOff PicFreeze; // 16..19 -- freeze picture release
  398. EnumPicCodType PicCodType; // 20 -- picture coding type
  399. EnumOnOff UMV; // 24 -- optional unrestricted motion vector mode
  400. EnumOnOff SAC; // 28 -- optional syntax-based arithmetic coding mode
  401. EnumOnOff AP; // 32 -- optional advanced prediction mode
  402. EnumOnOff PB; // 36 -- optional PB frames mode
  403. //
  404. U8 PQUANT; // 40
  405. U8 CPM; // 41
  406. U8 PLCI; // 42
  407. U8 TRB; // 43
  408. U8 DBQUANT; // 44
  409. U8 PEI; // 45
  410. U8 PSPARE; // 46
  411. U8 TRPrev; // 47 Temporal Reference of Previous frame
  412. #ifdef H263P
  413. // H.263+ encoding options, document LBC-96-358
  414. EnumOnOff CustomPCF; // 48 Custom PCF
  415. EnumOnOff AdvancedIntra; // 52 Advanced intra coding (Annex I)
  416. EnumOnOff DeblockingFilter; // 56 In-the-loop deblocking filter (Annex J)
  417. EnumOnOff SliceStructured; // 60 Slice-structured (Annex K)
  418. EnumOnOff ImprovedPB; // 64 Improved PB-frame mode (Annex M)
  419. EnumOnOff BackChannel; // 68 Back-channel operation (Annex N)
  420. EnumOnOff Scalability; // 72 SNR and spatial scalability (Annex O)
  421. EnumOnOff TrueBFrame; // 76 True B-frame mode (Annex O)
  422. EnumOnOff RefPicResampling; // 80 Reference-picture resampling (Annex P)
  423. EnumOnOff RedResUpdate; // 84 Reduced-resolution update (Annex Q)
  424. #endif
  425. } T_H263FrameHeaderStruct;
  426. #ifdef H263P
  427. const int sizeof_T_H263FrameHeaderStruct = 88;
  428. #else
  429. const int sizeof_T_H263FrameHeaderStruct = 48;
  430. #endif
  431. typedef struct {
  432. unsigned short StartCodeZeros:16;
  433. unsigned short StartCode:1;
  434. unsigned short GN:5;
  435. unsigned short GLCI:2;
  436. unsigned short GFID:2;
  437. unsigned short GQUANT:5;
  438. } T_H263GOBHeader;
  439. #endif /* multi inclusion protection */