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.

158 lines
5.8 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. typedef struct
  27. #ifdef __cplusplus
  28. FAR FC_PARAM
  29. #endif
  30. {
  31. DWORD nTypeIn; // input data type: {MH|MR|MMR|LRAW}_DATA
  32. DWORD nTypeOut; // output type type: {MH|MR|MMR|LRAW|NULL}_DATA
  33. UINT cbLine; // scan line byte width (must be multiple of 4)
  34. UINT nKFactor; // K factor (significant for nTypeOut==MR_DATA)
  35. }
  36. FC_PARAM, FAR *LPFC_PARAM;
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. /*==============================================================================
  41. FaxCodecInit() initializes a context for a conversion. The client may pass a
  42. NULL context pointer to query for the exact size of the context, allocate the
  43. context memory, and call a second time to initialize.
  44. ==============================================================================*/
  45. UINT // size of context (0 on failure)
  46. WINAPI FaxCodecInit
  47. (
  48. LPVOID lpContext, // context pointer (or NULL on query)
  49. LPFC_PARAM lpParam // initialization parameters
  50. );
  51. typedef UINT (WINAPI *LPFN_FAXCODECINIT)
  52. (LPVOID, LPFC_PARAM);
  53. // Return codes for FaxCodecConvert
  54. typedef UINT FC_STATUS;
  55. #define FC_INPUT_EMPTY 0
  56. #define FC_OUTPUT_FULL 1
  57. #define FC_DECODE_ERR 4 // only for nTypeIn==MMR_DATA
  58. /*==============================================================================
  59. FaxCodecConvert() executes the conversion specified in FaxCodecInit().
  60. In the input buffer, lpbBegData is advanced and wLengthData is decremented as
  61. data is consumed. If the caller wants to retain the input data, both must be
  62. saved and restored. If the input type is LRAW_DATA, wLengthData must be a
  63. multiple of 4.
  64. In the output buffer, wLengthData is incremented as data is appended. If the
  65. output type is LRAW_DATA, an whole number of scan lines are produced.
  66. To flush any output data at the end of a page, pass a NULL input buffer or a
  67. zero length buffer with dwMetaData set to END_OF_PAGE.
  68. Returns when the input buffer is empty or the output buffer full.
  69. ==============================================================================*/
  70. FC_STATUS // status
  71. WINAPI FaxCodecConvert
  72. (
  73. LPVOID lpContext, // context pointer
  74. LPBUFFER lpbufIn, // input buffer (NULL at end of page)
  75. LPBUFFER lpbufOut // output buffer
  76. );
  77. typedef UINT (WINAPI *LPFN_FAXCODECCONVERT)
  78. (LPVOID, LPBUFFER, LPBUFFER);
  79. /*==============================================================================
  80. The FC_COUNT structure accumulates various counters during FaxCodecConvert.
  81. ==============================================================================*/
  82. typedef struct
  83. {
  84. DWORD cTotalGood; // total good scan lines
  85. DWORD cTotalBad; // total bad scan lines
  86. DWORD cMaxRunBad; // maximum consecutive bad
  87. }
  88. FC_COUNT, FAR *LPFC_COUNT;
  89. /*==============================================================================
  90. FaxCodecCount() reports and resets the internal counters.
  91. ==============================================================================*/
  92. void WINAPI FaxCodecCount
  93. (
  94. LPVOID lpContext,
  95. LPFC_COUNT lpCount
  96. );
  97. typedef void (WINAPI *LPFN_FAXCODECCOUNT)
  98. (LPVOID, LPFC_COUNT);
  99. /*==============================================================================
  100. BitReverseBuf() performs a bit reversal of buffer data. The dwMetaData field is
  101. toggled between LRAW_DATA and HRAW_DATA. As with all scan lines, the length
  102. of data (wLengthData) must be a 32-bit multiple. For best performance the start
  103. of the data (lpbBegData) should be 32-bit aligned and the data predominantly 0.
  104. ==============================================================================*/
  105. void WINAPI BitReverseBuf (LPBUFFER lpbuf);
  106. /*==============================================================================
  107. InvertBuf() inverts buffer data. As with all scan lines, the length of data
  108. (wLengthData) must be a 32-bit multiple. For best performance, the start of
  109. data (lpbBegData) should be 32-bit aligned.
  110. ==============================================================================*/
  111. void WINAPI InvertBuf (LPBUFFER lpbuf);
  112. /*==============================================================================
  113. FaxCodecChange() produces a change vector for an LRAW scan line.
  114. ==============================================================================*/
  115. typedef short FAR* LPSHORT;
  116. // Slack Parameters.
  117. #define RAWBUF_SLACK 2
  118. #define CHANGE_SLACK 12
  119. #define OUTBUF_SLACK 16
  120. extern void WINAPI FaxCodecChange
  121. (
  122. LPBYTE lpbLine, // LRAW scan line
  123. UINT cbLine, // scan line width
  124. LPSHORT lpsChange // change vector
  125. );
  126. #ifdef __cplusplus
  127. } // extern "C" {
  128. #endif
  129. #endif // _FAXCODEC_