home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / amiiprog.zip / AVKCOM.H < prev    next >
C/C++ Source or Header  |  1994-10-27  |  15KB  |  349 lines

  1. //
  2. // Module Name: AvkCom.h
  3. //
  4. // Description: Common EXTERNAL definitions for all AVK source files
  5. //
  6. // Status: Version 1 Release 2
  7. //
  8. // Copyright Intel Corp. 1990, 1993
  9. // Copyright IBM Corp. 1990, 1993
  10. // All Rights Reserved
  11. //
  12.  
  13. #ifndef AVKCOM_H_INCLUDED    // Ignore multiple includes
  14. #define AVKCOM_H_INCLUDED    // Flag file as included
  15.  
  16. //***********************************************************************
  17. // Device Capability Information
  18. //   Set as integer constants in AVK.INI
  19. //   Returned in device capabilities information structure
  20. //***********************************************************************
  21.  
  22.  
  23. // External Video keying types
  24. #define AVK_VID_KEY_NONE    0    // Nothing attached to DVI board
  25. #define AVK_VID_KEY_DEFAULT    0    // Default, from AVK.INI
  26. #define AVK_VID_KEY_ANALOG    0x01    // External analog keying (Y cable)
  27. #define AVK_VID_KEY_DIGITAL    0x02    // External digitial keying (VFC) 
  28.  
  29.  
  30.  
  31.  
  32. // Audio Capture Impedance.
  33. // These definitions are synonymous with the impedance values
  34. // in the AVK.INI file.
  35. #define AVK_AUD_CAPT_NONE    0    // None
  36. #define AVK_AUD_CAPT_DEFAULT    0    // Default, from AVK.INI
  37. #define    AVK_AUD_CAPT_LO_LINE    1
  38. #define AVK_AUD_CAPT_MIC    2
  39. #define AVK_AUD_CAPT_CD        3
  40.  
  41. // There are synomyms for IMPEDANCE that are used by various
  42. // software. These different spellings are guaranteed
  43. // to remain synonymous as shown.
  44. #define AVK_AUD_NONE        AVK_AUD_CAPT_NONE    // None
  45. #define AVK_AUD_DEFAULT        AVK_AUD_CAPT_DEFAULT    // Default, from AVK.INI
  46. #define AVK_AUD_LO_LINE        AVK_AUD_CAPT_LO_LINE
  47. #define AVK_AUD_MIC        AVK_AUD_CAPT_MIC
  48. #define AVK_AUD_CD        AVK_AUD_CAPT_CD
  49.  
  50. // Similarly, these synonyms are used in AVK API calls...
  51. #define AVK_AUD_NONE        AVK_AUD_CAPT_NONE    // None
  52. #define AVK_AUD_DEFAULT        AVK_AUD_CAPT_DEFAULT    // Default, from AVK.INI
  53. #define AVK_LO_LINE        AVK_AUD_CAPT_LO_LINE
  54. #define    AVK_MIC            AVK_AUD_CAPT_MIC
  55. #define    AVK_CD_LINE        AVK_AUD_CAPT_CD
  56.  
  57. // These symbols are obsolete, and should be replaced by the ones above.
  58. // They have been retained to avoid compilation problems in some programs. 
  59. // They are semantically incorrect, and should not be used!
  60. #define    AVK_AUD_CAPT_MIC_HIGH    1
  61. #define AVK_AUD_CAPT_MIC_LOW    2
  62. #define AVK_AUD_CAPT_LINE_INPUT    3
  63. // these synonyms are similarly obsolete...
  64. #define    AVK_AUD_MIC_HIGH    AVK_AUD_CAPT_MIC_HIGH
  65. #define AVK_AUD_MIC_LOW        AVK_AUD_CAPT_MIC_LOW
  66. #define AVK_AUD_LINE        AVK_AUD_CAPT_LINE_INPUT
  67.  
  68. #define AVK_IMPEDANCE_MAX_TOKEN 3    //largest impedance value supported
  69. // audchannel values... how to record or playback audio...
  70. #define AVK_AUD_LEFT    1    //unsupported
  71. #define AVK_AUD_RIGHT    2    //unsupported
  72. #define AVK_AUD_MIX    3
  73. #define AVK_AUD_STEREO    4
  74. #define AVK_AUD_MAX    AVK_AUD_STEREO
  75.  
  76.  
  77. //
  78. // macros to position and recover the bits/sample (with an audio alg nr)...
  79. //
  80. #define  SET_AVK_AUD_PER_SAMP(A) ((A&15) <<8)   // e.g., 4 or 8 or 0 (for 16).
  81. #define  GET_AVK_AUD_PER_SAMP(A) ((A >>8) & 15)
  82.  
  83. //
  84. // the algorithm symbols used for AvkAudStrmFormat
  85. //
  86. #define  AVK_ADPCM4  (AVK_AUD_ALG_ADPCM4 | (SET_AVK_AUD_PER_SAMP(4)))
  87. #define  AVK_PCM8    (AVK_AUD_ALG_PCM8   | (SET_AVK_AUD_PER_SAMP(8)))
  88.  
  89.  
  90.  
  91. // Video Capture Input Source. These symbols correspond to
  92. // values in AVK.INI, for capture source.
  93. #define AVK_CAPT_SOURCE_NONE        0    // None
  94. #define AVK_CAPT_SOURCE_DEFAULT        0    // Default, from AVK.INI
  95. #define AVK_CAPT_SOURCE_COMPOSITE_1    1    // Red input line
  96. #define AVK_CAPT_SOURCE_COMPOSITE_2    2    // Green input line
  97. #define AVK_CAPT_SOURCE_SUPER_VHS    3    // Super VHS (YC)
  98. #define AVK_CAPT_SOURCE_RGB_SYNC_GREEN    4    // RGB, Sync on Green
  99. #define AVK_CAPT_SOURCE_RGB_SEP_SYNC    5    // RGB, separate Sync
  100.  
  101.  
  102. //***********************************************************************
  103. // Portability Data Types and Conventions 
  104. //***********************************************************************
  105.  
  106. //***********************************************************************
  107. // Portable data types for AVK functions and data definitions 
  108. //   Windows.h typedefs BOOL, BYTE, WORD, DWORD 
  109. //   PM uses [U]SHORT, [U]LONG 
  110. //   ANSI C does not guarantee portable signed/unsigned 8-bit
  111.  
  112. typedef char         I8;    //  8-bit signed Char - may not be portable
  113. typedef short         I16;    // 16-bit signed Integer 
  114. typedef long        I32;     // 32-bit signed Integer 
  115.  
  116. typedef unsigned char    U8;    //  8-bit unsigned Word 
  117. typedef unsigned short    U16;    // 16-bit unsigned Word 
  118. typedef unsigned long    U32;    // 32-bit unsigned Word 
  119.  
  120. //**********************************************************************
  121. // the avk api, and avkio call mechanisms...
  122.  
  123. //to use the 32bit compiler, define this symbol before including AVKCOM.H...
  124. #ifdef _32BIT                    // Compilation with IBM C SET2 compiler
  125.  #define AVK_CALL I16 _Far16 _Pascal
  126.  #define AVK_CALLBACK _Far16 _Pascal
  127. #else                                  // other Compilations
  128.  #ifdef _OS2
  129.   #define  AVK_CALL  I16 far pascal _loadds
  130.   #define  AVK_CALLBACK  far pascal _loadds 
  131.  #else
  132.   #define  AVK_CALL  I16 far pascal
  133.   #define  AVK_CALLBACK  far pascal 
  134.  #endif
  135. #endif
  136.  
  137. //***********************************************************************
  138. // Device Open Flags
  139.  
  140. #define AVK_OPEN_EXCLUSIVE 0x0001  // Open device - allow no others
  141. #define AVK_DEV_OPEN_EXCLUSIVE  AVK_OPEN_EXCLUSIVE   // required device open flags.
  142. #define AVK_OPEN_SHARE       0x0000  // Open device shared - reserved; UNSUPPORTED
  143.  
  144.  
  145. //***********************************************************************
  146. // AVK Standard Data Definitions 
  147. //***********************************************************************
  148.  
  149. //***********************************************************************
  150. // Bitmap Data Definitions 
  151. //***********************************************************************
  152.  
  153. //***********************************************************************
  154. // Bitmap Format Identifiers:
  155. //   Fields defined as xybb: 
  156. //     xy: x & y planar subsample ratio (0=packed, 1,2,4) 
  157. //     bb = bits per pixel 
  158. // Commonly used in the AVKIO API and in many existing A/V data files
  159.  
  160. // Packed bitmaps, all bits of pixel in same byte/word/longword 
  161. //    (see above for bit field definitions)
  162. // The definitions for  8-bit are reserved; unsupported.
  163. // The definitions for 12-bit are reserved; unsupported.
  164. // The definitions for 32-bit are reserved; unsupported.
  165.  
  166. #define AVK_BM_8    0x0008    // Packed bitmap, 8 bits per pixel 
  167. #define AVK_BM_16    0x0010    // Packed bitmap, 16 bits per pixel 
  168. #define AVK_BM_32    0x0020    // Packed bitmap, 32 bits per pixel 
  169.  
  170. // Planar bitmaps: 8 bits per pixel, 3 separate planes
  171. //    (see above for bit field definitions)
  172. #define AVK_BM_9    0x4408    // Planar, Subsampled 1/4 horiz & vert 
  173. #define AVK_BM_10    0x2408    // Planar, Subsampled 1/2 horiz & 1/4 vert ?
  174. #define AVK_BM_12    0x2208    // Planar, Subsampled 1/2 horiz & vertical 
  175. #define AVK_BM_24    0x1108    // Planar, Non-Subsampled (1/1) horiz & vert
  176.  
  177. // The following macro converts data file bitmap values into
  178. // the corresponding symbols used in AVK API calls...
  179. #define AVK_YUV_BM(format) \
  180.     ((format == AVK_BM_9)  ? AVK_YUV9  : \
  181.     ((format == AVK_BM_16) ? AVK_YUV16 : \
  182.     ((format == AVK_BM_24) ? AVK_YUV24 : \
  183.     ((format == AVK_BM_12) ? AVK_YUV24 : 0)))) // 0 : undefined
  184. // Extract Information From Format Data Fields
  185. #define AVK_BM_BITS(fmt)    ((fmt) & 0x00ff)    // Bits per pixel 
  186. #define AVK_BM_RATIOX(fmt)    (((fmt) >> 12) & 0x0f)    // Horiz Subsampling
  187. #define AVK_BM_RATIOY(fmt)    (((fmt) >>  8) & 0x0f)    // Vert  Subsampling
  188.  
  189. #define AVK_BM_PACKED(fmt)    (((fmt) & 0xff00) == 0)    // Packed Format
  190. #define AVK_BM_PLANAR(fmt)    (((fmt) & 0xff00) != 0)    // Planar Format
  191.  
  192. //***********************************************************************
  193. // Bitmap Plane Flags: Microcode pixel processor drawing & Video display 
  194. //   Flag bits for multiple planes 
  195. //     Y,V,U planes for planar (subsampled) and 32-bit pixels 
  196. //     Low bits so can OR with LSB: Pixel value: AVK_PLANE | AVK_LSB 
  197.  
  198. #define AVK_PLANE_NONE    0    // No planes 
  199.  
  200. #define AVK_PLANE_1       0x01    // 1st plane 
  201. #define AVK_PLANE_2       0x02    // 2nd plane 
  202. #define AVK_PLANE_3    0x04    // 3rd plane 
  203. #define AVK_PLANE_12    (AVK_PLANE_1 | AVK_PLANE_2)  // 1 & 2 
  204. #define AVK_PLANE_13       (AVK_PLANE_1 | AVK_PLANE_3)  // 1 & 3 
  205. #define AVK_PLANE_23       (AVK_PLANE_2 | AVK_PLANE_3)  // 2 & 3 
  206. #define AVK_PLANE_123      (AVK_PLANE_1 | AVK_PLANE_23) // All 3 
  207. #define AVK_PLANE_ALL      (AVK_PLANE_1 | AVK_PLANE_23) // All 3 
  208.  
  209. //There are synomyms for planes that are used by various
  210. // software. These different spellings of the planes are guaranteed
  211. // to remain synonymous as shown.
  212. #define AVK_PLANE_Y       AVK_PLANE_1  // 1st plane 
  213. #define AVK_PLANE_V       AVK_PLANE_2  // 2nd plane 
  214. #define AVK_PLANE_U       AVK_PLANE_3  // 3rd plane 
  215. #define AVK_PLANE_YV       AVK_PLANE_12  // 1st & 2nd plane 
  216. #define AVK_PLANE_YU       AVK_PLANE_13  // 1st & 3rd plane 
  217. #define AVK_PLANE_VU       AVK_PLANE_23  // 2nd & 3rd plane 
  218. #define AVK_PLANE_YVU      AVK_PLANE_123  // All 3 planes (packed) 
  219.  
  220. //These guaranteed synonyms are used in AVK API calls...
  221. #define AVK_Y_PLANE    AVK_PLANE_Y
  222. #define AVK_U_PLANE    AVK_PLANE_U
  223. #define AVK_V_PLANE    AVK_PLANE_V
  224. #define AVK_YUV_PLANE    AVK_PLANE_YVU
  225.  
  226.  
  227.  
  228. //***********************************************************************
  229. // Video Data Definitions 
  230. //***********************************************************************
  231.  
  232. //***********************************************************************
  233. // Video Sync Flags: Used for video formats and monitor types 
  234. // also returned by the AvkVideoIn call to identify input sync
  235. //   Flag bits for multiple syncs (Multisync monitor) 
  236. //    0x000X    - Standard video syncs: NTSC, PAL, SECAM
  237. //    0x00X0    - VGA syncs
  238. //    0x0X00    - XGA syncs
  239.  
  240. #define AVK_SYNC_DEFAULT    0    // Use default sync (monitor type) 
  241.  
  242. #define AVK_SYNC_NTSC        0x0001    // NTSC: 480 lines, 30 fr/sec inter
  243. #define AVK_SYNC_PAL        0x0002    // PAL 
  244. #define AVK_SYNC_SECAM       0x0004    // SECAM (reserved; not supported)
  245. #define AVK_SYNC_VGA18        0x0010    // VGA, Mode 18:  640 x 480 @ 60Hz
  246. #define AVK_SYNC_VGA18_VESA    0x0020    // VGA, Mode 18:  640 x 480 @ 72Hz
  247. #define AVK_SYNC_VGA18_EIBM    0x0040    // VGA, Mode 18:  640 x 480 @ 75Hz
  248. #define AVK_SYNC_XGA        0x0100    // XGA, Mode ??: 1024 x 768
  249.  
  250.                     // all possible VGA syncs
  251. #define AVK_SYNC_VGA_BITS    \
  252.             (AVK_SYNC_VGA18|AVK_SYNC_VGA18_VESA|AVK_SYNC_VGA18_EIBM)
  253.  
  254.  
  255. // this bit is reserved and indicates genlocking.
  256. // It does not describe a sync type:
  257. #define AVK_SYNC_LOCK        0x8000    // External Genlock, Flag OR w/ above 
  258.  
  259. // AVK_VID_... view symbols are guaranteed synonymous with the above.
  260.  
  261. // video VBI rates expressed as microseconds per vbi
  262. #define AVK_NTSC_USEC_RATE 16683 //59.94 per sec
  263. #define AVK_XGA_USEC_RATE  11500 //86.96 per sec
  264. #define AVK_PAL_USEC_RATE  20000 //25.00 exactly
  265. #define AVK_VGA_USEC_RATE  16683 //same as ntsc but non-interlaced. 60hz!
  266.  
  267.  
  268. //these are handy values to use in the
  269. // AvkVidStrmFormat and AvkAudStrmFormat calls,
  270. // for "fullspeed" NTSC and PAL...
  271. #define AVK_NTSC_FULL_RATE 33367L //microsecs per frame for "30 fps" NTSC
  272. #define AVK_PAL_FULL_RATE  40000L //microsecs per frame for "25 fps" PAL
  273.  
  274. // Sync Rates in floating point: frames per second
  275. // these values are accurate to four significant figures.
  276. // They should not be used to COMPUTE microseconds per frame,
  277. // but are adequate for selecting among supported rates.
  278. #define AVK_SYNC_RATE_NTSC    29.97    // NTSC almost 30 frames, interlaced
  279. #define AVK_SYNC_RATE_PAL    25.00    // PAL  exactly 25 frames, interlaced
  280. #define AVK_SYNC_RATE_VGA18    59.94    // VGA  2 * NTSC, non-interlaced, 60hz
  281. #define AVK_SYNC_RATE_XGA    43.48    // XGA  frames, interlaced
  282.  
  283. // Sync Rates in floating point: vbis per second (interlaced fields)
  284. #define AVK_SYNC_VBI_NTSC    59.94    // NTSC almost 60 fields
  285. #define AVK_SYNC_VBI_PAL    50.00    // PAL  exactly 50 fields
  286. #define AVK_SYNC_VBI_VGA18    AVK_SYNC_VBI_NTSC    // non-interlaced, 60hz
  287. #define AVK_SYNC_VBI_VESA    72.809    // VGA @ 72hz
  288. #define AVK_SYNC_VBI_EIBM    75.00    // VGA @ 75hz
  289. #define AVK_SYNC_VBI_XGA    86.96    // XGA  interlaced
  290.  
  291.  
  292. // Sync rates as 16-bit integer ratios.
  293. // The following pairs of symbols express the frames per second
  294. // as a ratio of two integers..
  295. // _ratio_1_ / _ratio_2_  =   frames per second
  296. #define AVK_SYNC_RATIO_1_NTSC    30000
  297. #define AVK_SYNC_RATIO_2_NTSC     1001
  298. #define AVK_SYNC_RATIO_1_PAL    25
  299. #define AVK_SYNC_RATIO_2_PAL     1
  300. #define AVK_SYNC_RATIO_1_VGA18    (AVK_SYNC_RATE_NTSC_RATIO_1 * 2)
  301. #define AVK_SYNC_RATIO_2_VGA18    (AVK_SYNC_RATE_NTSC_RATIO_2 )
  302. #define AVK_SYNC_RATIO_1_XGA    10000
  303. #define AVK_SYNC_RATIO_2_XGA    115
  304.  
  305. //the following macros assist work with various sync types...
  306.  
  307. //given a sync value return an integer, the number microseconds per vbi
  308. #define AVK_SYNC_USEC(sync)    \
  309.     (((sync) & AVK_SYNC_NTSC)  ? AVK_NTSC_USEC_RATE :    \
  310.     (((sync) & AVK_SYNC_PAL)   ? AVK_PAL_USEC_RATE :    \
  311.     (((sync) & AVK_SYNC_VGA18) ? AVK_NTSC_USEC_RATE : AVK_XGA_USEC_RATE)))
  312.  
  313. //given a sync value return a real number -- frames per second.
  314. #define AVK_SYNC_RATE(sync)    \
  315.     (((sync) & AVK_SYNC_NTSC) ? AVK_SYNC_RATE_NTSC :    \
  316.     (((sync) & AVK_SYNC_PAL)  ? AVK_SYNC_RATE_PAL :    \
  317.     (((sync) & AVK_SYNC_VGA18)? AVK_SYNC_RATE_VGA18 : AVK_SYNC_RATE_XGA)))
  318.  
  319. //given a sync value return a real number -- vbis per second.
  320. #define AVK_SYNC_VBI(sync)    \
  321.     (((sync) & AVK_SYNC_NTSC)  ? AVK_SYNC_VBI_NTSC :    \
  322.     (((sync) & AVK_SYNC_PAL)   ? AVK_SYNC_VBI_PAL :    \
  323.     (((sync) & AVK_SYNC_VGA18) ? AVK_SYNC_VBI_VGA18 : AVK_SYNC_VBI_XGA)))
  324.  
  325. //given a sync value return the numerator of the integral fps calculation
  326. #define AVK_SYNC_RATIO_1(sync)    \
  327.     (((sync) & AVK_SYNC_NTSC)  ? AVK_SYNC_RATIO_1_NTSC :    \
  328.     (((sync) & AVK_SYNC_PAL)   ? AVK_SYNC_RATIO_1_PAL :    \
  329.     (((sync) & AVK_SYNC_VGA18) ? AVK_SYNC_RATIO_1_VGA18 :    \
  330.                     AVK_SYNC_RATIO_1_XGA)))
  331.  
  332. //given a sync value return the denominator of the integral fps calculation
  333. #define AVK_SYNC_RATIO_2(sync)    \
  334.     (((sync) & AVK_SYNC_NTSC)  ? AVK_SYNC_RATIO_2_NTSC :    \
  335.     (((sync) & AVK_SYNC_PAL)   ? AVK_SYNC_RATIO_2_PAL :    \
  336.     (((sync) & AVK_SYNC_VGA18) ? AVK_SYNC_RATIO_2_VGA18 :    \
  337.                     AVK_SYNC_RATIO_2_XGA)))
  338.         
  339.  
  340. // Given a sync, and an x res, this macro produces a suitable Y res
  341. // for specifying a view...
  342. #define AVK_SYNC_DEFAULT_RES_Y(sync, xres)    \
  343. (((xres) < 512) ?    \
  344.  (((sync) == AVK_SYNC_PAL) ? 288 : ((sync) == AVK_SYNC_XGA) ? 192 : 240) :  \
  345.  (((sync) == AVK_SYNC_PAL) ? 576 : ((sync) == AVK_SYNC_XGA) ? 384 : 480))
  346.  
  347. #endif       // End of #ifndef to control multiple includes
  348.                                                          
  349.