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.

166 lines
5.9 KiB

  1. // Copyright (c) Microsoft Corp. 1992-94
  2. /*==============================================================================
  3. The prototypes in this header file define an API for the Fax Codec DLL.
  4. DATE NAME COMMENTS
  5. 25-Nov-92 RajeevD Created.
  6. 13-Apr-93 RajeevD Changed to Bring Your Own Memory (BYOM :=) API.
  7. 01-Nov-93 RajeevD Defined structure for initialization parameters.
  8. 21-Jan-94 RajeevD Split FaxCodecRevBuf into BitReverseBuf and InvertBuf.
  9. 19-Jul-94 RajeevD Added nTypeOut=NULL_DATA and FaxCodecCount.
  10. ==============================================================================*/
  11. #ifndef _FAXCODEC_
  12. #define _FAXCODEC_
  13. #include <windows.h>
  14. #include <buffers.h>
  15. /*==============================================================================
  16. The FC_PARAM structure specifies the conversion to be initialized.
  17. This matrix indicates the valid combinations of nTypeIn and nTypeOut.
  18. nTypeOut
  19. MH MR MMR LRAW NULL
  20. MH * * * *
  21. MR * * * *
  22. nTypeIn
  23. MMR * * *
  24. LRAW * * *
  25. ==============================================================================*/
  26. #ifdef WIN32
  27. #pragma pack (push)
  28. #pragma pack(1)
  29. #endif
  30. typedef struct
  31. #ifdef __cplusplus
  32. FAR FC_PARAM
  33. #endif
  34. {
  35. DWORD nTypeIn; // input data type: {MH|MR|MMR|LRAW}_DATA
  36. DWORD nTypeOut; // output type type: {MH|MR|MMR|LRAW|NULL}_DATA
  37. UINT cbLine; // scan line byte width (must be multiple of 4)
  38. UINT nKFactor; // K factor (significant for nTypeOut==MR_DATA)
  39. }
  40. FC_PARAM, FAR *LPFC_PARAM;
  41. #ifdef WIN32
  42. #pragma pack(pop)
  43. #endif
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. /*==============================================================================
  48. FaxCodecInit() initializes a context for a conversion. The client may pass a
  49. NULL context pointer to query for the exact size of the context, allocate the
  50. context memory, and call a second time to initialize.
  51. ==============================================================================*/
  52. UINT // size of context (0 on failure)
  53. WINAPI FaxCodecInit
  54. (
  55. LPVOID lpContext, // context pointer (or NULL on query)
  56. LPFC_PARAM lpParam // initialization parameters
  57. );
  58. typedef UINT (WINAPI *LPFN_FAXCODECINIT)
  59. (LPVOID, LPFC_PARAM);
  60. // Return codes for FaxCodecConvert
  61. typedef UINT FC_STATUS;
  62. #define FC_INPUT_EMPTY 0
  63. #define FC_OUTPUT_FULL 1
  64. #define FC_DECODE_ERR 4 // only for nTypeIn==MMR_DATA
  65. /*==============================================================================
  66. FaxCodecConvert() executes the conversion specified in FaxCodecInit().
  67. In the input buffer, lpbBegData is advanced and wLengthData is decremented as
  68. data is consumed. If the caller wants to retain the input data, both must be
  69. saved and restored. If the input type is LRAW_DATA, wLengthData must be a
  70. multiple of 4.
  71. In the output buffer, wLengthData is incremented as data is appended. If the
  72. output type is LRAW_DATA, an whole number of scan lines are produced.
  73. To flush any output data at the end of a page, pass a NULL input buffer or a
  74. zero length buffer with dwMetaData set to END_OF_PAGE.
  75. Returns when the input buffer is empty or the output buffer full.
  76. ==============================================================================*/
  77. FC_STATUS // status
  78. WINAPI FaxCodecConvert
  79. (
  80. LPVOID lpContext, // context pointer
  81. LPBUFFER lpbufIn, // input buffer (NULL at end of page)
  82. LPBUFFER lpbufOut // output buffer
  83. );
  84. typedef UINT (WINAPI *LPFN_FAXCODECCONVERT)
  85. (LPVOID, LPBUFFER, LPBUFFER);
  86. /*==============================================================================
  87. The FC_COUNT structure accumulates various counters during FaxCodecConvert.
  88. ==============================================================================*/
  89. typedef struct
  90. {
  91. DWORD cTotalGood; // total good scan lines
  92. DWORD cTotalBad; // total bad scan lines
  93. DWORD cMaxRunBad; // maximum consecutive bad
  94. }
  95. FC_COUNT, FAR *LPFC_COUNT;
  96. /*==============================================================================
  97. FaxCodecCount() reports and resets the internal counters.
  98. ==============================================================================*/
  99. void WINAPI FaxCodecCount
  100. (
  101. LPVOID lpContext,
  102. LPFC_COUNT lpCount
  103. );
  104. typedef void (WINAPI *LPFN_FAXCODECCOUNT)
  105. (LPVOID, LPFC_COUNT);
  106. /*==============================================================================
  107. BitReverseBuf() performs a bit reversal of buffer data. The dwMetaData field is
  108. toggled between LRAW_DATA and HRAW_DATA. As with all scan lines, the length
  109. of data (wLengthData) must be a 32-bit multiple. For best performance the start
  110. of the data (lpbBegData) should be 32-bit aligned and the data predominantly 0.
  111. ==============================================================================*/
  112. void WINAPI BitReverseBuf (LPBUFFER lpbuf);
  113. /*==============================================================================
  114. InvertBuf() inverts buffer data. As with all scan lines, the length of data
  115. (wLengthData) must be a 32-bit multiple. For best performance, the start of
  116. data (lpbBegData) should be 32-bit aligned.
  117. ==============================================================================*/
  118. void WINAPI InvertBuf (LPBUFFER lpbuf);
  119. /*==============================================================================
  120. FaxCodecChange() produces a change vector for an LRAW scan line.
  121. ==============================================================================*/
  122. typedef short FAR* LPSHORT;
  123. // Slack Parameters.
  124. #define RAWBUF_SLACK 2
  125. #define CHANGE_SLACK 12
  126. #define OUTBUF_SLACK 16
  127. extern void WINAPI FaxCodecChange
  128. (
  129. LPBYTE lpbLine, // LRAW scan line
  130. UINT cbLine, // scan line width
  131. LPSHORT lpsChange // change vector
  132. );
  133. #ifdef __cplusplus
  134. } // extern "C" {
  135. #endif
  136. #endif // _FAXCODEC_