compdll.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. /****************************************************************************
  2. *
  3. * Module Title : COMPDLL.H
  4. *
  5. * Description : Video CODEC demo compression DLL main header
  6. *
  7. * AUTHOR : Paul Wilkins
  8. *
  9. *****************************************************************************
  10. * Revision History
  11. *
  12. * 1.34 YWX 09-Dec-02 Added Function pointers for frame/field varainces calculation
  13. * 1.33 YWX 30-Oct-02 Added EncoderLoopFilterOff flag
  14. * 1.32 YWX 28-Oct-02 Added function pointer for 5 region diamond search
  15. * 1.31 YWX 28-Oct-02 Added above and left token context and 5 region
  16. * diamond motion search sites
  17. * 1.30 YWX 02-Jul-02 Added new funcion pointers for motion search
  18. * 1.31 JBB 04 JUL-02 Added preprocessor code
  19. * 1.29 AWG 20-Jun-01 Removed QuadCodeComponent function prototype & HExtra/VExtra
  20. * 1.29 AWG 22-May-01 Added support for DCT16
  21. * 1.28 JBB 05-May-01 Changes for VP5 (new entropytablebits and tokenextra chgs
  22. * 1.27 JBB 23-Mar-01 Changed QuickCompress datatype from BOOL to INT32
  23. * 1.26 JBB 11 Feb 01 Merged in: added vars for map ca move ac choice to right after dc
  24. * 1.25 PGW 31 Jan 01 Added some stats variables and VP5 Mv entropy tables.
  25. * 1.24 JBB 30 Nov 00 Version number changes
  26. * 1.23 JBB 15 Nov 00 Cleaned out ifdefs
  27. * 1.22 JBB 15 Oct 00 Added First Pass Function
  28. * 1.21 JBB 11 Sep 00 new function pointers for subtract removed transxquant
  29. * 1.20 JBB 07 Sep 00 Changed error metrics to Unsigned int
  30. * 1.19 JBB 24 Aug 00 Ansi C compatible
  31. * 1.18 JBB 27Jul00 added checks on Mallocs
  32. * 1.17 JBB 24Jul00 Changed error functions to return INT32 instead of double
  33. * 1.16 PGW 12 Jul 00 Removed CompAutoKeyFrameThreshold.
  34. * 1.15 PGW 29 Jun 00 Removed instnace varibale CarryOverAdaptionEnabled.
  35. * 1.14 PGW 27 Jun 00 Added QTargetModifier[]. Changes to CONFIG_TYPE2.
  36. * 1.13 JBB 30/05/00 Removed hard coded size limits
  37. * 1.12 JBB 22/05/00 Added OriginalDC support to remove max_fragments depends
  38. * 1.11 YX 13/04/00 Add function pointers for new optimizations
  39. * 1.10 YX 06/04/00 More buffers alligned MMX Fdct
  40. * 1.09 YX 20/03/00 32 Byte alligned buffers, Back to Integer Forward DCT
  41. * Additional Function pointers for optimized code
  42. * 1.08 PGW 17/03/00 Changes to support seperate Y and UV entropy tables.
  43. * Added PreProcFilterLevel to allow control of preprecessor
  44. * filter level.
  45. * 1.07 YX 09/03/00 Change to use floating point forward DCT
  46. * 1.06 PGW 17/12/99 Draw dib functionality removed.
  47. * 1.05 PGW 05/10/99 Remove some Windows dependancies for VFW compressor.
  48. * 1.04 PGW 20/07/99 Rate targeting corrections for VFW version of codec
  49. * 1.03 PGW 15/07/99 Added QuickCompress flag.
  50. * 1.02 PGW 05/07/99 Added GetFOURMVExhaustiveSearch() function
  51. * 1.01 PGW 29/06/99 Added GetMBMVExhaustiveSearch() function.
  52. * 1.00 PGW 14/06/99 Configuration baseline
  53. *
  54. *****************************************************************************
  55. */
  56. #ifndef __INC_COMPDLL_H
  57. #define __INC_COMPDLL_H
  58. #define MIN_BPB_FACTOR 0.1
  59. #define MAX_BPB_FACTOR 10.0
  60. #define KEY_FRAME_CONTEXT 5
  61. #include "codec_common.h"
  62. #include "preprocif.h"
  63. #include "preproc.h"
  64. #include "pbdll.h"
  65. #include "vp50_comp_interface.h"
  66. /****************************************************************************
  67. * Module constants.
  68. *****************************************************************************
  69. */
  70. // Debug/stats code
  71. //#define PSNR_ON
  72. /****************************************************************************
  73. * Types
  74. *****************************************************************************
  75. */
  76. typedef struct CONFIG_TYPE2
  77. {
  78. UINT32 TargetBandwidth;
  79. UINT32 OutputFrameRate;
  80. UINT32 FirstFrameQ;
  81. UINT32 BaseQ;
  82. UINT32 MaxQ; // Absolute Max Q allowed.
  83. UINT32 ActiveWorstQuality; // Reflects worst quality Currently allowed (specified as an index where 0 is worst quality)
  84. UINT32 ActiveBestQuality; // Reflects best quality currently allowed (specified as an index where 0 is worst quality)
  85. } CONFIG_TYPE2;
  86. /* Defines the largest positive integer expressable with a standard int type */
  87. /****************************************************************************
  88. * * Type declarations
  89. ****************************************************************************
  90. */
  91. typedef enum
  92. {
  93. DCT_COEF_TOKEN,
  94. MODE_TOKEN,
  95. BLOCKMAP_TOKEN,
  96. MV_TOKEN
  97. } TOKENTYPE;
  98. typedef struct _TOKENEXTRA
  99. {
  100. INT32 Token;
  101. UINT32 Extra;
  102. } TOKENEXTRA;
  103. typedef struct LineEq2
  104. {
  105. double M;
  106. double C;
  107. } LINE_EQ2;
  108. typedef struct
  109. {
  110. BLOCK_CONTEXTA * AbovePtr;
  111. BLOCK_CONTEXTA Above;
  112. BLOCK_CONTEXT * LeftPtr;
  113. BLOCK_CONTEXT Left;
  114. Q_LIST_ENTRY * LastDcPtr;
  115. Q_LIST_ENTRY LastDc;
  116. } MB_DC_CONTEXT;
  117. /****************************************************************************
  118. * MACROS
  119. *****************************************************************************
  120. */
  121. /****************************************************************************
  122. * Global Variables
  123. *****************************************************************************
  124. */
  125. //****************************************************************
  126. // Function Pointers now library globals!
  127. extern UINT32 (*GetSAD16)(UINT8 *, INT32, UINT8 *, INT32, UINT32, UINT32);
  128. extern UINT32 (*GetSadHalfPixel16)(UINT8 *, INT32, UINT8 *, UINT8 *, INT32, UINT32, UINT32);
  129. extern void (*fdct_short) ( INT16 * InputData, INT16 * OutputData );
  130. extern void (*idctc[65])( INT16 *InputData, INT16 *QuantMatrix, INT16 * OutputData );
  131. extern UINT32 (*GetSAD)(UINT8 *, INT32, UINT8 *, INT32, UINT32, UINT32) ;
  132. //extern UINT32 (*GetNextSAD)(UINT8 *, INT32, UINT8 *, UINT32, UINT32 );
  133. extern UINT32 (*GetSadHalfPixel)(UINT8 *, INT32, UINT8 *, UINT8 *, INT32, UINT32, UINT32 );
  134. extern UINT32 (*GetInterError)( UINT8 *, INT32, UINT8 *, UINT8 *, INT32 );
  135. extern UINT32 (*GetIntraError)( UINT8 *, INT32);
  136. extern void (*Sub8)( UINT8 *FiltPtr, UINT8 *ReconPtr, INT16 *DctInputPtr, UINT8 *old_ptr1, UINT8 *new_ptr1, INT32 SourceStride, INT32 ReconStride );
  137. extern void (*Sub8_128)( UINT8 *FiltPtr, INT16 *DctInputPtr, UINT8 *old_ptr1, UINT8 *new_ptr1, INT32 SourceStride );
  138. extern void (*Sub8Av2)( UINT8 *FiltPtr, UINT8 *ReconPtr1, UINT8 *ReconPtr2, INT16 *DctInputPtr, UINT8 *old_ptr1, UINT8 *new_ptr1, INT32 SourceStride, INT32 ReconStride );
  139. //****************************************************************
  140. #define HUGE_ERROR (1<<28) // Out of range test value
  141. #define MAX_SEARCH_SITES 33 // Number of search sites for a 4-step search (at pixel accuracy)
  142. typedef struct CP_INSTANCE * xCP_INST;
  143. typedef struct CP_INSTANCE
  144. {
  145. PB_INSTANCE pb; // playback
  146. INT32 DropCounter;
  147. //****************************************************************************************************
  148. // Compressor Configuration
  149. CONFIG_TYPE2 Configuration;
  150. YUV_BUFFER_CONFIG InputConfig;
  151. YUV_BUFFER_CONFIG YuvInputData;
  152. INT32 SizeStep;
  153. INT32 QuickCompress;
  154. BOOL GoldenFrameEnabled;
  155. BOOL InterPrediction;
  156. BOOL MotionCompensation;
  157. BOOL AutoKeyFrameEnabled ;
  158. INT32 ForceKeyFrameEvery ;
  159. INT32 AutoKeyFrameThreshold ;
  160. UINT32 LastKeyFrame ;
  161. UINT32 MinimumDistanceToKeyFrame ;
  162. INT32 KeyFrameDataTargetOrig ; // Data rate target for key frames
  163. INT32 KeyFrameDataTarget ; // Data rate target for key frames
  164. UINT32 KeyFrameFrequency ;
  165. BOOL DropFramesAllowed ;
  166. BOOL DropFrame;
  167. INT32 DropCount ;
  168. UINT32 QualitySetting;
  169. UINT32 PreProcFilterLevel;
  170. BOOL AllowSpatialResampling;
  171. UINT8 RdOpt; // 0 - off, 1 - basic rd on, 2 - all rd options on
  172. // Compressor Statistics
  173. double TotErrScore;
  174. UINT32 InterError;
  175. UINT32 MVErrorPerBit;
  176. UINT32 ErrorPerBit;
  177. UINT32 IntraError;
  178. INT64 KeyFrameCount ; // Count of key frames.
  179. INT64 TotKeyFrameBytes ;
  180. UINT32 LastKeyFrameSize ;
  181. UINT32 PriorKeyFrameSize[KEY_FRAME_CONTEXT];
  182. UINT32 PriorKeyFrameDistance[KEY_FRAME_CONTEXT];
  183. INT32 FrameQuality[6];
  184. int DecoderErrorCode; // Decoder error flag.
  185. INT32 ThreshMapThreshold;
  186. INT32 TotalMotionScore;
  187. INT64 TotalByteCount;
  188. INT32 FixedQ;
  189. // Frame Statistics
  190. INT64 CurrentFrame;
  191. UINT32 LastFrameSize;
  192. UINT32 ThisFrameSize;
  193. BOOL ThisIsFirstFrame;
  194. BOOL ThisIsKeyFrame;
  195. BOOL GfRecoveryFrame;
  196. INT32 MotionScore;
  197. UINT32 FirstSixthBoundary; // Macro block index marking the first sixth of the image
  198. UINT32 LastSixthBoundary; // Macro block index marking the last sixth of the image
  199. /* Rate Targeting variables PGW 08/05/96). */
  200. double BpbCorrectionFactor;
  201. double KeyFrameBpbCorrectionFactor;
  202. // Controlling Block Selection
  203. UINT32 MVChangeFactor;
  204. UINT32 FourMvChangeFactor;
  205. UINT32 ExhaustiveSearchThresh;
  206. UINT32 MinImprovementForFourMV;
  207. UINT32 FourMVThreshold;
  208. UINT32 IntraThresh;
  209. UINT32 MinErrorForMacroBlockMVSearch;
  210. UINT32 MinErrorForBlockMVSearch;
  211. UINT32 MinErrorForGoldenMVSearch;
  212. //****************************************************************************************************
  213. //****************************************************************************************************
  214. // Frames
  215. // Used in the selecetive convolution filtering of the Y plane. */
  216. YUV_BUFFER_ENTRY *yuv1ptr;
  217. YUV_BUFFER_ENTRY *yuv1ptrAlloc;
  218. //****************************************************************************************************
  219. //****************************************************************************************************
  220. // Token Buffers
  221. TOKENEXTRA *CoeffTokens;
  222. TOKENEXTRA *CoeffTokensAlloc;
  223. TOKENEXTRA *CoeffTokenPtr;
  224. INT16 LastDC[3];
  225. BOOL_CODER bc;
  226. //****************************************************************************************************
  227. //****************************************************************************************************
  228. // SuperBlock, MacroBLock and Fragment Information
  229. // Coded flag arrays and counters for them
  230. //****************************************************************************************************
  231. // Live Codec Variables
  232. UINT8 *DataOutputBuffer;
  233. //****************************************************************************************************
  234. //****************************************************************************************
  235. // STATICS COPIED FROM C FILES (USED IN MULTIPLE FUNCTIONS BUT ARE NOT REALLY INSTANCE GLOBALS )
  236. // copied from cencode.c
  237. UINT8 MBCodingMode; // Coding mode flags
  238. // copied from mcomp.c
  239. INT32 MVPixelOffsetY[MAX_SEARCH_SITES];
  240. UINT32 InterTripOutThresh;
  241. INT32 MVSearchSteps;
  242. INT32 MVOffsetX[MAX_SEARCH_SITES];
  243. INT32 MVOffsetY[MAX_SEARCH_SITES];
  244. INT32 HalfPixelRef2Offset[9]; // Offsets for half pixel compensation
  245. INT8 HalfPixelXOffset[9]; // Half pixel MV offsets for X
  246. INT8 HalfPixelYOffset[9]; // Half pixel MV offsets for Y
  247. Q_LIST_ENTRY *quantized_list;
  248. Q_LIST_ENTRY *quantized_listAlloc;
  249. MOTION_VECTOR MVector;
  250. INT16 *DCT_codes; //Buffer that stores the result of Forward DCT
  251. INT16 *DCTDataBuffer; //Input data buffer for Forward DCT
  252. INT16 *DCT_codesAlloc;
  253. INT16 *DCTDataBufferAlloc;
  254. // Motion compensation related variables
  255. UINT32 MvMaxExtent;
  256. INT32 byte_bit_offset;
  257. // copied from cbitman.c
  258. UINT32 NearestError[4];
  259. UINT32 NearError[4];
  260. UINT32 ZeroError[4];
  261. UINT32 BestError[4];
  262. UINT32 ErrorBins[128];
  263. //****************************************************************
  264. // instances (used for reconstructing buffers and to hold tokens etc.)
  265. xPP_INST pp; // preprocessor
  266. #if defined PSNR_ON
  267. double TotPsnr;
  268. double MinPsnr;
  269. double MaxPsnr;
  270. double TotYPsnr;
  271. double MinYPsnr;
  272. double MaxYPsnr;
  273. double TotUPsnr;
  274. double MinUPsnr;
  275. double MaxUPsnr;
  276. double TotVPsnr;
  277. double MinVPsnr;
  278. double MaxVPsnr;
  279. #endif
  280. // Structures for entropy contexts
  281. UINT32 FrameDcTokenDist[2][MAX_ENTROPY_TOKENS];
  282. UINT32 FrameAcTokenDist[PREC_CASES][2][VP5_AC_BANDS][MAX_ENTROPY_TOKENS];
  283. // Storage for the first frame entropy probabilities.
  284. // These are re-used for all subsequent key frames when we are operating in
  285. // error (drop frame) ressiliant mode.
  286. UINT8 FirstFrameDcProbs[2*(MAX_ENTROPY_TOKENS-1)];
  287. UINT8 FirstFrameAcProbs[2*PREC_CASES*VP5_AC_BANDS*(MAX_ENTROPY_TOKENS-1)];
  288. // The Plane Y or UV to which the current block belongs (0 = Y 1 = UV)
  289. UINT8 EncoderPlane;
  290. // Last token coded this block.
  291. UINT8 ThisBlockLastToken;
  292. UINT8 ZeroCount;
  293. //UINT32 MBModeCount[MAX_MODES+1];
  294. UINT32 MBModeCount[4][MAX_MODES+1];
  295. UINT32 BModeCount[MAX_MODES+1];
  296. UINT32 CountModeSameAsLast[4][MAX_MODES+1];
  297. UINT32 CountModeDiffFrLast[4][MAX_MODES+1];
  298. UINT32 ModeCodeArray[4][MAX_MODES+1][MAX_MODES+1];
  299. UINT8 ModeLengthArray[4][MAX_MODES+1][MAX_MODES+1];
  300. // TEMP
  301. UINT32 ModeBitCount[2];
  302. INT64 ModeComplexity[2];
  303. UINT32 ModeBlocks[2];
  304. UINT32 MBModeCostBoth[11];
  305. UINT32 MBModeCostNoNear[11];
  306. UINT32 MBModeCostNoNearest[11];
  307. UINT32 BModeCost[11];
  308. UINT32 MvBaselineDist[2][MV_ENTROPY_TOKENS];
  309. UINT32 FrameMvCount;
  310. UINT32 EstMVCost[2][MV_ENTROPY_TOKENS];
  311. UINT32 EstModeCost[2][MAX_MODES];
  312. UINT32 nExperimentals;
  313. INT32 Experimental[C_SET_EXPERIMENTAL_MAX - C_SET_EXPERIMENTAL_MIN + 1];
  314. // Bandwidth and buffer control variables
  315. INT32 PerFrameBandwidth; // Target for average bandwidth per frame.
  316. INT32 InterFrameTarget; // Average "inter" frame bit target corrected for key frame costs
  317. INT32 ThisFrameTarget; // Modified rate target for this frame
  318. BOOL BufferedMode; // FALSE = Tight buffering (Video Conferencing mode); TRUE = normal buffered/streaming mode.
  319. BOOL ErrorResilliantMode; // A mode used for VC etc. to make the codec more resilliant to dropped frames.
  320. INT32 StartingBufferLevel; // The initial encoder buffer level
  321. INT32 CurrentBufferLevel; // Current decoder buffer fullness state
  322. INT32 OptimalBufferLevel; // The buffer level target we strive to reach / maintain.
  323. INT32 DropFramesWaterMark; // Buffer fullness watermark for forced drop frames.
  324. INT32 ResampleDownWaterMark; // Buffer fullness watermark for downwards spacial re-sampling
  325. INT32 ResampleUpWaterMark; // Buffer fullness watermark where returning to larger image size is consdered
  326. INT32 LastKeyFrameBufferLevel; // Used to monitor changes in buffer level when considering re-sampling.
  327. INT32 Speed;
  328. INT32 CPUUsed;
  329. UINT32 ModeMvCostEstimate; // Running total of cost estimates for modes and MVs in this frame.
  330. // Variables used in regulating cost of new motion vectors based upon an estimate of new MV frequency.
  331. UINT32 FrameNewMvCounter;
  332. UINT32 FrameModeCounter;
  333. UINT32 MvEpbCorrection;
  334. UINT32 LastFrameNewMvUsage; // 0 = Low 9 = High
  335. UINT32 * MbBestErr;
  336. UINT32 * MbBestErrAlloc;
  337. UINT32 EstDcTokenCosts[2][MAX_ENTROPY_TOKENS];
  338. UINT32 EstAcTokenCosts[PREC_CASES][2][VP5_AC_BANDS][MAX_ENTROPY_TOKENS];
  339. // Data structures used to save and restor MB and DC contexts during rate distortion
  340. MACROBLOCK_INFO CopyMbi;
  341. BLOCK_CONTEXTA AboveCopyY[2];
  342. BLOCK_CONTEXTA AboveCopyU;
  343. BLOCK_CONTEXTA AboveCopyV;
  344. BLOCK_CONTEXT LeftYCopy[2];
  345. BLOCK_CONTEXT LeftUCopy;
  346. BLOCK_CONTEXT LeftVCopy;
  347. Q_LIST_ENTRY LastDcYCopy[3];
  348. Q_LIST_ENTRY LastDcUCopy[3];
  349. Q_LIST_ENTRY LastDcVCopy[3];
  350. // Above and left context for encoding
  351. UINT8 *aboveDcTokensAlloc[3]; // 0 for y, 1 for u and 2 for v
  352. UINT8 *aboveDcTokens[3]; // 0 for y, 1 for u and 2 for v
  353. UINT8 leftTokens[4][64]; // 0 1 for y 2 for u and 3 for v
  354. MB_DC_CONTEXT MbDcContexts[MAX_MODES][6]; // Per mode, per block position data structure for and MB
  355. UINT32 avgPickModeTime;
  356. UINT32 avgEncodeTime;
  357. UINT32 avgPackVideoTime;
  358. UINT32 ForceHScale;
  359. UINT32 ForceHRatio;
  360. UINT32 ForceVScale;
  361. UINT32 ForceVRatio;
  362. BOOL ForceInternalSize;
  363. PreProcInstance preproc;
  364. INT32 FrameRateInput;
  365. INT32 FrameRateDropFrames;
  366. INT32 FrameRateDropCount;
  367. //
  368. UINT32 EncoderLoopFilterOff;
  369. // variables for 5 region diamond MV search
  370. INT32 DSMVSearchSteps;
  371. INT32 DSMVPixelOffsetY[MAX_SEARCH_SITES];
  372. INT32 DSMVOffsetX[MAX_SEARCH_SITES];
  373. INT32 DSMVOffsetY[MAX_SEARCH_SITES];
  374. UINT32 (*FindMvViaSearch)( xCP_INST cpi,
  375. UINT8 *SrcPtr,
  376. INT32 SourceStride,
  377. UINT8 *RefPtr,
  378. INT32 ReconStride,
  379. MOTION_VECTOR *MV,
  380. UINT8 **BestBlockPtr,
  381. UINT32 BlockSize);
  382. void (*FindBestHalfPixelMv)(xCP_INST cpi,
  383. UINT8 *SrcPtr,
  384. INT32 SourceStride,
  385. UINT8 *RefPtr,
  386. INT32 ReconStride,
  387. MOTION_VECTOR *MV,
  388. UINT8 **BestBlockPtr,
  389. UINT32 BlockSize,
  390. UINT32 MinError);
  391. } CP_INSTANCE;
  392. UINT32 (*GetMBFrameVertVar)(CP_INSTANCE *cpi);
  393. UINT32 (*GetMBFieldVertVar)(CP_INSTANCE *cpi);
  394. /****************************************************************************
  395. * Functions.
  396. *****************************************************************************
  397. */
  398. extern void UpdateFrame(CP_INSTANCE *cpi);
  399. extern UINT32 QuadCodeDisplayFragments (CP_INSTANCE *cpi);
  400. extern UINT32 QuadCodeComponent ( CP_INSTANCE *cpi, UINT32 FirstSB, UINT32 SBRows, UINT32 SBCols, UINT32 HExtra, UINT32 VExtra, INT32 SourceStride );
  401. extern void AcquireSingleFrame( CP_INSTANCE *cpi, UINT32 CurrFrame );
  402. extern void AcquireFirstFrame(CP_INSTANCE *cpi);
  403. extern void AcquireNextFrame( CP_INSTANCE *cpi, UINT32 CurrFrame );
  404. extern void InitFrameTimer( CP_INSTANCE *cpi);
  405. extern UINT32 EncodeData(CP_INSTANCE *cpi);
  406. // Loop optimizations
  407. extern void InitMapArrays();
  408. // Codec
  409. extern UINT32 DPCMTokenizeBlock ( CP_INSTANCE *cpi, INT32 FragIndex, INT32 SourceStride );
  410. extern void SUB8( UINT8 *FiltPtr, UINT8 *ReconPtr, INT16 *DctInputPtr, UINT8 *old_ptr1, UINT8 *new_ptr1,
  411. INT32 SourceStride, INT32 ReconStride );
  412. extern void SUB8_128( UINT8 *FiltPtr, INT16 *DctInputPtr, UINT8 *old_ptr1, UINT8 *new_ptr1,
  413. INT32 SourceStride );
  414. extern void SUB8AV2( UINT8 *FiltPtr, UINT8 *ReconPtr1, UINT8 *ReconPtr2, INT16 *DctInputPtr, UINT8 *old_ptr1, UINT8 *new_ptr1,
  415. INT32 SourceStride, INT32 ReconStride );
  416. extern void PackEOBRun(CP_INSTANCE *cpi);
  417. extern void ConvertBmpToYUV( PB_INSTANCE *pbi, UINT8 * BmpDataPtr, UINT8 * YuvBufferPtr );
  418. extern CP_INSTANCE * CreateCPInstance(void);
  419. extern void DeleteCPInstance(CP_INSTANCE **cpi);
  420. extern void CMachineSpecificConfig(void);
  421. // extern void fdct_slow16 ( INT16 * InputData, INT16 * OutputData );
  422. extern void fdct_slowf ( INT16 * InputData, INT16 * OutputData );
  423. extern void fdct_short_C ( INT16 * InputData, INT16 * OutputData );
  424. extern void fdct_short_C ( INT16 * InputData, INT16 * OutputData );
  425. extern BOOL EAllocateFragmentInfo(CP_INSTANCE *cpi);
  426. extern BOOL EAllocateFrameInfo(CP_INSTANCE *cpi);
  427. extern void EDeleteFragmentInfo(CP_INSTANCE *cpi);
  428. extern void EDeleteFrameInfo(CP_INSTANCE *cpi);
  429. extern UINT32 PickIntra( CP_INSTANCE *cpi );
  430. extern UINT32 PickModes( CP_INSTANCE *cpi, UINT32 *InterError, UINT32 *IntraError);
  431. extern INT32 GetSpeckSumAbsDiffs( UINT8 * NewDataPtr, UINT8 * RefDataPtr,
  432. INT32 SourceStride, INT32 ErrorSoFar, INT32 BestSoFar );
  433. extern INT32 GetNextSpeckSumAbsDiffs( UINT8 * NewDataPtr, UINT8 * RefDataPtr,
  434. INT32 SourceStride, INT32 ErrorSoFar, INT32 BestSoFar );
  435. extern INT32 GetHalfPixelSpeckSumAbsDiffs( UINT8 * SrcData, UINT8 * RefDataPtr1, UINT8 * RefDataPtr2,
  436. INT32 SourceStride, INT32 ErrorSoFar, INT32 BestSoFar );
  437. extern void ClampAndUpdateQ ( CP_INSTANCE *cpi, UINT32 QIndex) ;
  438. // cx\generic\encodembs.c
  439. extern void EncodeFrameMbs(CP_INSTANCE *cpi);
  440. // cx\generic\vfw_comp_if.c
  441. extern void CCONV ChangeEncoderSize(CP_INSTANCE* cpi, UINT32 Width, UINT32 Height);
  442. extern void CopyOrResize(CP_INSTANCE* cpi);
  443. // cx\generic\tokenize.c
  444. extern UINT16 TokenizeFrag(CP_INSTANCE* cpi, INT16* RawData, UINT16 BlockSize, UINT32 Plane, BLOCK_CONTEXTA* Above, BLOCK_CONTEXT* Left);
  445. #endif