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.

365 lines
9.1 KiB

  1. /*
  2. * @DEC_COPYRIGHT@
  3. */
  4. /*
  5. * HISTORY
  6. * $Log: sv_h261.h,v $
  7. * Revision 1.1.2.11 1995/08/15 19:13:52 Karen_Dintino
  8. * fix reentrant problem
  9. * [1995/08/15 18:30:26 Karen_Dintino]
  10. *
  11. * Revision 1.1.2.10 1995/08/07 22:09:51 Hans_Graves
  12. * Added MotionEstimationType and MotionThreshold parameters.
  13. * [1995/08/07 22:04:10 Hans_Graves]
  14. *
  15. * Revision 1.1.2.9 1995/08/04 16:32:27 Karen_Dintino
  16. * Remove some fields from global struct and add some Me* fields
  17. * [1995/08/04 16:23:47 Karen_Dintino]
  18. *
  19. * Revision 1.1.2.8 1995/07/21 17:41:05 Hans_Graves
  20. * Added CallbackFunction.
  21. * [1995/07/21 17:27:57 Hans_Graves]
  22. *
  23. * Revision 1.1.2.7 1995/07/17 16:12:07 Hans_Graves
  24. * Moved BSIn, BufQ and ImageQ to SvCodecInfo_t structure.
  25. * [1995/07/17 15:55:30 Hans_Graves]
  26. *
  27. * Revision 1.1.2.6 1995/07/13 09:46:42 Jim_Ludwig
  28. * Trying to fix this broken link
  29. * [1995/07/13 09:46:26 Jim_Ludwig]
  30. *
  31. * Revision 1.1.2.5 1995/07/12 22:17:40 Karen_Dintino
  32. * Using common ScCopy routines
  33. * [1995/07/12 22:15:14 Karen_Dintino]
  34. *
  35. * Revision 1.1.2.4 1995/07/11 22:11:30 Karen_Dintino
  36. * Change size of some structures
  37. * [1995/07/11 21:55:20 Karen_Dintino]
  38. *
  39. * Revision 1.1.2.3 1995/07/01 18:43:19 Karen_Dintino
  40. * adding support for Decompress
  41. * [1995/07/01 18:14:36 Karen_Dintino]
  42. *
  43. * Revision 1.1.2.2 1995/06/19 20:30:50 Karen_Dintino
  44. * H.261 Codec Data Structures
  45. * [1995/06/19 19:26:47 Karen_Dintino]
  46. *
  47. * $EndLog$
  48. */
  49. /*
  50. ** FACILITY: Workstation Multimedia (WMM) v1.0
  51. **
  52. ** FILE NAME: SV_H261.H
  53. ** MODULE NAME:
  54. **
  55. ** MODULE DESCRIPTION:
  56. ** Data structures for H.261 Software Video Codec
  57. **
  58. ** DESIGN OVERVIEW:
  59. **
  60. **--
  61. */
  62. /*****************************************************************************
  63. ** Copyright (c) Digital Equipment Corporation, 1995 **
  64. ** **
  65. ** All Rights Reserved. Unpublished rights reserved under the copyright **
  66. ** laws of the United States. **
  67. ** **
  68. ** The software contained on this media is proprietary to and embodies **
  69. ** the confidential technology of Digital Equipment Corporation. **
  70. ** Possession, use, duplication or dissemination of the software and **
  71. ** media is authorized only pursuant to a valid written license from **
  72. ** Digital Equipment Corporation. **
  73. ** **
  74. ** RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the U.S. **
  75. ** Government is subject to restrictions as set forth in Subparagraph **
  76. ** (c)(1)(ii) of DFARS 252.227-7013, or in FAR 52.227-19, as applicable. **
  77. ******************************************************************************/
  78. /*--------------------------------------------------------------------------
  79. * Baseline H.261 data structure definitions.
  80. *
  81. * Modification History: sv_H261.h
  82. *
  83. * 04-Jan-95 KED Created
  84. *---------------------------------------------------------------------------*/
  85. #ifndef _SV_H261_H_
  86. #define _SV_H261_H_
  87. #include "SC.h"
  88. #define ACTIVE_THRESH 96
  89. #define MEBUFSIZE 1024
  90. #define H261_BLOCKSIZE 64
  91. #define H261_BLOCKWIDTH 8
  92. #define H261_BLOCKHEIGHT 8
  93. #define BEGIN(name) static char RoutineName[]= name
  94. /*
  95. ** Faster Macro versions of huffman Decode()
  96. */
  97. #define HUFFMAN_ESCAPE 0x1b01
  98. #define DHUFF struct H261_Modified_Decoder_Huffman
  99. #define EHUFF struct H261_Modified_Encoder_Huffman
  100. DHUFF
  101. {
  102. int NumberStates;
  103. int state[512];
  104. };
  105. EHUFF
  106. {
  107. int n;
  108. int *Hlen;
  109. int *Hcode;
  110. };
  111. #define RTP_H261_INTRA_CODED 0x00000001
  112. #define H261_RTP_MAX_PACKETS 64*2
  113. typedef struct SvH261BSInfo_s {
  114. unsigned dword dwFlag;
  115. unsigned dword dwBitOffset;
  116. unsigned char MBAP;
  117. unsigned char Quant;
  118. unsigned char GOBN;
  119. char HMV;
  120. char VMV;
  121. char padding0;
  122. short padding1;
  123. } SvH261BSInfo_t;
  124. typedef struct SvH261BSTrailer_s {
  125. unsigned dword dwVersion;
  126. unsigned dword dwFlags;
  127. unsigned dword dwUniqueCode;
  128. unsigned dword dwCompressedSize;
  129. unsigned dword dwNumberOfPackets;
  130. unsigned char SourceFormat;
  131. unsigned char TR;
  132. unsigned char TRB;
  133. unsigned char DBQ;
  134. } SvH261BSTrailer_t;
  135. typedef struct SvH261RTPInfo_s {
  136. SvH261BSTrailer_t trailer;
  137. SvH261BSInfo_t bsinfo[H261_RTP_MAX_PACKETS];
  138. ScBSPosition_t last_packet_position;
  139. ScBSPosition_t pre_MB_position;
  140. unsigned dword pre_MB_GOB;
  141. unsigned dword pre_MBAP;
  142. } SvH261RTPInfo_t;
  143. /*
  144. ** The following structure contains *all* state information pertaining
  145. ** to each individual H261 codec instance. Anything SLIB would ever want
  146. ** about the H261 codec configuration is contained in this structure.
  147. **
  148. */
  149. typedef struct SvH261Info_s
  150. {
  151. ScBoolean_t inited; /* was this info initialized yet */
  152. void *dbg; /* debug handle */
  153. /* options */
  154. int quality;
  155. int extbitstream; /* extended bitstream (rtp) */
  156. int packetsize; /* packet size (rtp) */
  157. int makekey;
  158. int ME_method;
  159. int ME_search;
  160. int ME_threshold;
  161. int bit_rate;
  162. float frame_rate;
  163. int FrameRate_Fix;
  164. int FrameSkip;
  165. /* dimensions */
  166. int YWidth;
  167. int YHeight;
  168. int ForceCIF;
  169. int CWidth;
  170. int CHeight;
  171. int YW4;
  172. int CW4;
  173. int PICSIZE;
  174. int PICSIZEBY4;
  175. /* misc */
  176. int (* CallbackFunction)(SvHandle_t, SvCallbackInfo_t *, SvPictureInfo_t *);
  177. int MeVAR[MEBUFSIZE];
  178. int MeVAROR[MEBUFSIZE];
  179. int MeMWOR[MEBUFSIZE];
  180. int MeX[MEBUFSIZE];
  181. int MeY[MEBUFSIZE];
  182. int MeVal[MEBUFSIZE];
  183. int MeOVal[MEBUFSIZE];
  184. int PreviousMeOVal[MEBUFSIZE];
  185. unsigned int CodedFrames;
  186. unsigned int C_U_Frames;
  187. float BitsAvailableMB;
  188. float ACE;
  189. int ActThr, ActThr2, ActThr3, ActThr4, ActThr5, ActThr6;
  190. int ChChange;
  191. int LowerQuant;
  192. int LowerQuant_FIX;
  193. int FineQuant;
  194. int PBUFF;
  195. int PBUFF_Factor;
  196. double ZBDecide;
  197. double VARF;
  198. double VARORF;
  199. double VARSQ;
  200. double VARORSQ;
  201. int MSmooth;
  202. int NumberGOB;
  203. int CurrentGOB;
  204. ScBSPosition_t Current_MBBits;
  205. ScBSPosition_t MotionVectorBits;
  206. ScBSPosition_t MacroAttributeBits;
  207. ScBSPosition_t CurrentBlockBits;
  208. ScBSPosition_t CodedBlockBits;
  209. ScBSPosition_t EOBBits;
  210. int MType;
  211. int GQuant;
  212. int MQuant;
  213. int QP; /* for VBR */
  214. int QPI;
  215. int MVDH;
  216. int MVDV;
  217. int CBP;
  218. int PSpare;
  219. int GSpare;
  220. int GRead;
  221. int MBA;
  222. int LastMBA;
  223. int LastMType;
  224. double alpha1;
  225. double alpha2;
  226. double snr_PastFrame;
  227. double time_total;
  228. double timegen;
  229. double Avg_AC;
  230. double Global_Avg;
  231. int VYWH;
  232. int VYWBYWH;
  233. int VYWH2;
  234. int VYWHMV;
  235. int VYWBYWHMV;
  236. int VYWHMV2;
  237. ScBSPosition_t NBitsPerFrame;
  238. int MAX_MQUANT;
  239. int MIN_MQUANT;
  240. int OverFlow;
  241. int OverFlow2;
  242. int Buffer_B;
  243. int Big_Buffer;
  244. int AQuant;
  245. ScBSPosition_t Buffer_All;
  246. ScBSPosition_t Buffer_NowPic;
  247. ScBSPosition_t BitsLeft;
  248. ScBSPosition_t NBitsCurrentFrame;
  249. int Pictures_in_Buff;
  250. int All_MType[512];
  251. int TotalCodedMB;
  252. int TT_MB;
  253. int NoSkippedFrame;
  254. int TotalCodedMB_Inter;
  255. int TotalCodedMB_Intra;
  256. int Current_CodedMB[2];
  257. int CodeLength;
  258. int MBpos;
  259. int MQFlag;
  260. int CurrentCBNo;
  261. /* System Definitions */
  262. int ImageType;
  263. int NumberMDU;
  264. int CurrentMDU;
  265. int CurrentFrame;
  266. int StartFrame;
  267. int LastFrame;
  268. int PreviousFrame;
  269. int NumberFrames;
  270. int TransmittedFrames;
  271. /* Stuff for RateControl */
  272. ScBSPosition_t FileSizeBits;
  273. ScBSPosition_t BufferOffset; /*Number of bits assumed for initial buffer. */
  274. int QDFact;
  275. int QOffs;
  276. int QUpdateFrequency;
  277. int QUse;
  278. int QSum;
  279. int InitialQuant;
  280. int CBPThreshold; /* abs threshold before we use CBP */
  281. ScBSPosition_t MBBits[2];
  282. int CBPFreq[6];
  283. int TotalMB[2];
  284. int SkipMB;
  285. int TemporalReference;
  286. int TemporalOffset;
  287. int PType;
  288. int Type2;
  289. int VAR;
  290. int VAROR;
  291. int MWOR;
  292. int LastMVDV;
  293. int LastMVDH;
  294. int ParityEnable;
  295. int PSpareEnable;
  296. int GSpareEnable;
  297. int Parity;
  298. /* Statistics */
  299. int NumberNZ;
  300. ScBSPosition_t FirstFrameBits;
  301. ScBSPosition_t NumberOvfl;
  302. ScBSPosition_t YCoefBits;
  303. ScBSPosition_t UCoefBits;
  304. ScBSPosition_t VCoefBits;
  305. ScBSPosition_t TotalBits;
  306. ScBSPosition_t LastBits;
  307. int MacroTypeFrequency[10];
  308. int YTypeFrequency[10];
  309. int UVTypeFrequency[10];
  310. /* for Decode */
  311. int UseQuant;
  312. unsigned int ByteOffset;
  313. unsigned int TotalByteOffset;
  314. unsigned int *workloc;
  315. DHUFF *MBADHuff;
  316. DHUFF *MVDDHuff;
  317. DHUFF *CBPDHuff;
  318. DHUFF *T1DHuff;
  319. DHUFF *T2DHuff;
  320. DHUFF *T3DHuff;
  321. EHUFF *MBAEHuff;
  322. EHUFF *MVDEHuff;
  323. EHUFF *CBPEHuff;
  324. EHUFF *T1EHuff;
  325. EHUFF *T2EHuff;
  326. EHUFF *T3EHuff;
  327. int NumberBitsCoded;
  328. unsigned char CodedMB[512];
  329. unsigned char **LastIntra; /* Used for intra forcing (once per 132 frames ) */
  330. unsigned char *CompData;
  331. unsigned char *DecompData;
  332. unsigned char *YREF;
  333. unsigned char *UREF;
  334. unsigned char *VREF;
  335. unsigned char *Y;
  336. unsigned char *U;
  337. unsigned char *V;
  338. unsigned char *YRECON;
  339. unsigned char *URECON;
  340. unsigned char *VRECON;
  341. unsigned char *YDEC;
  342. unsigned char *UDEC;
  343. unsigned char *VDEC;
  344. unsigned char mbRecY[256];
  345. unsigned char mbRecU[64];
  346. unsigned char mbRecV[64];
  347. SvH261RTPInfo_t *RTPInfo;
  348. } SvH261Info_t;
  349. #endif /* _SV_H261_H_ */