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.

159 lines
6.3 KiB

  1. /*
  2. * @DEC_COPYRIGHT@
  3. */
  4. /*
  5. * HISTORY
  6. * $Log: $
  7. * $EndLog$
  8. */
  9. /*****************************************************************************
  10. ** Copyright (c) Digital Equipment Corporation, 1994 **
  11. ** **
  12. ** All Rights Reserved. Unpublished rights reserved under the copyright **
  13. ** laws of the United States. **
  14. ** **
  15. ** The software contained on this media is proprietary to and embodies **
  16. ** the confidential technology of Digital Equipment Corporation. **
  17. ** Possession, use, duplication or dissemination of the software and **
  18. ** media is authorized only pursuant to a valid written license from **
  19. ** Digital Equipment Corporation. **
  20. ** **
  21. ** RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the U.S. **
  22. ** Government is subject to restrictions as set forth in Subparagraph **
  23. ** (c)(1)(ii) of DFARS 252.227-7013, or in FAR 52.227-19, as applicable. **
  24. ******************************************************************************/
  25. #ifndef _SV_H261_PROTO_H_
  26. #define _SV_H261_PROTO_H_
  27. #include "sv_intrn.h"
  28. #define nextstate(huff, laststate, mask) ( (cb & mask \
  29. ? huff->state[laststate] >> 16 \
  30. : huff->state[laststate] ) & 0xffff )
  31. #define DecodeHuff(bs, huff, State, cb, bits) \
  32. State=0; bits=1; cb = (unsigned short)ScBSPeekBits(bs, 16); \
  33. if (bs->EOI) return(SvErrorEndBitstream); \
  34. while (1) { \
  35. if ((State = nextstate(huff, State, 0x8000)) & 0x8000) { \
  36. ScBSSkipBits(bs, bits); \
  37. State = (State == 0xffff) ? 0 : State & 0x7fff; \
  38. break; \
  39. } \
  40. cb<<=1; bits++; \
  41. }
  42. #define DecodeHuffA(bs, huff, State, cb, bits) \
  43. State=0; bits=1; cb = (unsigned short)ScBSPeekBits(bs, 16); \
  44. while (1) { \
  45. if ((State = nextstate(huff, State, 0x8000)) & 0x8000) { \
  46. if (bs->EOI && bs->shift<(unsigned int)bits) return(SvErrorEndBitstream); \
  47. ScBSSkipBits(bs, bits); \
  48. if (State==0xffff || State==0x8000) return(0); \
  49. else { State&=0x7fff; break; } \
  50. } \
  51. cb<<=1; bits++; \
  52. }
  53. #define DecodeHuffB(bs, huff, StateR, StateL, cb, bits) \
  54. StateR=0; bits=1; cb = (unsigned short)ScBSPeekBits(bs, 16); \
  55. while (1) { \
  56. if ((StateR = nextstate(huff, StateR, 0x8000)) & 0x8000) { \
  57. if (StateR==0xffff || StateR==0x8000) { ScBSSkipBits(bs, bits); \
  58. return(0);} \
  59. else { \
  60. StateR &= 0x7fff; \
  61. if (StateR == HUFFMAN_ESCAPE) { ScBSSkipBits(bs, bits); \
  62. if (bs->EOI && bs->shift<14) return(SvErrorEndBitstream); \
  63. StateR=(int)ScBSGetBits(bs,6); StateL=(int)ScBSGetBits(bs,8); } \
  64. else { ScBSSkipBits(bs, bits+1); \
  65. StateL = (cb&0x4000) ? -(StateR & 0xff) : (StateR & 0xff); \
  66. StateR = StateR >> 8; } \
  67. break; } \
  68. } \
  69. cb<<=1; bits++; \
  70. }
  71. /*
  72. ** sv_h261_cdD6.c
  73. */
  74. extern SvStatus_t DecodeAC_Scale(SvH261Info_t *H261, ScBitstream_t *bs,
  75. int index, int QuantUse, float *fmatrix);
  76. extern float DecodeDC_Scale(SvH261Info_t *H261, ScBitstream_t *bs,
  77. int BlockType, int QuantUse);
  78. extern SvStatus_t CBPDecodeAC_Scale(SvH261Info_t *H261, ScBitstream_t *bs,
  79. int index, int QuantUse, int BlockType, float *fmatrix);
  80. extern void DGenScaleMat();
  81. extern void ScaleIdct_64(float *ipbuf, int *outbuf);
  82. extern int DecodeDC(SvH261Info_t *H261, ScBitstream_t *bs);
  83. /*
  84. ** sv_h261_cdenc.c
  85. */
  86. extern void GenScaleMat();
  87. extern SvStatus_t EncodeAC(SvH261Info_t *H261,ScBitstream_t *bs,int index,
  88. int *matrix);
  89. extern SvStatus_t CBPEncodeAC(SvH261Info_t *H261,ScBitstream_t *bs,int index,
  90. int *matrix);
  91. extern void EncodeDC(SvH261Info_t *H261,ScBitstream_t *bs,int coef);
  92. extern void InterQuant(float *tdct,int *dct,int mq);
  93. extern void IntraQuant(float *tdct,int *dct, int mq);
  94. extern void ZigzagMatrix(int *imatrix,int *omatrix);
  95. extern void Inv_Quant(int *matrix,int QuantUse,int BlockType,float *fmatrix);
  96. extern void ScaleIdct_64(float *ipbuf, int *outbuf);
  97. extern void ScaleDct(int * ipbuf, float * outbuf);
  98. /*
  99. ** sv_h261_marker.c
  100. */
  101. extern void WritePictureHeader(SvH261Info_t *H261, ScBitstream_t *bs);
  102. extern void WriteGOBHeader(SvH261Info_t *H261, ScBitstream_t *bs);
  103. extern void ReadHeaderTrailer(SvH261Info_t *H261, ScBitstream_t *bs);
  104. extern SvStatus_t ReadHeaderHeader(SvH261Info_t *H261, ScBitstream_t *bs);
  105. extern void ReadGOBHeader(SvH261Info_t *H261, ScBitstream_t *bs);
  106. extern SvStatus_t WriteMBHeader(SvH261Info_t *H261, ScBitstream_t *bs);
  107. extern int ReadMBHeader(SvH261Info_t *H261, ScBitstream_t *bs);
  108. /*
  109. ** sv_h261_me2.c
  110. */
  111. extern void BruteMotionEstimation(SvH261Info_t *H261, unsigned char *pmem,
  112. unsigned char *recmem, unsigned char *fmem);
  113. extern void Logsearch(SvH261Info_t *H261, unsigned char *pmem,
  114. unsigned char *recmem, unsigned char *fmem);
  115. extern void CrawlMotionEstimation(SvH261Info_t *H261, unsigned char *pmem,
  116. unsigned char *recmem, unsigned char *fmem);
  117. extern int blockdiff16_C(unsigned char* ptr1, unsigned char *ptr2,
  118. int Jump, int mv);
  119. extern int blockdiff16_sub_C(unsigned char* ptr1, unsigned char *ptr2,
  120. int Jump, int mv);
  121. extern int fblockdiff16_sub_C(unsigned char* ptr1, unsigned char *ptr2,
  122. int Jump);
  123. /*
  124. ** sv_h261_blockdiff.s
  125. */
  126. extern int blockdiff16(unsigned char* ptr1, unsigned char *ptr2, int Jump,
  127. int);
  128. extern int blockdiff16_sub(unsigned char* ptr1, unsigned char *ptr2,
  129. int Jump, int);
  130. extern int fblockdiff16_sub(unsigned char* ptr1, unsigned char *ptr2,
  131. int Jump);
  132. /*
  133. ** sv_h261_huffman.c
  134. */
  135. extern void sv_H261HuffInit();
  136. extern void sv_H261HuffFree();
  137. extern int sv_H261HuffEncode(SvH261Info_t *H261, ScBitstream_t *bs, int val,
  138. EHUFF *huff);
  139. extern int sv_H261HuffDecode(SvH261Info_t *H261, ScBitstream_t *bs, DHUFF *huff);
  140. #endif /* _SV_H263_PROTO_H_ */