1
0

vp60_comp_interface.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /****************************************************************************
  2. *
  3. * Module Title : vp60_comp_interface.h
  4. *
  5. * Description : Interface to VP60 compressor.
  6. *
  7. ****************************************************************************/
  8. #ifndef __INC_VP60_COMP_INTERFACE_H
  9. #define __INC_VP60_COMP_INTERFACE_H
  10. #ifdef _MSC_VER
  11. #pragma warning(disable: 4514) // Disable warning 4514: Unreferenced inline function
  12. #endif
  13. /****************************************************************************
  14. * Header Files
  15. ****************************************************************************/
  16. #include "codec_common_interface.h"
  17. #include "type_aliases.h"
  18. #include "string.h"
  19. #define DEFAULT_VALUE -999
  20. /****************************************************************************
  21. * Typedefs
  22. ****************************************************************************/
  23. typedef enum
  24. {
  25. USAGE_STREAM_FROM_SERVER = 0x0, // INTER prediction, (0,0) motion vector implied.
  26. USAGE_LOCAL_FILE_PLAYBACK = 0x1 // INTER prediction, (0,0) motion vector implied.
  27. } END_USAGE;
  28. typedef enum
  29. {
  30. MODE_REALTIME = 0x0,
  31. MODE_GOODQUALITY = 0x1,
  32. MODE_BESTQUALITY = 0x2,
  33. MODE_FIRSTPASS = 0x3,
  34. MODE_SECONDPASS = 0x4,
  35. MODE_SECONDPASS_BEST= 0x5
  36. } MODE;
  37. /* Command interface to compressor */
  38. typedef struct
  39. {
  40. //UINT32 FourCC;
  41. //UINT32 ConfigVersion;
  42. UINT32 FrameSize;
  43. UINT32 TargetBitRate;
  44. UINT32 FrameRate;
  45. UINT32 KeyFrameFrequency;
  46. UINT32 KeyFrameDataTarget;
  47. UINT32 Quality;
  48. BOOL AllowDF;
  49. BOOL QuickCompress;
  50. BOOL AutoKeyFrameEnabled;
  51. INT32 AutoKeyFrameThreshold;
  52. UINT32 MinimumDistanceToKeyFrame;
  53. INT32 ForceKeyFrameEvery;
  54. INT32 NoiseSensitivity;
  55. BOOL AllowSpatialResampling;
  56. // The Intended Horizontal Scale
  57. UINT32 HScale;
  58. UINT32 HRatio;
  59. // The Intended Vertical Scale
  60. UINT32 VScale;
  61. UINT32 VRatio;
  62. // The way in which we intended
  63. UINT32 ScalingMode;
  64. // Interlaced (0) means no (1) means Yes
  65. UINT32 Interlaced;
  66. BOOL FixedQ;
  67. INT32 StartingBufferLevel; // The initial encoder buffer level
  68. INT32 OptimalBufferLevel; // The buffer level target we strive to reach / maintain.
  69. INT32 DropFramesWaterMark; // Buffer fullness watermark for forced drop frames.
  70. INT32 ResampleDownWaterMark; // Buffer fullness watermark for downwards spacial re-sampling
  71. INT32 ResampleUpWaterMark; // Buffer fullness watermark where returning to larger image size is consdered
  72. INT32 OutputFrameRate;
  73. INT32 Speed;
  74. BOOL ErrorResilientMode; // compress using a mode that won't completely fall apart if we decompress using
  75. // the frame after a dropped frame
  76. INT32 Profile;
  77. BOOL DisableGolden; // disable golden frame updates
  78. BOOL VBMode; // run in variable bandwidth 1 pass mode
  79. UINT32 BestAllowedQ; // best allowed quality ( save bits by disallowings frames that are too high quality )
  80. INT32 UnderShootPct; // target a percentage of the actual frame to allow for sections that go over
  81. INT32 MaxAllowedDatarate; // maximum the datarate is allowed to go.
  82. INT32 MaximumBufferSize; // maximum buffer size.
  83. BOOL TwoPassVBREnabled; // two pass variable bandwidth enabled
  84. INT32 TwoPassVBRBias; // how variable do we want to target?
  85. INT32 TwoPassVBRMaxSection; // maximum
  86. INT32 TwoPassVBRMinSection; // minimum
  87. INT32 Pass; // which pass of the compression are we running.
  88. MODE Mode;
  89. END_USAGE EndUsage;
  90. char FirstPassFile[512];
  91. char SettingsFile[512];
  92. char RootDirectory[512];
  93. INT32 PlaceHolder;
  94. INT32 DeleteFirstPassFile;
  95. INT32 Sharpness;
  96. } COMP_CONFIG_VP6;
  97. typedef struct
  98. {
  99. int YWidth;
  100. int YHeight;
  101. int YStride;
  102. int UVWidth;
  103. int UVHeight;
  104. int UVStride;
  105. char *YBuffer;
  106. char *UBuffer;
  107. char *VBuffer;
  108. } YUV_INPUT_BUFFER_CONFIG;
  109. /****************************************************************************
  110. * Functions
  111. ****************************************************************************/
  112. #ifdef _MSC_VER
  113. _inline
  114. void comp_config_default_vp6 ( COMP_CONFIG_VP6* pcc )
  115. {
  116. pcc->FrameSize = 0; // No default value
  117. pcc->TargetBitRate = 300;
  118. pcc->FrameRate = 0; // No default value
  119. pcc->KeyFrameFrequency = 120;
  120. pcc->KeyFrameDataTarget = 0; // No default value
  121. pcc->Quality = 56;
  122. pcc->AllowDF = 0;
  123. pcc->AutoKeyFrameEnabled = 1;
  124. pcc->AutoKeyFrameThreshold = 80;
  125. pcc->MinimumDistanceToKeyFrame = 4;
  126. pcc->ForceKeyFrameEvery = 120;
  127. pcc->NoiseSensitivity = 0;
  128. pcc->AllowSpatialResampling = 0;
  129. pcc->HScale = 1;
  130. pcc->HRatio = 1;
  131. pcc->VScale = 1;
  132. pcc->VRatio = 1;
  133. pcc->ScalingMode = MAINTAIN_ASPECT_RATIO;
  134. pcc->Interlaced = 0;
  135. pcc->FixedQ = 0;
  136. pcc->StartingBufferLevel = 4;
  137. pcc->OptimalBufferLevel = 5;
  138. pcc->DropFramesWaterMark = 20;
  139. pcc->ResampleDownWaterMark = 35;
  140. pcc->ResampleUpWaterMark = 45;
  141. pcc->OutputFrameRate = 30;
  142. pcc->Speed = 4;
  143. pcc->ErrorResilientMode = FALSE;
  144. pcc->Profile = 0;
  145. pcc->DisableGolden = 0;
  146. pcc->BestAllowedQ = 4;
  147. pcc->UnderShootPct = 90;
  148. pcc->MaxAllowedDatarate = 100;
  149. pcc->MaximumBufferSize = 6;
  150. pcc->TwoPassVBRBias = 70;
  151. pcc->TwoPassVBRMaxSection = 400;
  152. pcc->TwoPassVBRMinSection = 40;
  153. pcc->Mode = MODE_GOODQUALITY;
  154. pcc->EndUsage = USAGE_STREAM_FROM_SERVER;
  155. // DEFAULT means default value as determined by mode and endusage
  156. pcc->QuickCompress = DEFAULT_VALUE;
  157. pcc->Pass = DEFAULT_VALUE;
  158. pcc->VBMode = DEFAULT_VALUE;
  159. pcc->TwoPassVBREnabled = DEFAULT_VALUE;
  160. pcc->SettingsFile[0] = 0;
  161. pcc->RootDirectory[0] = 0;
  162. pcc->Sharpness = 5;
  163. strncpy(pcc->FirstPassFile,"firstpass.fpf",512);
  164. //pcc->FourCC = '06PV';
  165. //pcc->ConfigVersion = 4;
  166. return;
  167. }
  168. #endif
  169. #endif