types.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /*
  2. * Copyright 1993-2010 NVIDIA Corporation. All rights reserved.
  3. *
  4. * Please refer to the NVIDIA end user license agreement (EULA) associated
  5. * with this source code for terms and conditions that govern your use of
  6. * this software. Any use, reproduction, disclosure, or distribution of
  7. * this software and related documentation outside the terms of the EULA
  8. * is strictly prohibited.
  9. *
  10. */
  11. #ifndef TYPES_H
  12. #define TYPES_H
  13. #include "NVEncodeDataTypes.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. struct NVEncoderParams {
  18. char configFile[256];
  19. char inputFile[256];
  20. char outputFile[256];
  21. int measure_psnr;
  22. int measure_fps;
  23. int force_device;
  24. int iSurfaceFormat;
  25. int iPictureType;
  26. int nDeviceMemPitch;
  27. int iCodecType; // NVVE_CODEC_TYPE,
  28. int GPU_count; // Choose the specific GPU count
  29. int GPU_devID; // Choose the specific GPU device ID
  30. int iUseDeviceMem; // CUDA with DEVICE_MEMORY_INPUT (for encoding)
  31. int iForcedGPU; // NVVE_FORCE_GPU_SELECTION //F22
  32. int iOutputSize[2]; // NVVE_OUT_SIZE,
  33. int iInputSize[2]; // NVVE_IN_SIZE,
  34. float fAspectRatio; //
  35. int iAspectRatio[3]; // NVVE_ASPECT_RATIO,
  36. NVVE_FIELD_MODE Fieldmode; // NVVE_FIELD_ENC_MODE,
  37. int iP_Interval; // NVVE_P_INTERVAL,
  38. int iIDR_Period; // NVVE_IDR_PERIOD,
  39. int iDynamicGOP; // NVVE_DYNAMIC_GOP,
  40. NVVE_RateCtrlType RCType; // NVVE_RC_TYPE,
  41. int iAvgBitrate; // NVVE_AVG_BITRATE,
  42. int iPeakBitrate; // NVVE_PEAK_BITRATE,
  43. int iQP_Level_Intra; // NVVE_QP_LEVEL_INTRA,
  44. int iQP_Level_InterP; // NVVE_QP_LEVEL_INTER_P,
  45. int iQP_Level_InterB; // NVVE_QP_LEVEL_INTER_B,
  46. int iFrameRate[2]; // NVVE_FRAME_RATE,
  47. int iDeblockMode; // NVVE_DEBLOCK_MODE,
  48. int iProfileLevel; // NVVE_PROFILE_LEVEL,
  49. int iForceIntra; // NVVE_FORCE_INTRA,
  50. int iForceIDR; // NVVE_FORCE_IDR,
  51. int iClearStat; // NVVE_CLEAR_STAT,
  52. NVVE_DI_MODE DIMode; // NVVE_SET_DEINTERLACE,
  53. NVVE_PRESETS_TARGET Presets; // NVVE_PRESETS,
  54. int iDisableCabac; // NVVE_DISABLE_CABAC,
  55. int iNaluFramingType; // NVVE_CONFIGURE_NALU_FRAMING_TYPE
  56. int iDisableSPSPPS; // NVVE_DISABLE_SPS_PPS
  57. NVVE_GPUOffloadLevel GPUOffloadLevel; // NVVE_GPU_OFFLOAD_LEVEL
  58. NVVE_GPUOffloadLevel MaxOffloadLevel; // NVVE_GPU_OFFLOAD_LEVEL_MAX
  59. int iSliceCnt; // NVVE_SLICE_COUNT //F19
  60. int iMultiGPU; // NVVE_MULTI_GPU //F21
  61. int iDeviceMemInput; // NVVE_DEVICE_MEMORY_INPUT //F23
  62. // NVVE_STAT_NUM_CODED_FRAMES,
  63. // NVVE_STAT_NUM_RECEIVED_FRAMES,
  64. // NVVE_STAT_BITRATE,
  65. // NVVE_STAT_NUM_BITS_GENERATED,
  66. // NVVE_GET_PTS_DIFF_TIME,
  67. // NVVE_GET_PTS_BASE_TIME,
  68. // NVVE_GET_PTS_CODED_TIME,
  69. // NVVE_GET_PTS_RECEIVED_TIME,
  70. // NVVE_STAT_ELAPSED_TIME,
  71. // NVVE_STAT_QBUF_FULLNESS,
  72. // NVVE_STAT_PERF_FPS,
  73. // NVVE_STAT_PERF_AVG_TIME,
  74. };
  75. typedef struct {
  76. char *name;
  77. char *yuv_type;
  78. int bpp;
  79. } _sYUVParams;
  80. static _sYUVParams sSurfaceFormat[] = {
  81. { "UYVY", "4:2:2", 16 },
  82. { "YUY2", "4:2:2", 16 },
  83. { "YV12", "4:2:0", 12 },
  84. { "NV12", "4:2:0", 12 },
  85. { "IYUV", "4:2:0", 12 },
  86. { NULL , 0 }
  87. };
  88. typedef struct {
  89. char *name;
  90. int params;
  91. } _sNVVEEncodeParams;
  92. static _sNVVEEncodeParams sNVVE_EncodeParams[] = {
  93. { "UNDEFINED", 1 },
  94. { "NVVE_OUT_SIZE", 2 },
  95. { "NVVE_ASPECT_RATIO", 3 },
  96. { "NVVE_FIELD_ENC_MODE", 1 },
  97. { "NVVE_P_INTERVAL", 1 },
  98. { "NVVE_IDR_PERIOD", 1 },
  99. { "NVVE_DYNAMIC_GOP", 1 },
  100. { "NVVE_RC_TYPE", 1 },
  101. { "NVVE_AVG_BITRATE", 1 },
  102. { "NVVE_PEAK_BITRATE", 1 },
  103. { "NVVE_QP_LEVEL_INTRA", 1 },
  104. { "NVVE_QP_LEVEL_INTER_P", 1 },
  105. { "NVVE_QP_LEVEL_INTER_B", 1 },
  106. { "NVVE_FRAME_RATE", 2 },
  107. { "NVVE_DEBLOCK_MODE", 1 },
  108. { "NVVE_PROFILE_LEVEL", 1 },
  109. { "NVVE_FORCE_INTRA (DS)", 1 }, //DShow only
  110. { "NVVE_FORCE_IDR (DS)", 1 }, //DShow only
  111. { "NVVE_CLEAR_STAT (DS)", 1 }, //DShow only
  112. { "NVVE_SET_DEINTERLACE", 1 },
  113. { "NVVE_PRESETS", 1 },
  114. { "NVVE_IN_SIZE", 2 },
  115. { "NVVE_STAT_NUM_CODED_FRAMES (DS)", 1 }, //DShow only
  116. { "NVVE_STAT_NUM_RECEIVED_FRAMES (DS)", 1 }, //DShow only
  117. { "NVVE_STAT_BITRATE (DS)", 1 }, //DShow only
  118. { "NVVE_STAT_NUM_BITS_GENERATED (DS)", 1 }, //DShow only
  119. { "NVVE_GET_PTS_DIFF_TIME (DS)", 1 }, //DShow only
  120. { "NVVE_GET_PTS_BASE_TIME (DS)", 1 }, //DShow only
  121. { "NVVE_GET_PTS_CODED_TIME (DS)", 1 }, //DShow only
  122. { "NVVE_GET_PTS_RECEIVED_TIME (DS)", 1 }, //DShow only
  123. { "NVVE_STAT_ELAPSED_TIME (DS)", 1 }, //DShow only
  124. { "NVVE_STAT_QBUF_FULLNESS (DS)", 1 }, //DShow only
  125. { "NVVE_STAT_PERF_FPS (DS)", 1 }, //DShow only
  126. { "NVVE_STAT_PERF_AVG_TIME (DS)", 1 }, //DShow only
  127. { "NVVE_DISABLE_CABAC", 1 },
  128. { "NVVE_CONFIGURE_NALU_FRAMING_TYPE", 1 },
  129. { "NVVE_DISABLE_SPS_PPS", 1 },
  130. { "NVVE_SLICE_COUNT", 1 },
  131. { "NVVE_GPU_OFFLOAD_LEVEL", 1 },
  132. { "NVVE_GPU_OFFLOAD_LEVEL_MAX", 1 },
  133. { "NVVE_MULTI_GPU", 1 },
  134. { "NVVE_GET_GPU_COUNT", 1 },
  135. { "NVVE_GET_GPU_ATTRIBUTES", 1 },
  136. { "NVVE_FORCE_GPU_SELECTION", 1 },
  137. { "NVVE_DEVICE_MEMORY_INPUT", 1 },
  138. { "NVVE_DEVICE_CTX_LOCK", 1 },
  139. { NULL, 0 }
  140. };
  141. static _sNVVEEncodeParams sProfileName[] = {
  142. { "Baseline", 0x42 },
  143. { "Main" , 0x4d },
  144. { "High" , 0x64 },
  145. { NULL , 0 }
  146. };
  147. static _sNVVEEncodeParams sProfileLevel[] = {
  148. { "1.0", 0x0a },
  149. { "1.1", 0x0b },
  150. { "1.2", 0x0c },
  151. { "1.3", 0x0d },
  152. { "2.0", 0x14 },
  153. { "2.1", 0x15 },
  154. { "2.2", 0x16 },
  155. { "3.0", 0x1e },
  156. { "3.1", 0x1f },
  157. { "3.2", 0x20 },
  158. { "4.0", 0x28 },
  159. { "4.1", 0x29 },
  160. { "4.2", 0x29 },
  161. { "5.0", 0x32 },
  162. { "5.1", 0x33 },
  163. { "Auto", 0xff },
  164. { NULL , 0 }
  165. };
  166. inline char * sProfileIDX2Char(_sNVVEEncodeParams *pProfile, int ID)
  167. {
  168. int index;
  169. for (index = 0; pProfile[index].name != NULL; index++) {
  170. if (pProfile[index].params == ID) {
  171. // found the profile return the string
  172. return pProfile[index].name;
  173. }
  174. }
  175. return NULL;
  176. }
  177. static char *sVideoEncodePresets[] = {
  178. "PSP ( 320x 240)",
  179. "iPod/iPhone ( 320x 240)",
  180. "AVCHD",
  181. "BluRay",
  182. "HDV_1440",
  183. "ZuneHD",
  184. "FlipCam",
  185. NULL
  186. };
  187. static char *sGPUOffloadLevel[] = {
  188. "CPU PEL processing",
  189. "Motion Estimation",
  190. "Full Encode",
  191. NULL
  192. };
  193. static char *sPictureType[] = {
  194. "Frame Mode",
  195. "Field Mode (top first)",
  196. "Field Mode (bottom first)",
  197. "Field Mode (picaff) unsupported",
  198. NULL
  199. };
  200. static char *sPictureStructure[] = {
  201. "Unknown",
  202. "Top Field",
  203. "Bottom Field",
  204. "Frame Picture",
  205. NULL
  206. };
  207. // Rate Control Method (NVVE_RC_TYPE)
  208. static char *sNVVE_RateCtrlType[] = {
  209. "Rate Control CQP",
  210. "Rate Control VBR",
  211. "Rate Control CBR with QP",
  212. "Rate Control VBR with Min QP",
  213. NULL
  214. };
  215. #ifdef __cplusplus
  216. }
  217. #endif
  218. #endif