nvEncodeAPI.h 272 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288
  1. /*
  2. * This copyright notice applies to this header file only:
  3. *
  4. * Copyright (c) 2010-2022 NVIDIA Corporation
  5. *
  6. * Permission is hereby granted, free of charge, to any person
  7. * obtaining a copy of this software and associated documentation
  8. * files (the "Software"), to deal in the Software without
  9. * restriction, including without limitation the rights to use,
  10. * copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the software, and to permit persons to whom the
  12. * software is furnished to do so, subject to the following
  13. * conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be
  16. * included in all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  19. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  20. * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  21. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  22. * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  23. * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  24. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  25. * OTHER DEALINGS IN THE SOFTWARE.
  26. */
  27. /**
  28. * \file nvEncodeAPI.h
  29. * NVIDIA GPUs - beginning with the Kepler generation - contain a hardware-based encoder
  30. * (referred to as NVENC) which provides fully-accelerated hardware-based video encoding.
  31. * NvEncodeAPI provides the interface for NVIDIA video encoder (NVENC).
  32. * \date 2011-2022
  33. * This file contains the interface constants, structure definitions and function prototypes.
  34. */
  35. #ifndef _NV_ENCODEAPI_H_
  36. #define _NV_ENCODEAPI_H_
  37. #include <stdlib.h>
  38. #ifdef _WIN32
  39. #include <windows.h>
  40. #endif
  41. #ifdef _MSC_VER
  42. #ifndef _STDINT
  43. typedef __int32 int32_t;
  44. typedef unsigned __int32 uint32_t;
  45. typedef __int64 int64_t;
  46. typedef unsigned __int64 uint64_t;
  47. typedef signed char int8_t;
  48. typedef unsigned char uint8_t;
  49. typedef short int16_t;
  50. typedef unsigned short uint16_t;
  51. #endif
  52. #else
  53. #include <stdint.h>
  54. #endif
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif
  58. /**
  59. * \addtogroup ENCODER_STRUCTURE NvEncodeAPI Data structures
  60. * @{
  61. */
  62. #ifdef _WIN32
  63. #define NVENCAPI __stdcall
  64. typedef RECT NVENC_RECT;
  65. #else
  66. #define NVENCAPI
  67. // =========================================================================================
  68. #ifndef GUID_DEFINED
  69. #define GUID_DEFINED
  70. /*!
  71. * \struct GUID
  72. * Abstracts the GUID structure for non-windows platforms.
  73. */
  74. // =========================================================================================
  75. typedef struct _GUID
  76. {
  77. uint32_t Data1; /**< [in]: Specifies the first 8 hexadecimal digits of the GUID. */
  78. uint16_t Data2; /**< [in]: Specifies the first group of 4 hexadecimal digits. */
  79. uint16_t Data3; /**< [in]: Specifies the second group of 4 hexadecimal digits. */
  80. uint8_t Data4[8]; /**< [in]: Array of 8 bytes. The first 2 bytes contain the third group of 4 hexadecimal digits.
  81. The remaining 6 bytes contain the final 12 hexadecimal digits. */
  82. } GUID, *LPGUID;
  83. #endif // GUID
  84. /**
  85. * \struct _NVENC_RECT
  86. * Defines a Rectangle. Used in ::NV_ENC_PREPROCESS_FRAME.
  87. */
  88. typedef struct _NVENC_RECT
  89. {
  90. uint32_t left; /**< [in]: X coordinate of the upper left corner of rectangular area to be specified. */
  91. uint32_t top; /**< [in]: Y coordinate of the upper left corner of the rectangular area to be specified. */
  92. uint32_t right; /**< [in]: X coordinate of the bottom right corner of the rectangular area to be specified. */
  93. uint32_t bottom; /**< [in]: Y coordinate of the bottom right corner of the rectangular area to be specified. */
  94. } NVENC_RECT;
  95. #endif // _WIN32
  96. /** @} */ /* End of GUID and NVENC_RECT structure grouping*/
  97. typedef void* NV_ENC_INPUT_PTR; /**< NVENCODE API input buffer */
  98. typedef void* NV_ENC_OUTPUT_PTR; /**< NVENCODE API output buffer*/
  99. typedef void* NV_ENC_REGISTERED_PTR; /**< A Resource that has been registered with NVENCODE API*/
  100. typedef void* NV_ENC_CUSTREAM_PTR; /**< Pointer to CUstream*/
  101. #define NVENCAPI_MAJOR_VERSION 12
  102. #define NVENCAPI_MINOR_VERSION 0
  103. #define NVENCAPI_VERSION (NVENCAPI_MAJOR_VERSION | (NVENCAPI_MINOR_VERSION << 24))
  104. /**
  105. * Macro to generate per-structure version for use with API.
  106. */
  107. #define NVENCAPI_STRUCT_VERSION(ver) ((uint32_t)NVENCAPI_VERSION | ((ver)<<16) | (0x7 << 28))
  108. #define NVENC_INFINITE_GOPLENGTH 0xffffffff
  109. #define NV_MAX_SEQ_HDR_LEN (512)
  110. #ifdef __GNUC__
  111. #define NV_ENC_DEPRECATED __attribute__ ((deprecated("WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION")))
  112. #elif defined(_MSC_VER)
  113. #define NV_ENC_DEPRECATED __declspec(deprecated("WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION"))
  114. #endif
  115. // All use of the AV1 encode structures in the source code is guarded by the compilation variable
  116. // below. Set it to 0 to disable and hide the AV1 driver code.
  117. #define NVENCAPI_AV1_STRUCTURES_DEFINED 1
  118. // =========================================================================================
  119. // Encode Codec GUIDS supported by the NvEncodeAPI interface.
  120. // =========================================================================================
  121. // {6BC82762-4E63-4ca4-AA85-1E50F321F6BF}
  122. static const GUID NV_ENC_CODEC_H264_GUID =
  123. { 0x6bc82762, 0x4e63, 0x4ca4, { 0xaa, 0x85, 0x1e, 0x50, 0xf3, 0x21, 0xf6, 0xbf } };
  124. // {790CDC88-4522-4d7b-9425-BDA9975F7603}
  125. static const GUID NV_ENC_CODEC_HEVC_GUID =
  126. { 0x790cdc88, 0x4522, 0x4d7b, { 0x94, 0x25, 0xbd, 0xa9, 0x97, 0x5f, 0x76, 0x3 } };
  127. // {0A352289-0AA7-4759-862D-5D15CD16D254}
  128. static const GUID NV_ENC_CODEC_AV1_GUID =
  129. { 0x0a352289, 0x0aa7, 0x4759, { 0x86, 0x2d, 0x5d, 0x15, 0xcd, 0x16, 0xd2, 0x54 } };
  130. // =========================================================================================
  131. // * Encode Profile GUIDS supported by the NvEncodeAPI interface.
  132. // =========================================================================================
  133. // {BFD6F8E7-233C-4341-8B3E-4818523803F4}
  134. static const GUID NV_ENC_CODEC_PROFILE_AUTOSELECT_GUID =
  135. { 0xbfd6f8e7, 0x233c, 0x4341, { 0x8b, 0x3e, 0x48, 0x18, 0x52, 0x38, 0x3, 0xf4 } };
  136. // {0727BCAA-78C4-4c83-8C2F-EF3DFF267C6A}
  137. static const GUID NV_ENC_H264_PROFILE_BASELINE_GUID =
  138. { 0x727bcaa, 0x78c4, 0x4c83, { 0x8c, 0x2f, 0xef, 0x3d, 0xff, 0x26, 0x7c, 0x6a } };
  139. // {60B5C1D4-67FE-4790-94D5-C4726D7B6E6D}
  140. static const GUID NV_ENC_H264_PROFILE_MAIN_GUID =
  141. { 0x60b5c1d4, 0x67fe, 0x4790, { 0x94, 0xd5, 0xc4, 0x72, 0x6d, 0x7b, 0x6e, 0x6d } };
  142. // {E7CBC309-4F7A-4b89-AF2A-D537C92BE310}
  143. static const GUID NV_ENC_H264_PROFILE_HIGH_GUID =
  144. { 0xe7cbc309, 0x4f7a, 0x4b89, { 0xaf, 0x2a, 0xd5, 0x37, 0xc9, 0x2b, 0xe3, 0x10 } };
  145. // {7AC663CB-A598-4960-B844-339B261A7D52}
  146. static const GUID NV_ENC_H264_PROFILE_HIGH_444_GUID =
  147. { 0x7ac663cb, 0xa598, 0x4960, { 0xb8, 0x44, 0x33, 0x9b, 0x26, 0x1a, 0x7d, 0x52 } };
  148. // {40847BF5-33F7-4601-9084-E8FE3C1DB8B7}
  149. static const GUID NV_ENC_H264_PROFILE_STEREO_GUID =
  150. { 0x40847bf5, 0x33f7, 0x4601, { 0x90, 0x84, 0xe8, 0xfe, 0x3c, 0x1d, 0xb8, 0xb7 } };
  151. // {B405AFAC-F32B-417B-89C4-9ABEED3E5978}
  152. static const GUID NV_ENC_H264_PROFILE_PROGRESSIVE_HIGH_GUID =
  153. { 0xb405afac, 0xf32b, 0x417b, { 0x89, 0xc4, 0x9a, 0xbe, 0xed, 0x3e, 0x59, 0x78 } };
  154. // {AEC1BD87-E85B-48f2-84C3-98BCA6285072}
  155. static const GUID NV_ENC_H264_PROFILE_CONSTRAINED_HIGH_GUID =
  156. { 0xaec1bd87, 0xe85b, 0x48f2, { 0x84, 0xc3, 0x98, 0xbc, 0xa6, 0x28, 0x50, 0x72 } };
  157. // {B514C39A-B55B-40fa-878F-F1253B4DFDEC}
  158. static const GUID NV_ENC_HEVC_PROFILE_MAIN_GUID =
  159. { 0xb514c39a, 0xb55b, 0x40fa, { 0x87, 0x8f, 0xf1, 0x25, 0x3b, 0x4d, 0xfd, 0xec } };
  160. // {fa4d2b6c-3a5b-411a-8018-0a3f5e3c9be5}
  161. static const GUID NV_ENC_HEVC_PROFILE_MAIN10_GUID =
  162. { 0xfa4d2b6c, 0x3a5b, 0x411a, { 0x80, 0x18, 0x0a, 0x3f, 0x5e, 0x3c, 0x9b, 0xe5 } };
  163. // For HEVC Main 444 8 bit and HEVC Main 444 10 bit profiles only
  164. // {51ec32b5-1b4c-453c-9cbd-b616bd621341}
  165. static const GUID NV_ENC_HEVC_PROFILE_FREXT_GUID =
  166. { 0x51ec32b5, 0x1b4c, 0x453c, { 0x9c, 0xbd, 0xb6, 0x16, 0xbd, 0x62, 0x13, 0x41 } };
  167. // {5f2a39f5-f14e-4f95-9a9e-b76d568fcf97}
  168. static const GUID NV_ENC_AV1_PROFILE_MAIN_GUID =
  169. { 0x5f2a39f5, 0xf14e, 0x4f95, { 0x9a, 0x9e, 0xb7, 0x6d, 0x56, 0x8f, 0xcf, 0x97 } };
  170. // {7c718f81-abb7-4a0e-afe4-c88bab957997}
  171. static const GUID NV_ENC_AV1_PROFILE_HIGH_GUID =
  172. { 0x7c718f81, 0xabb7, 0x4a0e, { 0xaf, 0xe4, 0xc8, 0x8b, 0xab, 0x95, 0x79, 0x97 } };
  173. // =========================================================================================
  174. // * Preset GUIDS supported by the NvEncodeAPI interface.
  175. // =========================================================================================
  176. // {B2DFB705-4EBD-4C49-9B5F-24A777D3E587}
  177. NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_DEFAULT_GUID =
  178. { 0xb2dfb705, 0x4ebd, 0x4c49, { 0x9b, 0x5f, 0x24, 0xa7, 0x77, 0xd3, 0xe5, 0x87 } };
  179. // {60E4C59F-E846-4484-A56D-CD45BE9FDDF6}
  180. NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_HP_GUID =
  181. { 0x60e4c59f, 0xe846, 0x4484, { 0xa5, 0x6d, 0xcd, 0x45, 0xbe, 0x9f, 0xdd, 0xf6 } };
  182. // {34DBA71D-A77B-4B8F-9C3E-B6D5DA24C012}
  183. NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_HQ_GUID =
  184. { 0x34dba71d, 0xa77b, 0x4b8f, { 0x9c, 0x3e, 0xb6, 0xd5, 0xda, 0x24, 0xc0, 0x12 } };
  185. // {82E3E450-BDBB-4e40-989C-82A90DF9EF32}
  186. NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_BD_GUID =
  187. { 0x82e3e450, 0xbdbb, 0x4e40, { 0x98, 0x9c, 0x82, 0xa9, 0xd, 0xf9, 0xef, 0x32 } };
  188. // {49DF21C5-6DFA-4feb-9787-6ACC9EFFB726}
  189. NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_DEFAULT_GUID =
  190. { 0x49df21c5, 0x6dfa, 0x4feb, { 0x97, 0x87, 0x6a, 0xcc, 0x9e, 0xff, 0xb7, 0x26 } };
  191. // {C5F733B9-EA97-4cf9-BEC2-BF78A74FD105}
  192. NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_HQ_GUID =
  193. { 0xc5f733b9, 0xea97, 0x4cf9, { 0xbe, 0xc2, 0xbf, 0x78, 0xa7, 0x4f, 0xd1, 0x5 } };
  194. // {67082A44-4BAD-48FA-98EA-93056D150A58}
  195. NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_HP_GUID =
  196. { 0x67082a44, 0x4bad, 0x48fa, { 0x98, 0xea, 0x93, 0x5, 0x6d, 0x15, 0xa, 0x58 } };
  197. // {D5BFB716-C604-44e7-9BB8-DEA5510FC3AC}
  198. NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID =
  199. { 0xd5bfb716, 0xc604, 0x44e7, { 0x9b, 0xb8, 0xde, 0xa5, 0x51, 0xf, 0xc3, 0xac } };
  200. // {149998E7-2364-411d-82EF-179888093409}
  201. NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOSSLESS_HP_GUID =
  202. { 0x149998e7, 0x2364, 0x411d, { 0x82, 0xef, 0x17, 0x98, 0x88, 0x9, 0x34, 0x9 } };
  203. // Performance degrades and quality improves as we move from P1 to P7. Presets P3 to P7 for H264 and Presets P2 to P7 for HEVC have B frames enabled by default
  204. // for HIGH_QUALITY and LOSSLESS tuning info, and will not work with Weighted Prediction enabled. In case Weighted Prediction is required, disable B frames by
  205. // setting frameIntervalP = 1
  206. // {FC0A8D3E-45F8-4CF8-80C7-298871590EBF}
  207. static const GUID NV_ENC_PRESET_P1_GUID =
  208. { 0xfc0a8d3e, 0x45f8, 0x4cf8, { 0x80, 0xc7, 0x29, 0x88, 0x71, 0x59, 0xe, 0xbf } };
  209. // {F581CFB8-88D6-4381-93F0-DF13F9C27DAB}
  210. static const GUID NV_ENC_PRESET_P2_GUID =
  211. { 0xf581cfb8, 0x88d6, 0x4381, { 0x93, 0xf0, 0xdf, 0x13, 0xf9, 0xc2, 0x7d, 0xab } };
  212. // {36850110-3A07-441F-94D5-3670631F91F6}
  213. static const GUID NV_ENC_PRESET_P3_GUID =
  214. { 0x36850110, 0x3a07, 0x441f, { 0x94, 0xd5, 0x36, 0x70, 0x63, 0x1f, 0x91, 0xf6 } };
  215. // {90A7B826-DF06-4862-B9D2-CD6D73A08681}
  216. static const GUID NV_ENC_PRESET_P4_GUID =
  217. { 0x90a7b826, 0xdf06, 0x4862, { 0xb9, 0xd2, 0xcd, 0x6d, 0x73, 0xa0, 0x86, 0x81 } };
  218. // {21C6E6B4-297A-4CBA-998F-B6CBDE72ADE3}
  219. static const GUID NV_ENC_PRESET_P5_GUID =
  220. { 0x21c6e6b4, 0x297a, 0x4cba, { 0x99, 0x8f, 0xb6, 0xcb, 0xde, 0x72, 0xad, 0xe3 } };
  221. // {8E75C279-6299-4AB6-8302-0B215A335CF5}
  222. static const GUID NV_ENC_PRESET_P6_GUID =
  223. { 0x8e75c279, 0x6299, 0x4ab6, { 0x83, 0x2, 0xb, 0x21, 0x5a, 0x33, 0x5c, 0xf5 } };
  224. // {84848C12-6F71-4C13-931B-53E283F57974}
  225. static const GUID NV_ENC_PRESET_P7_GUID =
  226. { 0x84848c12, 0x6f71, 0x4c13, { 0x93, 0x1b, 0x53, 0xe2, 0x83, 0xf5, 0x79, 0x74 } };
  227. /**
  228. * \addtogroup ENCODER_STRUCTURE NvEncodeAPI Data structures
  229. * @{
  230. */
  231. /**
  232. * Input frame encode modes
  233. */
  234. typedef enum _NV_ENC_PARAMS_FRAME_FIELD_MODE
  235. {
  236. NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME = 0x01, /**< Frame mode */
  237. NV_ENC_PARAMS_FRAME_FIELD_MODE_FIELD = 0x02, /**< Field mode */
  238. NV_ENC_PARAMS_FRAME_FIELD_MODE_MBAFF = 0x03 /**< MB adaptive frame/field */
  239. } NV_ENC_PARAMS_FRAME_FIELD_MODE;
  240. /**
  241. * Rate Control Modes
  242. */
  243. typedef enum _NV_ENC_PARAMS_RC_MODE
  244. {
  245. NV_ENC_PARAMS_RC_CONSTQP = 0x0, /**< Constant QP mode */
  246. NV_ENC_PARAMS_RC_VBR = 0x1, /**< Variable bitrate mode */
  247. NV_ENC_PARAMS_RC_CBR = 0x2, /**< Constant bitrate mode */
  248. NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ = 0x8, /**< Deprecated, use NV_ENC_PARAMS_RC_CBR + NV_ENC_TWO_PASS_QUARTER_RESOLUTION / NV_ENC_TWO_PASS_FULL_RESOLUTION +
  249. lowDelayKeyFrameScale=1 */
  250. NV_ENC_PARAMS_RC_CBR_HQ = 0x10, /**< Deprecated, use NV_ENC_PARAMS_RC_CBR + NV_ENC_TWO_PASS_QUARTER_RESOLUTION / NV_ENC_TWO_PASS_FULL_RESOLUTION */
  251. NV_ENC_PARAMS_RC_VBR_HQ = 0x20 /**< Deprecated, use NV_ENC_PARAMS_RC_VBR + NV_ENC_TWO_PASS_QUARTER_RESOLUTION / NV_ENC_TWO_PASS_FULL_RESOLUTION */
  252. } NV_ENC_PARAMS_RC_MODE;
  253. /**
  254. * Multi Pass encoding
  255. */
  256. typedef enum _NV_ENC_MULTI_PASS
  257. {
  258. NV_ENC_MULTI_PASS_DISABLED = 0x0, /**< Single Pass */
  259. NV_ENC_TWO_PASS_QUARTER_RESOLUTION = 0x1, /**< Two Pass encoding is enabled where first Pass is quarter resolution */
  260. NV_ENC_TWO_PASS_FULL_RESOLUTION = 0x2, /**< Two Pass encoding is enabled where first Pass is full resolution */
  261. } NV_ENC_MULTI_PASS;
  262. /**
  263. * Emphasis Levels
  264. */
  265. typedef enum _NV_ENC_EMPHASIS_MAP_LEVEL
  266. {
  267. NV_ENC_EMPHASIS_MAP_LEVEL_0 = 0x0, /**< Emphasis Map Level 0, for zero Delta QP value */
  268. NV_ENC_EMPHASIS_MAP_LEVEL_1 = 0x1, /**< Emphasis Map Level 1, for very low Delta QP value */
  269. NV_ENC_EMPHASIS_MAP_LEVEL_2 = 0x2, /**< Emphasis Map Level 2, for low Delta QP value */
  270. NV_ENC_EMPHASIS_MAP_LEVEL_3 = 0x3, /**< Emphasis Map Level 3, for medium Delta QP value */
  271. NV_ENC_EMPHASIS_MAP_LEVEL_4 = 0x4, /**< Emphasis Map Level 4, for high Delta QP value */
  272. NV_ENC_EMPHASIS_MAP_LEVEL_5 = 0x5 /**< Emphasis Map Level 5, for very high Delta QP value */
  273. } NV_ENC_EMPHASIS_MAP_LEVEL;
  274. /**
  275. * QP MAP MODE
  276. */
  277. typedef enum _NV_ENC_QP_MAP_MODE
  278. {
  279. NV_ENC_QP_MAP_DISABLED = 0x0, /**< Value in NV_ENC_PIC_PARAMS::qpDeltaMap have no effect. */
  280. NV_ENC_QP_MAP_EMPHASIS = 0x1, /**< Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as Emphasis level. Currently this is only supported for H264 */
  281. NV_ENC_QP_MAP_DELTA = 0x2, /**< Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as QP delta map. */
  282. NV_ENC_QP_MAP = 0x3, /**< Currently This is not supported. Value in NV_ENC_PIC_PARAMS::qpDeltaMap will be treated as QP value. */
  283. } NV_ENC_QP_MAP_MODE;
  284. #define NV_ENC_PARAMS_RC_VBR_MINQP (NV_ENC_PARAMS_RC_MODE)0x4 /**< Deprecated */
  285. #define NV_ENC_PARAMS_RC_2_PASS_QUALITY NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ /**< Deprecated */
  286. #define NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP NV_ENC_PARAMS_RC_CBR_HQ /**< Deprecated */
  287. #define NV_ENC_PARAMS_RC_2_PASS_VBR NV_ENC_PARAMS_RC_VBR_HQ /**< Deprecated */
  288. #define NV_ENC_PARAMS_RC_CBR2 NV_ENC_PARAMS_RC_CBR /**< Deprecated */
  289. /**
  290. * Input picture structure
  291. */
  292. typedef enum _NV_ENC_PIC_STRUCT
  293. {
  294. NV_ENC_PIC_STRUCT_FRAME = 0x01, /**< Progressive frame */
  295. NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM = 0x02, /**< Field encoding top field first */
  296. NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP = 0x03 /**< Field encoding bottom field first */
  297. } NV_ENC_PIC_STRUCT;
  298. /**
  299. * Display picture structure
  300. * Currently, this enum is only used for deciding the number of clock timestamp sets in Picture Timing SEI / Time Code SEI
  301. * Otherwise, this has no impact on encoder behavior
  302. */
  303. typedef enum _NV_ENC_DISPLAY_PIC_STRUCT
  304. {
  305. NV_ENC_PIC_STRUCT_DISPLAY_FRAME = 0x00, /**< Field encoding top field first */
  306. NV_ENC_PIC_STRUCT_DISPLAY_FIELD_TOP_BOTTOM = 0x01, /**< Field encoding top field first */
  307. NV_ENC_PIC_STRUCT_DISPLAY_FIELD_BOTTOM_TOP = 0x02, /**< Field encoding bottom field first */
  308. NV_ENC_PIC_STRUCT_DISPLAY_FRAME_DOUBLING = 0x03, /**< Frame doubling */
  309. NV_ENC_PIC_STRUCT_DISPLAY_FRAME_TRIPLING = 0x04 /**< Field tripling */
  310. } NV_ENC_DISPLAY_PIC_STRUCT;
  311. /**
  312. * Input picture type
  313. */
  314. typedef enum _NV_ENC_PIC_TYPE
  315. {
  316. NV_ENC_PIC_TYPE_P = 0x0, /**< Forward predicted */
  317. NV_ENC_PIC_TYPE_B = 0x01, /**< Bi-directionally predicted picture */
  318. NV_ENC_PIC_TYPE_I = 0x02, /**< Intra predicted picture */
  319. NV_ENC_PIC_TYPE_IDR = 0x03, /**< IDR picture */
  320. NV_ENC_PIC_TYPE_BI = 0x04, /**< Bi-directionally predicted with only Intra MBs */
  321. NV_ENC_PIC_TYPE_SKIPPED = 0x05, /**< Picture is skipped */
  322. NV_ENC_PIC_TYPE_INTRA_REFRESH = 0x06, /**< First picture in intra refresh cycle */
  323. NV_ENC_PIC_TYPE_NONREF_P = 0x07, /**< Non reference P picture */
  324. NV_ENC_PIC_TYPE_UNKNOWN = 0xFF /**< Picture type unknown */
  325. } NV_ENC_PIC_TYPE;
  326. /**
  327. * Motion vector precisions
  328. */
  329. typedef enum _NV_ENC_MV_PRECISION
  330. {
  331. NV_ENC_MV_PRECISION_DEFAULT = 0x0, /**< Driver selects Quarter-Pel motion vector precision by default */
  332. NV_ENC_MV_PRECISION_FULL_PEL = 0x01, /**< Full-Pel motion vector precision */
  333. NV_ENC_MV_PRECISION_HALF_PEL = 0x02, /**< Half-Pel motion vector precision */
  334. NV_ENC_MV_PRECISION_QUARTER_PEL = 0x03 /**< Quarter-Pel motion vector precision */
  335. } NV_ENC_MV_PRECISION;
  336. /**
  337. * Input buffer formats
  338. */
  339. typedef enum _NV_ENC_BUFFER_FORMAT
  340. {
  341. NV_ENC_BUFFER_FORMAT_UNDEFINED = 0x00000000, /**< Undefined buffer format */
  342. NV_ENC_BUFFER_FORMAT_NV12 = 0x00000001, /**< Semi-Planar YUV [Y plane followed by interleaved UV plane] */
  343. NV_ENC_BUFFER_FORMAT_YV12 = 0x00000010, /**< Planar YUV [Y plane followed by V and U planes] */
  344. NV_ENC_BUFFER_FORMAT_IYUV = 0x00000100, /**< Planar YUV [Y plane followed by U and V planes] */
  345. NV_ENC_BUFFER_FORMAT_YUV444 = 0x00001000, /**< Planar YUV [Y plane followed by U and V planes] */
  346. NV_ENC_BUFFER_FORMAT_YUV420_10BIT = 0x00010000, /**< 10 bit Semi-Planar YUV [Y plane followed by interleaved UV plane]. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */
  347. NV_ENC_BUFFER_FORMAT_YUV444_10BIT = 0x00100000, /**< 10 bit Planar YUV444 [Y plane followed by U and V planes]. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */
  348. NV_ENC_BUFFER_FORMAT_ARGB = 0x01000000, /**< 8 bit Packed A8R8G8B8. This is a word-ordered format
  349. where a pixel is represented by a 32-bit word with B
  350. in the lowest 8 bits, G in the next 8 bits, R in the
  351. 8 bits after that and A in the highest 8 bits. */
  352. NV_ENC_BUFFER_FORMAT_ARGB10 = 0x02000000, /**< 10 bit Packed A2R10G10B10. This is a word-ordered format
  353. where a pixel is represented by a 32-bit word with B
  354. in the lowest 10 bits, G in the next 10 bits, R in the
  355. 10 bits after that and A in the highest 2 bits. */
  356. NV_ENC_BUFFER_FORMAT_AYUV = 0x04000000, /**< 8 bit Packed A8Y8U8V8. This is a word-ordered format
  357. where a pixel is represented by a 32-bit word with V
  358. in the lowest 8 bits, U in the next 8 bits, Y in the
  359. 8 bits after that and A in the highest 8 bits. */
  360. NV_ENC_BUFFER_FORMAT_ABGR = 0x10000000, /**< 8 bit Packed A8B8G8R8. This is a word-ordered format
  361. where a pixel is represented by a 32-bit word with R
  362. in the lowest 8 bits, G in the next 8 bits, B in the
  363. 8 bits after that and A in the highest 8 bits. */
  364. NV_ENC_BUFFER_FORMAT_ABGR10 = 0x20000000, /**< 10 bit Packed A2B10G10R10. This is a word-ordered format
  365. where a pixel is represented by a 32-bit word with R
  366. in the lowest 10 bits, G in the next 10 bits, B in the
  367. 10 bits after that and A in the highest 2 bits. */
  368. NV_ENC_BUFFER_FORMAT_U8 = 0x40000000, /**< Buffer format representing one-dimensional buffer.
  369. This format should be used only when registering the
  370. resource as output buffer, which will be used to write
  371. the encoded bit stream or H.264 ME only mode output. */
  372. } NV_ENC_BUFFER_FORMAT;
  373. #define NV_ENC_BUFFER_FORMAT_NV12_PL NV_ENC_BUFFER_FORMAT_NV12
  374. #define NV_ENC_BUFFER_FORMAT_YV12_PL NV_ENC_BUFFER_FORMAT_YV12
  375. #define NV_ENC_BUFFER_FORMAT_IYUV_PL NV_ENC_BUFFER_FORMAT_IYUV
  376. #define NV_ENC_BUFFER_FORMAT_YUV444_PL NV_ENC_BUFFER_FORMAT_YUV444
  377. /**
  378. * Encoding levels
  379. */
  380. typedef enum _NV_ENC_LEVEL
  381. {
  382. NV_ENC_LEVEL_AUTOSELECT = 0,
  383. NV_ENC_LEVEL_H264_1 = 10,
  384. NV_ENC_LEVEL_H264_1b = 9,
  385. NV_ENC_LEVEL_H264_11 = 11,
  386. NV_ENC_LEVEL_H264_12 = 12,
  387. NV_ENC_LEVEL_H264_13 = 13,
  388. NV_ENC_LEVEL_H264_2 = 20,
  389. NV_ENC_LEVEL_H264_21 = 21,
  390. NV_ENC_LEVEL_H264_22 = 22,
  391. NV_ENC_LEVEL_H264_3 = 30,
  392. NV_ENC_LEVEL_H264_31 = 31,
  393. NV_ENC_LEVEL_H264_32 = 32,
  394. NV_ENC_LEVEL_H264_4 = 40,
  395. NV_ENC_LEVEL_H264_41 = 41,
  396. NV_ENC_LEVEL_H264_42 = 42,
  397. NV_ENC_LEVEL_H264_5 = 50,
  398. NV_ENC_LEVEL_H264_51 = 51,
  399. NV_ENC_LEVEL_H264_52 = 52,
  400. NV_ENC_LEVEL_H264_60 = 60,
  401. NV_ENC_LEVEL_H264_61 = 61,
  402. NV_ENC_LEVEL_H264_62 = 62,
  403. NV_ENC_LEVEL_HEVC_1 = 30,
  404. NV_ENC_LEVEL_HEVC_2 = 60,
  405. NV_ENC_LEVEL_HEVC_21 = 63,
  406. NV_ENC_LEVEL_HEVC_3 = 90,
  407. NV_ENC_LEVEL_HEVC_31 = 93,
  408. NV_ENC_LEVEL_HEVC_4 = 120,
  409. NV_ENC_LEVEL_HEVC_41 = 123,
  410. NV_ENC_LEVEL_HEVC_5 = 150,
  411. NV_ENC_LEVEL_HEVC_51 = 153,
  412. NV_ENC_LEVEL_HEVC_52 = 156,
  413. NV_ENC_LEVEL_HEVC_6 = 180,
  414. NV_ENC_LEVEL_HEVC_61 = 183,
  415. NV_ENC_LEVEL_HEVC_62 = 186,
  416. NV_ENC_TIER_HEVC_MAIN = 0,
  417. NV_ENC_TIER_HEVC_HIGH = 1,
  418. NV_ENC_LEVEL_AV1_2 = 0,
  419. NV_ENC_LEVEL_AV1_21 = 1,
  420. NV_ENC_LEVEL_AV1_22 = 2,
  421. NV_ENC_LEVEL_AV1_23 = 3,
  422. NV_ENC_LEVEL_AV1_3 = 4,
  423. NV_ENC_LEVEL_AV1_31 = 5,
  424. NV_ENC_LEVEL_AV1_32 = 6,
  425. NV_ENC_LEVEL_AV1_33 = 7,
  426. NV_ENC_LEVEL_AV1_4 = 8,
  427. NV_ENC_LEVEL_AV1_41 = 9,
  428. NV_ENC_LEVEL_AV1_42 = 10,
  429. NV_ENC_LEVEL_AV1_43 = 11,
  430. NV_ENC_LEVEL_AV1_5 = 12,
  431. NV_ENC_LEVEL_AV1_51 = 13,
  432. NV_ENC_LEVEL_AV1_52 = 14,
  433. NV_ENC_LEVEL_AV1_53 = 15,
  434. NV_ENC_LEVEL_AV1_6 = 16,
  435. NV_ENC_LEVEL_AV1_61 = 17,
  436. NV_ENC_LEVEL_AV1_62 = 18,
  437. NV_ENC_LEVEL_AV1_63 = 19,
  438. NV_ENC_LEVEL_AV1_7 = 20,
  439. NV_ENC_LEVEL_AV1_71 = 21,
  440. NV_ENC_LEVEL_AV1_72 = 22,
  441. NV_ENC_LEVEL_AV1_73 = 23,
  442. NV_ENC_LEVEL_AV1_AUTOSELECT ,
  443. NV_ENC_TIER_AV1_0 = 0,
  444. NV_ENC_TIER_AV1_1 = 1
  445. } NV_ENC_LEVEL;
  446. /**
  447. * Error Codes
  448. */
  449. typedef enum _NVENCSTATUS
  450. {
  451. /**
  452. * This indicates that API call returned with no errors.
  453. */
  454. NV_ENC_SUCCESS,
  455. /**
  456. * This indicates that no encode capable devices were detected.
  457. */
  458. NV_ENC_ERR_NO_ENCODE_DEVICE,
  459. /**
  460. * This indicates that devices pass by the client is not supported.
  461. */
  462. NV_ENC_ERR_UNSUPPORTED_DEVICE,
  463. /**
  464. * This indicates that the encoder device supplied by the client is not
  465. * valid.
  466. */
  467. NV_ENC_ERR_INVALID_ENCODERDEVICE,
  468. /**
  469. * This indicates that device passed to the API call is invalid.
  470. */
  471. NV_ENC_ERR_INVALID_DEVICE,
  472. /**
  473. * This indicates that device passed to the API call is no longer available and
  474. * needs to be reinitialized. The clients need to destroy the current encoder
  475. * session by freeing the allocated input output buffers and destroying the device
  476. * and create a new encoding session.
  477. */
  478. NV_ENC_ERR_DEVICE_NOT_EXIST,
  479. /**
  480. * This indicates that one or more of the pointers passed to the API call
  481. * is invalid.
  482. */
  483. NV_ENC_ERR_INVALID_PTR,
  484. /**
  485. * This indicates that completion event passed in ::NvEncEncodePicture() call
  486. * is invalid.
  487. */
  488. NV_ENC_ERR_INVALID_EVENT,
  489. /**
  490. * This indicates that one or more of the parameter passed to the API call
  491. * is invalid.
  492. */
  493. NV_ENC_ERR_INVALID_PARAM,
  494. /**
  495. * This indicates that an API call was made in wrong sequence/order.
  496. */
  497. NV_ENC_ERR_INVALID_CALL,
  498. /**
  499. * This indicates that the API call failed because it was unable to allocate
  500. * enough memory to perform the requested operation.
  501. */
  502. NV_ENC_ERR_OUT_OF_MEMORY,
  503. /**
  504. * This indicates that the encoder has not been initialized with
  505. * ::NvEncInitializeEncoder() or that initialization has failed.
  506. * The client cannot allocate input or output buffers or do any encoding
  507. * related operation before successfully initializing the encoder.
  508. */
  509. NV_ENC_ERR_ENCODER_NOT_INITIALIZED,
  510. /**
  511. * This indicates that an unsupported parameter was passed by the client.
  512. */
  513. NV_ENC_ERR_UNSUPPORTED_PARAM,
  514. /**
  515. * This indicates that the ::NvEncLockBitstream() failed to lock the output
  516. * buffer. This happens when the client makes a non blocking lock call to
  517. * access the output bitstream by passing NV_ENC_LOCK_BITSTREAM::doNotWait flag.
  518. * This is not a fatal error and client should retry the same operation after
  519. * few milliseconds.
  520. */
  521. NV_ENC_ERR_LOCK_BUSY,
  522. /**
  523. * This indicates that the size of the user buffer passed by the client is
  524. * insufficient for the requested operation.
  525. */
  526. NV_ENC_ERR_NOT_ENOUGH_BUFFER,
  527. /**
  528. * This indicates that an invalid struct version was used by the client.
  529. */
  530. NV_ENC_ERR_INVALID_VERSION,
  531. /**
  532. * This indicates that ::NvEncMapInputResource() API failed to map the client
  533. * provided input resource.
  534. */
  535. NV_ENC_ERR_MAP_FAILED,
  536. /**
  537. * This indicates encode driver requires more input buffers to produce an output
  538. * bitstream. If this error is returned from ::NvEncEncodePicture() API, this
  539. * is not a fatal error. If the client is encoding with B frames then,
  540. * ::NvEncEncodePicture() API might be buffering the input frame for re-ordering.
  541. *
  542. * A client operating in synchronous mode cannot call ::NvEncLockBitstream()
  543. * API on the output bitstream buffer if ::NvEncEncodePicture() returned the
  544. * ::NV_ENC_ERR_NEED_MORE_INPUT error code.
  545. * The client must continue providing input frames until encode driver returns
  546. * ::NV_ENC_SUCCESS. After receiving ::NV_ENC_SUCCESS status the client can call
  547. * ::NvEncLockBitstream() API on the output buffers in the same order in which
  548. * it has called ::NvEncEncodePicture().
  549. */
  550. NV_ENC_ERR_NEED_MORE_INPUT,
  551. /**
  552. * This indicates that the HW encoder is busy encoding and is unable to encode
  553. * the input. The client should call ::NvEncEncodePicture() again after few
  554. * milliseconds.
  555. */
  556. NV_ENC_ERR_ENCODER_BUSY,
  557. /**
  558. * This indicates that the completion event passed in ::NvEncEncodePicture()
  559. * API has not been registered with encoder driver using ::NvEncRegisterAsyncEvent().
  560. */
  561. NV_ENC_ERR_EVENT_NOT_REGISTERD,
  562. /**
  563. * This indicates that an unknown internal error has occurred.
  564. */
  565. NV_ENC_ERR_GENERIC,
  566. /**
  567. * This indicates that the client is attempting to use a feature
  568. * that is not available for the license type for the current system.
  569. */
  570. NV_ENC_ERR_INCOMPATIBLE_CLIENT_KEY,
  571. /**
  572. * This indicates that the client is attempting to use a feature
  573. * that is not implemented for the current version.
  574. */
  575. NV_ENC_ERR_UNIMPLEMENTED,
  576. /**
  577. * This indicates that the ::NvEncRegisterResource API failed to register the resource.
  578. */
  579. NV_ENC_ERR_RESOURCE_REGISTER_FAILED,
  580. /**
  581. * This indicates that the client is attempting to unregister a resource
  582. * that has not been successfully registered.
  583. */
  584. NV_ENC_ERR_RESOURCE_NOT_REGISTERED,
  585. /**
  586. * This indicates that the client is attempting to unmap a resource
  587. * that has not been successfully mapped.
  588. */
  589. NV_ENC_ERR_RESOURCE_NOT_MAPPED,
  590. } NVENCSTATUS;
  591. /**
  592. * Encode Picture encode flags.
  593. */
  594. typedef enum _NV_ENC_PIC_FLAGS
  595. {
  596. NV_ENC_PIC_FLAG_FORCEINTRA = 0x1, /**< Encode the current picture as an Intra picture */
  597. NV_ENC_PIC_FLAG_FORCEIDR = 0x2, /**< Encode the current picture as an IDR picture.
  598. This flag is only valid when Picture type decision is taken by the Encoder
  599. [_NV_ENC_INITIALIZE_PARAMS::enablePTD == 1]. */
  600. NV_ENC_PIC_FLAG_OUTPUT_SPSPPS = 0x4, /**< Write the sequence and picture header in encoded bitstream of the current picture */
  601. NV_ENC_PIC_FLAG_EOS = 0x8, /**< Indicates end of the input stream */
  602. } NV_ENC_PIC_FLAGS;
  603. /**
  604. * Memory heap to allocate input and output buffers.
  605. */
  606. typedef enum _NV_ENC_MEMORY_HEAP
  607. {
  608. NV_ENC_MEMORY_HEAP_AUTOSELECT = 0, /**< Memory heap to be decided by the encoder driver based on the usage */
  609. NV_ENC_MEMORY_HEAP_VID = 1, /**< Memory heap is in local video memory */
  610. NV_ENC_MEMORY_HEAP_SYSMEM_CACHED = 2, /**< Memory heap is in cached system memory */
  611. NV_ENC_MEMORY_HEAP_SYSMEM_UNCACHED = 3 /**< Memory heap is in uncached system memory */
  612. } NV_ENC_MEMORY_HEAP;
  613. /**
  614. * B-frame used as reference modes
  615. */
  616. typedef enum _NV_ENC_BFRAME_REF_MODE
  617. {
  618. NV_ENC_BFRAME_REF_MODE_DISABLED = 0x0, /**< B frame is not used for reference */
  619. NV_ENC_BFRAME_REF_MODE_EACH = 0x1, /**< Each B-frame will be used for reference */
  620. NV_ENC_BFRAME_REF_MODE_MIDDLE = 0x2, /**< Only(Number of B-frame)/2 th B-frame will be used for reference */
  621. } NV_ENC_BFRAME_REF_MODE;
  622. /**
  623. * H.264 entropy coding modes.
  624. */
  625. typedef enum _NV_ENC_H264_ENTROPY_CODING_MODE
  626. {
  627. NV_ENC_H264_ENTROPY_CODING_MODE_AUTOSELECT = 0x0, /**< Entropy coding mode is auto selected by the encoder driver */
  628. NV_ENC_H264_ENTROPY_CODING_MODE_CABAC = 0x1, /**< Entropy coding mode is CABAC */
  629. NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC = 0x2 /**< Entropy coding mode is CAVLC */
  630. } NV_ENC_H264_ENTROPY_CODING_MODE;
  631. /**
  632. * H.264 specific BDirect modes
  633. */
  634. typedef enum _NV_ENC_H264_BDIRECT_MODE
  635. {
  636. NV_ENC_H264_BDIRECT_MODE_AUTOSELECT = 0x0, /**< BDirect mode is auto selected by the encoder driver */
  637. NV_ENC_H264_BDIRECT_MODE_DISABLE = 0x1, /**< Disable BDirect mode */
  638. NV_ENC_H264_BDIRECT_MODE_TEMPORAL = 0x2, /**< Temporal BDirect mode */
  639. NV_ENC_H264_BDIRECT_MODE_SPATIAL = 0x3 /**< Spatial BDirect mode */
  640. } NV_ENC_H264_BDIRECT_MODE;
  641. /**
  642. * H.264 specific FMO usage
  643. */
  644. typedef enum _NV_ENC_H264_FMO_MODE
  645. {
  646. NV_ENC_H264_FMO_AUTOSELECT = 0x0, /**< FMO usage is auto selected by the encoder driver */
  647. NV_ENC_H264_FMO_ENABLE = 0x1, /**< Enable FMO */
  648. NV_ENC_H264_FMO_DISABLE = 0x2, /**< Disable FMO */
  649. } NV_ENC_H264_FMO_MODE;
  650. /**
  651. * H.264 specific Adaptive Transform modes
  652. */
  653. typedef enum _NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE
  654. {
  655. NV_ENC_H264_ADAPTIVE_TRANSFORM_AUTOSELECT = 0x0, /**< Adaptive Transform 8x8 mode is auto selected by the encoder driver*/
  656. NV_ENC_H264_ADAPTIVE_TRANSFORM_DISABLE = 0x1, /**< Adaptive Transform 8x8 mode disabled */
  657. NV_ENC_H264_ADAPTIVE_TRANSFORM_ENABLE = 0x2, /**< Adaptive Transform 8x8 mode should be used */
  658. } NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE;
  659. /**
  660. * Stereo frame packing modes.
  661. */
  662. typedef enum _NV_ENC_STEREO_PACKING_MODE
  663. {
  664. NV_ENC_STEREO_PACKING_MODE_NONE = 0x0, /**< No Stereo packing required */
  665. NV_ENC_STEREO_PACKING_MODE_CHECKERBOARD = 0x1, /**< Checkerboard mode for packing stereo frames */
  666. NV_ENC_STEREO_PACKING_MODE_COLINTERLEAVE = 0x2, /**< Column Interleave mode for packing stereo frames */
  667. NV_ENC_STEREO_PACKING_MODE_ROWINTERLEAVE = 0x3, /**< Row Interleave mode for packing stereo frames */
  668. NV_ENC_STEREO_PACKING_MODE_SIDEBYSIDE = 0x4, /**< Side-by-side mode for packing stereo frames */
  669. NV_ENC_STEREO_PACKING_MODE_TOPBOTTOM = 0x5, /**< Top-Bottom mode for packing stereo frames */
  670. NV_ENC_STEREO_PACKING_MODE_FRAMESEQ = 0x6 /**< Frame Sequential mode for packing stereo frames */
  671. } NV_ENC_STEREO_PACKING_MODE;
  672. /**
  673. * Input Resource type
  674. */
  675. typedef enum _NV_ENC_INPUT_RESOURCE_TYPE
  676. {
  677. NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX = 0x0, /**< input resource type is a directx9 surface*/
  678. NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR = 0x1, /**< input resource type is a cuda device pointer surface*/
  679. NV_ENC_INPUT_RESOURCE_TYPE_CUDAARRAY = 0x2, /**< input resource type is a cuda array surface.
  680. This array must be a 2D array and the CUDA_ARRAY3D_SURFACE_LDST
  681. flag must have been specified when creating it. */
  682. NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX = 0x3 /**< input resource type is an OpenGL texture */
  683. } NV_ENC_INPUT_RESOURCE_TYPE;
  684. /**
  685. * Buffer usage
  686. */
  687. typedef enum _NV_ENC_BUFFER_USAGE
  688. {
  689. NV_ENC_INPUT_IMAGE = 0x0, /**< Registered surface will be used for input image */
  690. NV_ENC_OUTPUT_MOTION_VECTOR = 0x1, /**< Registered surface will be used for output of H.264 ME only mode.
  691. This buffer usage type is not supported for HEVC ME only mode. */
  692. NV_ENC_OUTPUT_BITSTREAM = 0x2, /**< Registered surface will be used for output bitstream in encoding */
  693. } NV_ENC_BUFFER_USAGE;
  694. /**
  695. * Encoder Device type
  696. */
  697. typedef enum _NV_ENC_DEVICE_TYPE
  698. {
  699. NV_ENC_DEVICE_TYPE_DIRECTX = 0x0, /**< encode device type is a directx9 device */
  700. NV_ENC_DEVICE_TYPE_CUDA = 0x1, /**< encode device type is a cuda device */
  701. NV_ENC_DEVICE_TYPE_OPENGL = 0x2 /**< encode device type is an OpenGL device.
  702. Use of this device type is supported only on Linux */
  703. } NV_ENC_DEVICE_TYPE;
  704. /**
  705. * Number of reference frames
  706. */
  707. typedef enum _NV_ENC_NUM_REF_FRAMES
  708. {
  709. NV_ENC_NUM_REF_FRAMES_AUTOSELECT = 0x0, /**< Number of reference frames is auto selected by the encoder driver */
  710. NV_ENC_NUM_REF_FRAMES_1 = 0x1, /**< Number of reference frames equal to 1 */
  711. NV_ENC_NUM_REF_FRAMES_2 = 0x2, /**< Number of reference frames equal to 2 */
  712. NV_ENC_NUM_REF_FRAMES_3 = 0x3, /**< Number of reference frames equal to 3 */
  713. NV_ENC_NUM_REF_FRAMES_4 = 0x4, /**< Number of reference frames equal to 4 */
  714. NV_ENC_NUM_REF_FRAMES_5 = 0x5, /**< Number of reference frames equal to 5 */
  715. NV_ENC_NUM_REF_FRAMES_6 = 0x6, /**< Number of reference frames equal to 6 */
  716. NV_ENC_NUM_REF_FRAMES_7 = 0x7 /**< Number of reference frames equal to 7 */
  717. } NV_ENC_NUM_REF_FRAMES;
  718. /**
  719. * Encoder capabilities enumeration.
  720. */
  721. typedef enum _NV_ENC_CAPS
  722. {
  723. /**
  724. * Maximum number of B-Frames supported.
  725. */
  726. NV_ENC_CAPS_NUM_MAX_BFRAMES,
  727. /**
  728. * Rate control modes supported.
  729. * \n The API return value is a bitmask of the values in NV_ENC_PARAMS_RC_MODE.
  730. */
  731. NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES,
  732. /**
  733. * Indicates HW support for field mode encoding.
  734. * \n 0 : Interlaced mode encoding is not supported.
  735. * \n 1 : Interlaced field mode encoding is supported.
  736. * \n 2 : Interlaced frame encoding and field mode encoding are both supported.
  737. */
  738. NV_ENC_CAPS_SUPPORT_FIELD_ENCODING,
  739. /**
  740. * Indicates HW support for monochrome mode encoding.
  741. * \n 0 : Monochrome mode not supported.
  742. * \n 1 : Monochrome mode supported.
  743. */
  744. NV_ENC_CAPS_SUPPORT_MONOCHROME,
  745. /**
  746. * Indicates HW support for FMO.
  747. * \n 0 : FMO not supported.
  748. * \n 1 : FMO supported.
  749. */
  750. NV_ENC_CAPS_SUPPORT_FMO,
  751. /**
  752. * Indicates HW capability for Quarter pel motion estimation.
  753. * \n 0 : Quarter-Pel Motion Estimation not supported.
  754. * \n 1 : Quarter-Pel Motion Estimation supported.
  755. */
  756. NV_ENC_CAPS_SUPPORT_QPELMV,
  757. /**
  758. * H.264 specific. Indicates HW support for BDirect modes.
  759. * \n 0 : BDirect mode encoding not supported.
  760. * \n 1 : BDirect mode encoding supported.
  761. */
  762. NV_ENC_CAPS_SUPPORT_BDIRECT_MODE,
  763. /**
  764. * H264 specific. Indicates HW support for CABAC entropy coding mode.
  765. * \n 0 : CABAC entropy coding not supported.
  766. * \n 1 : CABAC entropy coding supported.
  767. */
  768. NV_ENC_CAPS_SUPPORT_CABAC,
  769. /**
  770. * Indicates HW support for Adaptive Transform.
  771. * \n 0 : Adaptive Transform not supported.
  772. * \n 1 : Adaptive Transform supported.
  773. */
  774. NV_ENC_CAPS_SUPPORT_ADAPTIVE_TRANSFORM,
  775. /**
  776. * Indicates HW support for Multi View Coding.
  777. * \n 0 : Multi View Coding not supported.
  778. * \n 1 : Multi View Coding supported.
  779. */
  780. NV_ENC_CAPS_SUPPORT_STEREO_MVC,
  781. /**
  782. * Indicates HW support for encoding Temporal layers.
  783. * \n 0 : Encoding Temporal layers not supported.
  784. * \n 1 : Encoding Temporal layers supported.
  785. */
  786. NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS,
  787. /**
  788. * Indicates HW support for Hierarchical P frames.
  789. * \n 0 : Hierarchical P frames not supported.
  790. * \n 1 : Hierarchical P frames supported.
  791. */
  792. NV_ENC_CAPS_SUPPORT_HIERARCHICAL_PFRAMES,
  793. /**
  794. * Indicates HW support for Hierarchical B frames.
  795. * \n 0 : Hierarchical B frames not supported.
  796. * \n 1 : Hierarchical B frames supported.
  797. */
  798. NV_ENC_CAPS_SUPPORT_HIERARCHICAL_BFRAMES,
  799. /**
  800. * Maximum Encoding level supported (See ::NV_ENC_LEVEL for details).
  801. */
  802. NV_ENC_CAPS_LEVEL_MAX,
  803. /**
  804. * Minimum Encoding level supported (See ::NV_ENC_LEVEL for details).
  805. */
  806. NV_ENC_CAPS_LEVEL_MIN,
  807. /**
  808. * Indicates HW support for separate colour plane encoding.
  809. * \n 0 : Separate colour plane encoding not supported.
  810. * \n 1 : Separate colour plane encoding supported.
  811. */
  812. NV_ENC_CAPS_SEPARATE_COLOUR_PLANE,
  813. /**
  814. * Maximum output width supported.
  815. */
  816. NV_ENC_CAPS_WIDTH_MAX,
  817. /**
  818. * Maximum output height supported.
  819. */
  820. NV_ENC_CAPS_HEIGHT_MAX,
  821. /**
  822. * Indicates Temporal Scalability Support.
  823. * \n 0 : Temporal SVC encoding not supported.
  824. * \n 1 : Temporal SVC encoding supported.
  825. */
  826. NV_ENC_CAPS_SUPPORT_TEMPORAL_SVC,
  827. /**
  828. * Indicates Dynamic Encode Resolution Change Support.
  829. * Support added from NvEncodeAPI version 2.0.
  830. * \n 0 : Dynamic Encode Resolution Change not supported.
  831. * \n 1 : Dynamic Encode Resolution Change supported.
  832. */
  833. NV_ENC_CAPS_SUPPORT_DYN_RES_CHANGE,
  834. /**
  835. * Indicates Dynamic Encode Bitrate Change Support.
  836. * Support added from NvEncodeAPI version 2.0.
  837. * \n 0 : Dynamic Encode bitrate change not supported.
  838. * \n 1 : Dynamic Encode bitrate change supported.
  839. */
  840. NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE,
  841. /**
  842. * Indicates Forcing Constant QP On The Fly Support.
  843. * Support added from NvEncodeAPI version 2.0.
  844. * \n 0 : Forcing constant QP on the fly not supported.
  845. * \n 1 : Forcing constant QP on the fly supported.
  846. */
  847. NV_ENC_CAPS_SUPPORT_DYN_FORCE_CONSTQP,
  848. /**
  849. * Indicates Dynamic rate control mode Change Support.
  850. * \n 0 : Dynamic rate control mode change not supported.
  851. * \n 1 : Dynamic rate control mode change supported.
  852. */
  853. NV_ENC_CAPS_SUPPORT_DYN_RCMODE_CHANGE,
  854. /**
  855. * Indicates Subframe readback support for slice-based encoding. If this feature is supported, it can be enabled by setting enableSubFrameWrite = 1.
  856. * \n 0 : Subframe readback not supported.
  857. * \n 1 : Subframe readback supported.
  858. */
  859. NV_ENC_CAPS_SUPPORT_SUBFRAME_READBACK,
  860. /**
  861. * Indicates Constrained Encoding mode support.
  862. * Support added from NvEncodeAPI version 2.0.
  863. * \n 0 : Constrained encoding mode not supported.
  864. * \n 1 : Constrained encoding mode supported.
  865. * If this mode is supported client can enable this during initialization.
  866. * Client can then force a picture to be coded as constrained picture where
  867. * in-loop filtering is disabled across slice boundaries and prediction vectors for inter
  868. * macroblocks in each slice will be restricted to the slice region.
  869. */
  870. NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING,
  871. /**
  872. * Indicates Intra Refresh Mode Support.
  873. * Support added from NvEncodeAPI version 2.0.
  874. * \n 0 : Intra Refresh Mode not supported.
  875. * \n 1 : Intra Refresh Mode supported.
  876. */
  877. NV_ENC_CAPS_SUPPORT_INTRA_REFRESH,
  878. /**
  879. * Indicates Custom VBV Buffer Size support. It can be used for capping frame size.
  880. * Support added from NvEncodeAPI version 2.0.
  881. * \n 0 : Custom VBV buffer size specification from client, not supported.
  882. * \n 1 : Custom VBV buffer size specification from client, supported.
  883. */
  884. NV_ENC_CAPS_SUPPORT_CUSTOM_VBV_BUF_SIZE,
  885. /**
  886. * Indicates Dynamic Slice Mode Support.
  887. * Support added from NvEncodeAPI version 2.0.
  888. * \n 0 : Dynamic Slice Mode not supported.
  889. * \n 1 : Dynamic Slice Mode supported.
  890. */
  891. NV_ENC_CAPS_SUPPORT_DYNAMIC_SLICE_MODE,
  892. /**
  893. * Indicates Reference Picture Invalidation Support.
  894. * Support added from NvEncodeAPI version 2.0.
  895. * \n 0 : Reference Picture Invalidation not supported.
  896. * \n 1 : Reference Picture Invalidation supported.
  897. */
  898. NV_ENC_CAPS_SUPPORT_REF_PIC_INVALIDATION,
  899. /**
  900. * Indicates support for Pre-Processing.
  901. * The API return value is a bitmask of the values defined in ::NV_ENC_PREPROC_FLAGS
  902. */
  903. NV_ENC_CAPS_PREPROC_SUPPORT,
  904. /**
  905. * Indicates support Async mode.
  906. * \n 0 : Async Encode mode not supported.
  907. * \n 1 : Async Encode mode supported.
  908. */
  909. NV_ENC_CAPS_ASYNC_ENCODE_SUPPORT,
  910. /**
  911. * Maximum MBs per frame supported.
  912. */
  913. NV_ENC_CAPS_MB_NUM_MAX,
  914. /**
  915. * Maximum aggregate throughput in MBs per sec.
  916. */
  917. NV_ENC_CAPS_MB_PER_SEC_MAX,
  918. /**
  919. * Indicates HW support for YUV444 mode encoding.
  920. * \n 0 : YUV444 mode encoding not supported.
  921. * \n 1 : YUV444 mode encoding supported.
  922. */
  923. NV_ENC_CAPS_SUPPORT_YUV444_ENCODE,
  924. /**
  925. * Indicates HW support for lossless encoding.
  926. * \n 0 : lossless encoding not supported.
  927. * \n 1 : lossless encoding supported.
  928. */
  929. NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE,
  930. /**
  931. * Indicates HW support for Sample Adaptive Offset.
  932. * \n 0 : SAO not supported.
  933. * \n 1 : SAO encoding supported.
  934. */
  935. NV_ENC_CAPS_SUPPORT_SAO,
  936. /**
  937. * Indicates HW support for Motion Estimation Only Mode.
  938. * \n 0 : MEOnly Mode not supported.
  939. * \n 1 : MEOnly Mode supported for I and P frames.
  940. * \n 2 : MEOnly Mode supported for I, P and B frames.
  941. */
  942. NV_ENC_CAPS_SUPPORT_MEONLY_MODE,
  943. /**
  944. * Indicates HW support for lookahead encoding (enableLookahead=1).
  945. * \n 0 : Lookahead not supported.
  946. * \n 1 : Lookahead supported.
  947. */
  948. NV_ENC_CAPS_SUPPORT_LOOKAHEAD,
  949. /**
  950. * Indicates HW support for temporal AQ encoding (enableTemporalAQ=1).
  951. * \n 0 : Temporal AQ not supported.
  952. * \n 1 : Temporal AQ supported.
  953. */
  954. NV_ENC_CAPS_SUPPORT_TEMPORAL_AQ,
  955. /**
  956. * Indicates HW support for 10 bit encoding.
  957. * \n 0 : 10 bit encoding not supported.
  958. * \n 1 : 10 bit encoding supported.
  959. */
  960. NV_ENC_CAPS_SUPPORT_10BIT_ENCODE,
  961. /**
  962. * Maximum number of Long Term Reference frames supported
  963. */
  964. NV_ENC_CAPS_NUM_MAX_LTR_FRAMES,
  965. /**
  966. * Indicates HW support for Weighted Prediction.
  967. * \n 0 : Weighted Prediction not supported.
  968. * \n 1 : Weighted Prediction supported.
  969. */
  970. NV_ENC_CAPS_SUPPORT_WEIGHTED_PREDICTION,
  971. /**
  972. * On managed (vGPU) platforms (Windows only), this API, in conjunction with other GRID Management APIs, can be used
  973. * to estimate the residual capacity of the hardware encoder on the GPU as a percentage of the total available encoder capacity.
  974. * This API can be called at any time; i.e. during the encode session or before opening the encode session.
  975. * If the available encoder capacity is returned as zero, applications may choose to switch to software encoding
  976. * and continue to call this API (e.g. polling once per second) until capacity becomes available.
  977. *
  978. * On bare metal (non-virtualized GPU) and linux platforms, this API always returns 100.
  979. */
  980. NV_ENC_CAPS_DYNAMIC_QUERY_ENCODER_CAPACITY,
  981. /**
  982. * Indicates B as reference support.
  983. * \n 0 : B as reference is not supported.
  984. * \n 1 : each B-Frame as reference is supported.
  985. * \n 2 : only Middle B-frame as reference is supported.
  986. */
  987. NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE,
  988. /**
  989. * Indicates HW support for Emphasis Level Map based delta QP computation.
  990. * \n 0 : Emphasis Level Map based delta QP not supported.
  991. * \n 1 : Emphasis Level Map based delta QP is supported.
  992. */
  993. NV_ENC_CAPS_SUPPORT_EMPHASIS_LEVEL_MAP,
  994. /**
  995. * Minimum input width supported.
  996. */
  997. NV_ENC_CAPS_WIDTH_MIN,
  998. /**
  999. * Minimum input height supported.
  1000. */
  1001. NV_ENC_CAPS_HEIGHT_MIN,
  1002. /**
  1003. * Indicates HW support for multiple reference frames.
  1004. */
  1005. NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES,
  1006. /**
  1007. * Indicates HW support for HEVC with alpha encoding.
  1008. * \n 0 : HEVC with alpha encoding not supported.
  1009. * \n 1 : HEVC with alpha encoding is supported.
  1010. */
  1011. NV_ENC_CAPS_SUPPORT_ALPHA_LAYER_ENCODING,
  1012. /**
  1013. * Indicates number of Encoding engines present on GPU.
  1014. */
  1015. NV_ENC_CAPS_NUM_ENCODER_ENGINES,
  1016. /**
  1017. * Indicates single slice intra refresh support.
  1018. */
  1019. NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH,
  1020. /**
  1021. * Reserved - Not to be used by clients.
  1022. */
  1023. NV_ENC_CAPS_EXPOSED_COUNT
  1024. } NV_ENC_CAPS;
  1025. /**
  1026. * HEVC CU SIZE
  1027. */
  1028. typedef enum _NV_ENC_HEVC_CUSIZE
  1029. {
  1030. NV_ENC_HEVC_CUSIZE_AUTOSELECT = 0,
  1031. NV_ENC_HEVC_CUSIZE_8x8 = 1,
  1032. NV_ENC_HEVC_CUSIZE_16x16 = 2,
  1033. NV_ENC_HEVC_CUSIZE_32x32 = 3,
  1034. NV_ENC_HEVC_CUSIZE_64x64 = 4,
  1035. }NV_ENC_HEVC_CUSIZE;
  1036. /**
  1037. * AV1 PART SIZE
  1038. */
  1039. typedef enum _NV_ENC_AV1_PART_SIZE
  1040. {
  1041. NV_ENC_AV1_PART_SIZE_AUTOSELECT = 0,
  1042. NV_ENC_AV1_PART_SIZE_4x4 = 1,
  1043. NV_ENC_AV1_PART_SIZE_8x8 = 2,
  1044. NV_ENC_AV1_PART_SIZE_16x16 = 3,
  1045. NV_ENC_AV1_PART_SIZE_32x32 = 4,
  1046. NV_ENC_AV1_PART_SIZE_64x64 = 5,
  1047. }NV_ENC_AV1_PART_SIZE;
  1048. /**
  1049. * Enums related to fields in VUI parameters.
  1050. */
  1051. typedef enum _NV_ENC_VUI_VIDEO_FORMAT
  1052. {
  1053. NV_ENC_VUI_VIDEO_FORMAT_COMPONENT = 0,
  1054. NV_ENC_VUI_VIDEO_FORMAT_PAL = 1,
  1055. NV_ENC_VUI_VIDEO_FORMAT_NTSC = 2,
  1056. NV_ENC_VUI_VIDEO_FORMAT_SECAM = 3,
  1057. NV_ENC_VUI_VIDEO_FORMAT_MAC = 4,
  1058. NV_ENC_VUI_VIDEO_FORMAT_UNSPECIFIED = 5,
  1059. }NV_ENC_VUI_VIDEO_FORMAT;
  1060. typedef enum _NV_ENC_VUI_COLOR_PRIMARIES
  1061. {
  1062. NV_ENC_VUI_COLOR_PRIMARIES_UNDEFINED = 0,
  1063. NV_ENC_VUI_COLOR_PRIMARIES_BT709 = 1,
  1064. NV_ENC_VUI_COLOR_PRIMARIES_UNSPECIFIED = 2,
  1065. NV_ENC_VUI_COLOR_PRIMARIES_RESERVED = 3,
  1066. NV_ENC_VUI_COLOR_PRIMARIES_BT470M = 4,
  1067. NV_ENC_VUI_COLOR_PRIMARIES_BT470BG = 5,
  1068. NV_ENC_VUI_COLOR_PRIMARIES_SMPTE170M = 6,
  1069. NV_ENC_VUI_COLOR_PRIMARIES_SMPTE240M = 7,
  1070. NV_ENC_VUI_COLOR_PRIMARIES_FILM = 8,
  1071. NV_ENC_VUI_COLOR_PRIMARIES_BT2020 = 9,
  1072. NV_ENC_VUI_COLOR_PRIMARIES_SMPTE428 = 10,
  1073. NV_ENC_VUI_COLOR_PRIMARIES_SMPTE431 = 11,
  1074. NV_ENC_VUI_COLOR_PRIMARIES_SMPTE432 = 12,
  1075. NV_ENC_VUI_COLOR_PRIMARIES_JEDEC_P22 = 22,
  1076. }NV_ENC_VUI_COLOR_PRIMARIES;
  1077. typedef enum _NV_ENC_VUI_TRANSFER_CHARACTERISTIC
  1078. {
  1079. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_UNDEFINED = 0,
  1080. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT709 = 1,
  1081. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_UNSPECIFIED = 2,
  1082. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_RESERVED = 3,
  1083. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT470M = 4,
  1084. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT470BG = 5,
  1085. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE170M = 6,
  1086. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE240M = 7,
  1087. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_LINEAR = 8,
  1088. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_LOG = 9,
  1089. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_LOG_SQRT = 10,
  1090. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_IEC61966_2_4 = 11,
  1091. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT1361_ECG = 12,
  1092. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SRGB = 13,
  1093. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT2020_10 = 14,
  1094. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT2020_12 = 15,
  1095. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE2084 = 16,
  1096. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE428 = 17,
  1097. NV_ENC_VUI_TRANSFER_CHARACTERISTIC_ARIB_STD_B67 = 18,
  1098. }NV_ENC_VUI_TRANSFER_CHARACTERISTIC;
  1099. typedef enum _NV_ENC_VUI_MATRIX_COEFFS
  1100. {
  1101. NV_ENC_VUI_MATRIX_COEFFS_RGB = 0,
  1102. NV_ENC_VUI_MATRIX_COEFFS_BT709 = 1,
  1103. NV_ENC_VUI_MATRIX_COEFFS_UNSPECIFIED = 2,
  1104. NV_ENC_VUI_MATRIX_COEFFS_RESERVED = 3,
  1105. NV_ENC_VUI_MATRIX_COEFFS_FCC = 4,
  1106. NV_ENC_VUI_MATRIX_COEFFS_BT470BG = 5,
  1107. NV_ENC_VUI_MATRIX_COEFFS_SMPTE170M = 6,
  1108. NV_ENC_VUI_MATRIX_COEFFS_SMPTE240M = 7,
  1109. NV_ENC_VUI_MATRIX_COEFFS_YCGCO = 8,
  1110. NV_ENC_VUI_MATRIX_COEFFS_BT2020_NCL = 9,
  1111. NV_ENC_VUI_MATRIX_COEFFS_BT2020_CL = 10,
  1112. NV_ENC_VUI_MATRIX_COEFFS_SMPTE2085 = 11,
  1113. }NV_ENC_VUI_MATRIX_COEFFS;
  1114. /**
  1115. * Input struct for querying Encoding capabilities.
  1116. */
  1117. typedef struct _NV_ENC_CAPS_PARAM
  1118. {
  1119. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CAPS_PARAM_VER */
  1120. NV_ENC_CAPS capsToQuery; /**< [in]: Specifies the encode capability to be queried. Client should pass a member for ::NV_ENC_CAPS enum. */
  1121. uint32_t reserved[62]; /**< [in]: Reserved and must be set to 0 */
  1122. } NV_ENC_CAPS_PARAM;
  1123. /** NV_ENC_CAPS_PARAM struct version. */
  1124. #define NV_ENC_CAPS_PARAM_VER NVENCAPI_STRUCT_VERSION(1)
  1125. /**
  1126. * Encoder Output parameters
  1127. */
  1128. typedef struct _NV_ENC_ENCODE_OUT_PARAMS
  1129. {
  1130. uint32_t version; /**< [out]: Struct version. */
  1131. uint32_t bitstreamSizeInBytes; /**< [out]: Encoded bitstream size in bytes */
  1132. uint32_t reserved[62]; /**< [out]: Reserved and must be set to 0 */
  1133. } NV_ENC_ENCODE_OUT_PARAMS;
  1134. /** NV_ENC_ENCODE_OUT_PARAMS struct version. */
  1135. #define NV_ENC_ENCODE_OUT_PARAMS_VER NVENCAPI_STRUCT_VERSION(1)
  1136. /**
  1137. * Creation parameters for input buffer.
  1138. */
  1139. typedef struct _NV_ENC_CREATE_INPUT_BUFFER
  1140. {
  1141. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CREATE_INPUT_BUFFER_VER */
  1142. uint32_t width; /**< [in]: Input frame width */
  1143. uint32_t height; /**< [in]: Input frame height */
  1144. NV_ENC_MEMORY_HEAP memoryHeap; /**< [in]: Deprecated. Do not use */
  1145. NV_ENC_BUFFER_FORMAT bufferFmt; /**< [in]: Input buffer format */
  1146. uint32_t reserved; /**< [in]: Reserved and must be set to 0 */
  1147. NV_ENC_INPUT_PTR inputBuffer; /**< [out]: Pointer to input buffer */
  1148. void* pSysMemBuffer; /**< [in]: Pointer to existing system memory buffer */
  1149. uint32_t reserved1[57]; /**< [in]: Reserved and must be set to 0 */
  1150. void* reserved2[63]; /**< [in]: Reserved and must be set to NULL */
  1151. } NV_ENC_CREATE_INPUT_BUFFER;
  1152. /** NV_ENC_CREATE_INPUT_BUFFER struct version. */
  1153. #define NV_ENC_CREATE_INPUT_BUFFER_VER NVENCAPI_STRUCT_VERSION(1)
  1154. /**
  1155. * Creation parameters for output bitstream buffer.
  1156. */
  1157. typedef struct _NV_ENC_CREATE_BITSTREAM_BUFFER
  1158. {
  1159. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CREATE_BITSTREAM_BUFFER_VER */
  1160. uint32_t size; /**< [in]: Deprecated. Do not use */
  1161. NV_ENC_MEMORY_HEAP memoryHeap; /**< [in]: Deprecated. Do not use */
  1162. uint32_t reserved; /**< [in]: Reserved and must be set to 0 */
  1163. NV_ENC_OUTPUT_PTR bitstreamBuffer; /**< [out]: Pointer to the output bitstream buffer */
  1164. void* bitstreamBufferPtr; /**< [out]: Reserved and should not be used */
  1165. uint32_t reserved1[58]; /**< [in]: Reserved and should be set to 0 */
  1166. void* reserved2[64]; /**< [in]: Reserved and should be set to NULL */
  1167. } NV_ENC_CREATE_BITSTREAM_BUFFER;
  1168. /** NV_ENC_CREATE_BITSTREAM_BUFFER struct version. */
  1169. #define NV_ENC_CREATE_BITSTREAM_BUFFER_VER NVENCAPI_STRUCT_VERSION(1)
  1170. /**
  1171. * Structs needed for ME only mode.
  1172. */
  1173. typedef struct _NV_ENC_MVECTOR
  1174. {
  1175. int16_t mvx; /**< the x component of MV in quarter-pel units */
  1176. int16_t mvy; /**< the y component of MV in quarter-pel units */
  1177. } NV_ENC_MVECTOR;
  1178. /**
  1179. * Motion vector structure per macroblock for H264 motion estimation.
  1180. */
  1181. typedef struct _NV_ENC_H264_MV_DATA
  1182. {
  1183. NV_ENC_MVECTOR mv[4]; /**< up to 4 vectors for 8x8 partition */
  1184. uint8_t mbType; /**< 0 (I), 1 (P), 2 (IPCM), 3 (B) */
  1185. uint8_t partitionType; /**< Specifies the block partition type. 0:16x16, 1:8x8, 2:16x8, 3:8x16 */
  1186. uint16_t reserved; /**< reserved padding for alignment */
  1187. uint32_t mbCost;
  1188. } NV_ENC_H264_MV_DATA;
  1189. /**
  1190. * Motion vector structure per CU for HEVC motion estimation.
  1191. */
  1192. typedef struct _NV_ENC_HEVC_MV_DATA
  1193. {
  1194. NV_ENC_MVECTOR mv[4]; /**< up to 4 vectors within a CU */
  1195. uint8_t cuType; /**< 0 (I), 1(P) */
  1196. uint8_t cuSize; /**< 0: 8x8, 1: 16x16, 2: 32x32, 3: 64x64 */
  1197. uint8_t partitionMode; /**< The CU partition mode
  1198. 0 (2Nx2N), 1 (2NxN), 2(Nx2N), 3 (NxN),
  1199. 4 (2NxnU), 5 (2NxnD), 6(nLx2N), 7 (nRx2N) */
  1200. uint8_t lastCUInCTB; /**< Marker to separate CUs in the current CTB from CUs in the next CTB */
  1201. } NV_ENC_HEVC_MV_DATA;
  1202. /**
  1203. * Creation parameters for output motion vector buffer for ME only mode.
  1204. */
  1205. typedef struct _NV_ENC_CREATE_MV_BUFFER
  1206. {
  1207. uint32_t version; /**< [in]: Struct version. Must be set to NV_ENC_CREATE_MV_BUFFER_VER */
  1208. NV_ENC_OUTPUT_PTR mvBuffer; /**< [out]: Pointer to the output motion vector buffer */
  1209. uint32_t reserved1[255]; /**< [in]: Reserved and should be set to 0 */
  1210. void* reserved2[63]; /**< [in]: Reserved and should be set to NULL */
  1211. } NV_ENC_CREATE_MV_BUFFER;
  1212. /** NV_ENC_CREATE_MV_BUFFER struct version*/
  1213. #define NV_ENC_CREATE_MV_BUFFER_VER NVENCAPI_STRUCT_VERSION(1)
  1214. /**
  1215. * QP value for frames
  1216. */
  1217. typedef struct _NV_ENC_QP
  1218. {
  1219. uint32_t qpInterP; /**< [in]: Specifies QP value for P-frame. Even though this field is uint32_t for legacy reasons, the client should treat this as a signed parameter(int32_t) for cases in which negative QP values are to be specified. */
  1220. uint32_t qpInterB; /**< [in]: Specifies QP value for B-frame. Even though this field is uint32_t for legacy reasons, the client should treat this as a signed parameter(int32_t) for cases in which negative QP values are to be specified. */
  1221. uint32_t qpIntra; /**< [in]: Specifies QP value for Intra Frame. Even though this field is uint32_t for legacy reasons, the client should treat this as a signed parameter(int32_t) for cases in which negative QP values are to be specified. */
  1222. } NV_ENC_QP;
  1223. /**
  1224. * Rate Control Configuration Parameters
  1225. */
  1226. typedef struct _NV_ENC_RC_PARAMS
  1227. {
  1228. uint32_t version;
  1229. NV_ENC_PARAMS_RC_MODE rateControlMode; /**< [in]: Specifies the rate control mode. Check support for various rate control modes using ::NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES caps. */
  1230. NV_ENC_QP constQP; /**< [in]: Specifies the initial QP to be used for encoding, these values would be used for all frames if in Constant QP mode. */
  1231. uint32_t averageBitRate; /**< [in]: Specifies the average bitrate(in bits/sec) used for encoding. */
  1232. uint32_t maxBitRate; /**< [in]: Specifies the maximum bitrate for the encoded output. This is used for VBR and ignored for CBR mode. */
  1233. uint32_t vbvBufferSize; /**< [in]: Specifies the VBV(HRD) buffer size. in bits. Set 0 to use the default VBV buffer size. */
  1234. uint32_t vbvInitialDelay; /**< [in]: Specifies the VBV(HRD) initial delay in bits. Set 0 to use the default VBV initial delay .*/
  1235. uint32_t enableMinQP :1; /**< [in]: Set this to 1 if minimum QP used for rate control. */
  1236. uint32_t enableMaxQP :1; /**< [in]: Set this to 1 if maximum QP used for rate control. */
  1237. uint32_t enableInitialRCQP :1; /**< [in]: Set this to 1 if user supplied initial QP is used for rate control. */
  1238. uint32_t enableAQ :1; /**< [in]: Set this to 1 to enable adaptive quantization (Spatial). */
  1239. uint32_t reservedBitField1 :1; /**< [in]: Reserved bitfields and must be set to 0. */
  1240. uint32_t enableLookahead :1; /**< [in]: Set this to 1 to enable lookahead with depth <lookaheadDepth> (if lookahead is enabled, input frames must remain available to the encoder until encode completion) */
  1241. uint32_t disableIadapt :1; /**< [in]: Set this to 1 to disable adaptive I-frame insertion at scene cuts (only has an effect when lookahead is enabled) */
  1242. uint32_t disableBadapt :1; /**< [in]: Set this to 1 to disable adaptive B-frame decision (only has an effect when lookahead is enabled) */
  1243. uint32_t enableTemporalAQ :1; /**< [in]: Set this to 1 to enable temporal AQ */
  1244. uint32_t zeroReorderDelay :1; /**< [in]: Set this to 1 to indicate zero latency operation (no reordering delay, num_reorder_frames=0) */
  1245. uint32_t enableNonRefP :1; /**< [in]: Set this to 1 to enable automatic insertion of non-reference P-frames (no effect if enablePTD=0) */
  1246. uint32_t strictGOPTarget :1; /**< [in]: Set this to 1 to minimize GOP-to-GOP rate fluctuations */
  1247. uint32_t aqStrength :4; /**< [in]: When AQ (Spatial) is enabled (i.e. NV_ENC_RC_PARAMS::enableAQ is set), this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive).
  1248. If not set, strength is auto selected by driver. */
  1249. uint32_t reservedBitFields :16; /**< [in]: Reserved bitfields and must be set to 0 */
  1250. NV_ENC_QP minQP; /**< [in]: Specifies the minimum QP used for rate control. Client must set NV_ENC_CONFIG::enableMinQP to 1. */
  1251. NV_ENC_QP maxQP; /**< [in]: Specifies the maximum QP used for rate control. Client must set NV_ENC_CONFIG::enableMaxQP to 1. */
  1252. NV_ENC_QP initialRCQP; /**< [in]: Specifies the initial QP used for rate control. Client must set NV_ENC_CONFIG::enableInitialRCQP to 1. */
  1253. uint32_t temporallayerIdxMask; /**< [in]: Specifies the temporal layers (as a bitmask) whose QPs have changed. Valid max bitmask is [2^NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS - 1].
  1254. Applicable only for constant QP mode (NV_ENC_RC_PARAMS::rateControlMode = NV_ENC_PARAMS_RC_CONSTQP). */
  1255. uint8_t temporalLayerQP[8]; /**< [in]: Specifies the temporal layer QPs used for rate control. Temporal layer index is used as the array index.
  1256. Applicable only for constant QP mode (NV_ENC_RC_PARAMS::rateControlMode = NV_ENC_PARAMS_RC_CONSTQP). */
  1257. uint8_t targetQuality; /**< [in]: Target CQ (Constant Quality) level for VBR mode (range 0-51 with 0-automatic) */
  1258. uint8_t targetQualityLSB; /**< [in]: Fractional part of target quality (as 8.8 fixed point format) */
  1259. uint16_t lookaheadDepth; /**< [in]: Maximum depth of lookahead with range 0-(31 - number of B frames).
  1260. lookaheadDepth is only used if enableLookahead=1.*/
  1261. uint8_t lowDelayKeyFrameScale; /**< [in]: Specifies the ratio of I frame bits to P frame bits in case of single frame VBV and CBR rate control mode,
  1262. is set to 2 by default for low latency tuning info and 1 by default for ultra low latency tuning info */
  1263. int8_t yDcQPIndexOffset; /**< [in]: Specifies the value of 'deltaQ_y_dc' in AV1.*/
  1264. int8_t uDcQPIndexOffset; /**< [in]: Specifies the value of 'deltaQ_u_dc' in AV1.*/
  1265. int8_t vDcQPIndexOffset; /**< [in]: Specifies the value of 'deltaQ_v_dc' in AV1 (for future use only - deltaQ_v_dc is currently always internally set to same value as deltaQ_u_dc). */
  1266. NV_ENC_QP_MAP_MODE qpMapMode; /**< [in]: This flag is used to interpret values in array specified by NV_ENC_PIC_PARAMS::qpDeltaMap.
  1267. Set this to NV_ENC_QP_MAP_EMPHASIS to treat values specified by NV_ENC_PIC_PARAMS::qpDeltaMap as Emphasis Level Map.
  1268. Emphasis Level can be assigned any value specified in enum NV_ENC_EMPHASIS_MAP_LEVEL.
  1269. Emphasis Level Map is used to specify regions to be encoded at varying levels of quality.
  1270. The hardware encoder adjusts the quantization within the image as per the provided emphasis map,
  1271. by adjusting the quantization parameter (QP) assigned to each macroblock. This adjustment is commonly called “Delta QP”.
  1272. The adjustment depends on the absolute QP decided by the rate control algorithm, and is applied after the rate control has decided each macroblock’s QP.
  1273. Since the Delta QP overrides rate control, enabling Emphasis Level Map may violate bitrate and VBV buffer size constraints.
  1274. Emphasis Level Map is useful in situations where client has a priori knowledge of the image complexity (e.g. via use of NVFBC's Classification feature) and encoding those high-complexity areas at higher quality (lower QP) is important, even at the possible cost of violating bitrate/VBV buffer size constraints
  1275. This feature is not supported when AQ( Spatial/Temporal) is enabled.
  1276. This feature is only supported for H264 codec currently.
  1277. Set this to NV_ENC_QP_MAP_DELTA to treat values specified by NV_ENC_PIC_PARAMS::qpDeltaMap as QP Delta. This specifies QP modifier to be applied on top of the QP chosen by rate control
  1278. Set this to NV_ENC_QP_MAP_DISABLED to ignore NV_ENC_PIC_PARAMS::qpDeltaMap values. In this case, qpDeltaMap should be set to NULL.
  1279. Other values are reserved for future use.*/
  1280. NV_ENC_MULTI_PASS multiPass; /**< [in]: This flag is used to enable multi-pass encoding for a given ::NV_ENC_PARAMS_RC_MODE. This flag is not valid for H264 and HEVC MEOnly mode */
  1281. uint32_t alphaLayerBitrateRatio; /**< [in]: Specifies the ratio in which bitrate should be split between base and alpha layer. A value 'x' for this field will split the target bitrate in a ratio of x : 1 between base and alpha layer.
  1282. The default split ratio is 15.*/
  1283. int8_t cbQPIndexOffset; /**< [in]: Specifies the value of 'chroma_qp_index_offset' in H264 / 'pps_cb_qp_offset' in HEVC / 'deltaQ_u_ac' in AV1.*/
  1284. int8_t crQPIndexOffset; /**< [in]: Specifies the value of 'second_chroma_qp_index_offset' in H264 / 'pps_cr_qp_offset' in HEVC / 'deltaQ_v_ac' in AV1 (for future use only - deltaQ_v_ac is currently always internally set to same value as deltaQ_u_ac). */
  1285. uint16_t reserved2;
  1286. uint32_t reserved[4];
  1287. } NV_ENC_RC_PARAMS;
  1288. /** macro for constructing the version field of ::_NV_ENC_RC_PARAMS */
  1289. #define NV_ENC_RC_PARAMS_VER NVENCAPI_STRUCT_VERSION(1)
  1290. #define MAX_NUM_CLOCK_TS 3
  1291. /**
  1292. * Clock Timestamp set parameters
  1293. * For H264, this structure is used to populate Picture Timing SEI when NV_ENC_CONFIG_H264::enableTimeCode is set to 1.
  1294. * For HEVC, this structure is used to populate Time Code SEI when NV_ENC_CONFIG_HEVC::enableTimeCodeSEI is set to 1.
  1295. * For more details, refer to Annex D of ITU-T Specification.
  1296. */
  1297. typedef struct _NV_ENC_CLOCK_TIMESTAMP_SET
  1298. {
  1299. uint32_t countingType : 1; /**< [in] Specifies the 'counting_type' */
  1300. uint32_t discontinuityFlag : 1; /**< [in] Specifies the 'discontinuity_flag' */
  1301. uint32_t cntDroppedFrames : 1; /**< [in] Specifies the 'cnt_dropped_flag' */
  1302. uint32_t nFrames : 8; /**< [in] Specifies the value of 'n_frames' */
  1303. uint32_t secondsValue : 6; /**< [in] Specifies the 'seconds_value' */
  1304. uint32_t minutesValue : 6; /**< [in] Specifies the 'minutes_value' */
  1305. uint32_t hoursValue : 5; /**< [in] Specifies the 'hours_value' */
  1306. uint32_t reserved2 : 4; /**< [in] Reserved and must be set to 0 */
  1307. uint32_t timeOffset; /**< [in] Specifies the 'time_offset_value' */
  1308. } NV_ENC_CLOCK_TIMESTAMP_SET;
  1309. typedef struct _NV_ENC_TIME_CODE
  1310. {
  1311. NV_ENC_DISPLAY_PIC_STRUCT displayPicStruct; /**< [in] Display picStruct */
  1312. NV_ENC_CLOCK_TIMESTAMP_SET clockTimestamp[MAX_NUM_CLOCK_TS]; /**< [in] Clock Timestamp set */
  1313. } NV_ENC_TIME_CODE;
  1314. /**
  1315. * \struct _NV_ENC_CONFIG_H264_VUI_PARAMETERS
  1316. * H264 Video Usability Info parameters
  1317. */
  1318. typedef struct _NV_ENC_CONFIG_H264_VUI_PARAMETERS
  1319. {
  1320. uint32_t overscanInfoPresentFlag; /**< [in]: If set to 1 , it specifies that the overscanInfo is present */
  1321. uint32_t overscanInfo; /**< [in]: Specifies the overscan info(as defined in Annex E of the ITU-T Specification). */
  1322. uint32_t videoSignalTypePresentFlag; /**< [in]: If set to 1, it specifies that the videoFormat, videoFullRangeFlag and colourDescriptionPresentFlag are present. */
  1323. NV_ENC_VUI_VIDEO_FORMAT videoFormat; /**< [in]: Specifies the source video format(as defined in Annex E of the ITU-T Specification).*/
  1324. uint32_t videoFullRangeFlag; /**< [in]: Specifies the output range of the luma and chroma samples(as defined in Annex E of the ITU-T Specification). */
  1325. uint32_t colourDescriptionPresentFlag; /**< [in]: If set to 1, it specifies that the colourPrimaries, transferCharacteristics and colourMatrix are present. */
  1326. NV_ENC_VUI_COLOR_PRIMARIES colourPrimaries; /**< [in]: Specifies color primaries for converting to RGB(as defined in Annex E of the ITU-T Specification) */
  1327. NV_ENC_VUI_TRANSFER_CHARACTERISTIC transferCharacteristics; /**< [in]: Specifies the opto-electronic transfer characteristics to use (as defined in Annex E of the ITU-T Specification) */
  1328. NV_ENC_VUI_MATRIX_COEFFS colourMatrix; /**< [in]: Specifies the matrix coefficients used in deriving the luma and chroma from the RGB primaries (as defined in Annex E of the ITU-T Specification). */
  1329. uint32_t chromaSampleLocationFlag; /**< [in]: If set to 1 , it specifies that the chromaSampleLocationTop and chromaSampleLocationBot are present.*/
  1330. uint32_t chromaSampleLocationTop; /**< [in]: Specifies the chroma sample location for top field(as defined in Annex E of the ITU-T Specification) */
  1331. uint32_t chromaSampleLocationBot; /**< [in]: Specifies the chroma sample location for bottom field(as defined in Annex E of the ITU-T Specification) */
  1332. uint32_t bitstreamRestrictionFlag; /**< [in]: If set to 1, it specifies the bitstream restriction parameters are present in the bitstream.*/
  1333. uint32_t timingInfoPresentFlag; /**< [in]: If set to 1, it specifies that the timingInfo is present and the 'numUnitInTicks' and 'timeScale' fields are specified by the application. */
  1334. /**< [in]: If not set, the timingInfo may still be present with timing related fields calculated internally basedon the frame rate specified by the application. */
  1335. uint32_t numUnitInTicks; /**< [in]: Specifies the number of time units of the clock(as defined in Annex E of the ITU-T Specification). */
  1336. uint32_t timeScale; /**< [in]: Specifies the frquency of the clock(as defined in Annex E of the ITU-T Specification). */
  1337. uint32_t reserved[12]; /**< [in]: Reserved and must be set to 0 */
  1338. }NV_ENC_CONFIG_H264_VUI_PARAMETERS;
  1339. typedef NV_ENC_CONFIG_H264_VUI_PARAMETERS NV_ENC_CONFIG_HEVC_VUI_PARAMETERS;
  1340. /**
  1341. * \struct _NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE
  1342. * External motion vector hint counts per block type.
  1343. * H264 and AV1 support multiple hint while HEVC supports one hint for each valid candidate.
  1344. */
  1345. typedef struct _NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE
  1346. {
  1347. uint32_t numCandsPerBlk16x16 : 4; /**< [in]: Supported for H264, HEVC. It Specifies the number of candidates per 16x16 block. */
  1348. uint32_t numCandsPerBlk16x8 : 4; /**< [in]: Supported for H264 only. Specifies the number of candidates per 16x8 block. */
  1349. uint32_t numCandsPerBlk8x16 : 4; /**< [in]: Supported for H264 only. Specifies the number of candidates per 8x16 block. */
  1350. uint32_t numCandsPerBlk8x8 : 4; /**< [in]: Supported for H264, HEVC. Specifies the number of candidates per 8x8 block. */
  1351. uint32_t numCandsPerSb : 8; /**< [in]: Supported for AV1 only. Specifies the number of candidates per SB. */
  1352. uint32_t reserved : 8; /**< [in]: Reserved for padding. */
  1353. uint32_t reserved1[3]; /**< [in]: Reserved for future use. */
  1354. } NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE;
  1355. /**
  1356. * \struct _NVENC_EXTERNAL_ME_HINT
  1357. * External Motion Vector hint structure for H264 and HEVC.
  1358. */
  1359. typedef struct _NVENC_EXTERNAL_ME_HINT
  1360. {
  1361. int32_t mvx : 12; /**< [in]: Specifies the x component of integer pixel MV (relative to current MB) S12.0. */
  1362. int32_t mvy : 10; /**< [in]: Specifies the y component of integer pixel MV (relative to current MB) S10.0 .*/
  1363. int32_t refidx : 5; /**< [in]: Specifies the reference index (31=invalid). Current we support only 1 reference frame per direction for external hints, so \p refidx must be 0. */
  1364. int32_t dir : 1; /**< [in]: Specifies the direction of motion estimation . 0=L0 1=L1.*/
  1365. int32_t partType : 2; /**< [in]: Specifies the block partition type.0=16x16 1=16x8 2=8x16 3=8x8 (blocks in partition must be consecutive).*/
  1366. int32_t lastofPart : 1; /**< [in]: Set to 1 for the last MV of (sub) partition */
  1367. int32_t lastOfMB : 1; /**< [in]: Set to 1 for the last MV of macroblock. */
  1368. } NVENC_EXTERNAL_ME_HINT;
  1369. /**
  1370. * \struct _NVENC_EXTERNAL_ME_SB_HINT
  1371. * External Motion Vector SB hint structure for AV1
  1372. */
  1373. typedef struct _NVENC_EXTERNAL_ME_SB_HINT
  1374. {
  1375. int16_t refidx : 5; /**< [in]: Specifies the reference index (31=invalid) */
  1376. int16_t direction : 1; /**< [in]: Specifies the direction of motion estimation . 0=L0 1=L1.*/
  1377. int16_t bi : 1; /**< [in]: Specifies reference mode 0=single mv, 1=compound mv */
  1378. int16_t partition_type : 3; /**< [in]: Specifies the partition type: 0: 2NX2N, 1:2NxN, 2:Nx2N. reserved 3bits for future modes */
  1379. int16_t x8 : 3; /**< [in]: Specifies the current partition's top left x position in 8 pixel unit */
  1380. int16_t last_of_cu : 1; /**< [in]: Set to 1 for the last MV current CU */
  1381. int16_t last_of_sb : 1; /**< [in]: Set to 1 for the last MV of current SB */
  1382. int16_t reserved0 : 1; /**< [in]: Reserved and must be set to 0 */
  1383. int16_t mvx : 14; /**< [in]: Specifies the x component of integer pixel MV (relative to current MB) S12.2. */
  1384. int16_t cu_size : 2; /**< [in]: Specifies the CU size: 0: 8x8, 1: 16x16, 2:32x32, 3:64x64 */
  1385. int16_t mvy : 12; /**< [in]: Specifies the y component of integer pixel MV (relative to current MB) S10.2 .*/
  1386. int16_t y8 : 3; /**< [in]: Specifies the current partition's top left y position in 8 pixel unit */
  1387. int16_t reserved1 : 1; /**< [in]: Reserved and must be set to 0 */
  1388. } NVENC_EXTERNAL_ME_SB_HINT;
  1389. /**
  1390. * \struct _NV_ENC_CONFIG_H264
  1391. * H264 encoder configuration parameters
  1392. */
  1393. typedef struct _NV_ENC_CONFIG_H264
  1394. {
  1395. uint32_t enableTemporalSVC :1; /**< [in]: Set to 1 to enable SVC temporal*/
  1396. uint32_t enableStereoMVC :1; /**< [in]: Set to 1 to enable stereo MVC*/
  1397. uint32_t hierarchicalPFrames :1; /**< [in]: Set to 1 to enable hierarchical P Frames */
  1398. uint32_t hierarchicalBFrames :1; /**< [in]: Set to 1 to enable hierarchical B Frames */
  1399. uint32_t outputBufferingPeriodSEI :1; /**< [in]: Set to 1 to write SEI buffering period syntax in the bitstream */
  1400. uint32_t outputPictureTimingSEI :1; /**< [in]: Set to 1 to write SEI picture timing syntax in the bitstream. */
  1401. uint32_t outputAUD :1; /**< [in]: Set to 1 to write access unit delimiter syntax in bitstream */
  1402. uint32_t disableSPSPPS :1; /**< [in]: Set to 1 to disable writing of Sequence and Picture parameter info in bitstream */
  1403. uint32_t outputFramePackingSEI :1; /**< [in]: Set to 1 to enable writing of frame packing arrangement SEI messages to bitstream */
  1404. uint32_t outputRecoveryPointSEI :1; /**< [in]: Set to 1 to enable writing of recovery point SEI message */
  1405. uint32_t enableIntraRefresh :1; /**< [in]: Set to 1 to enable gradual decoder refresh or intra refresh. If the GOP structure uses B frames this will be ignored */
  1406. uint32_t enableConstrainedEncoding :1; /**< [in]: Set this to 1 to enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices.
  1407. Constrained encoding works only with rectangular slices.
  1408. Check support for constrained encoding using ::NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING caps. */
  1409. uint32_t repeatSPSPPS :1; /**< [in]: Set to 1 to enable writing of Sequence and Picture parameter for every IDR frame */
  1410. uint32_t enableVFR :1; /**< [in]: Setting enableVFR=1 currently only sets the fixed_frame_rate_flag=0 in the VUI but otherwise
  1411. has no impact on the encoder behavior. For more details please refer to E.1 VUI syntax of H.264 standard. Note, however, that NVENC does not support VFR encoding and rate control. */
  1412. uint32_t enableLTR :1; /**< [in]: Set to 1 to enable LTR (Long Term Reference) frame support. LTR can be used in two modes: "LTR Trust" mode and "LTR Per Picture" mode.
  1413. LTR Trust mode: In this mode, ltrNumFrames pictures after IDR are automatically marked as LTR. This mode is enabled by setting ltrTrustMode = 1.
  1414. Use of LTR Trust mode is strongly discouraged as this mode may be deprecated in future.
  1415. LTR Per Picture mode: In this mode, client can control whether the current picture should be marked as LTR. Enable this mode by setting
  1416. ltrTrustMode = 0 and ltrMarkFrame = 1 for the picture to be marked as LTR. This is the preferred mode
  1417. for using LTR.
  1418. Note that LTRs are not supported if encoding session is configured with B-frames */
  1419. uint32_t qpPrimeYZeroTransformBypassFlag :1; /**< [in]: To enable lossless encode set this to 1, set QP to 0 and RC_mode to NV_ENC_PARAMS_RC_CONSTQP and profile to HIGH_444_PREDICTIVE_PROFILE.
  1420. Check support for lossless encoding using ::NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE caps. */
  1421. uint32_t useConstrainedIntraPred :1; /**< [in]: Set 1 to enable constrained intra prediction. */
  1422. uint32_t enableFillerDataInsertion :1; /**< [in]: Set to 1 to enable insertion of filler data in the bitstream.
  1423. This flag will take effect only when one of the CBR rate
  1424. control modes (NV_ENC_PARAMS_RC_CBR, NV_ENC_PARAMS_RC_CBR_HQ,
  1425. NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) is in use and both
  1426. NV_ENC_INITIALIZE_PARAMS::frameRateNum and
  1427. NV_ENC_INITIALIZE_PARAMS::frameRateDen are set to non-zero
  1428. values. Setting this field when
  1429. NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is also set
  1430. is currently not supported and will make ::NvEncInitializeEncoder()
  1431. return an error. */
  1432. uint32_t disableSVCPrefixNalu :1; /**< [in]: Set to 1 to disable writing of SVC Prefix NALU preceding each slice in bitstream.
  1433. Applicable only when temporal SVC is enabled (NV_ENC_CONFIG_H264::enableTemporalSVC = 1). */
  1434. uint32_t enableScalabilityInfoSEI :1; /**< [in]: Set to 1 to enable writing of Scalability Information SEI message preceding each IDR picture in bitstream
  1435. Applicable only when temporal SVC is enabled (NV_ENC_CONFIG_H264::enableTemporalSVC = 1). */
  1436. uint32_t singleSliceIntraRefresh :1; /**< [in]: Set to 1 to maintain single slice in frames during intra refresh.
  1437. Check support for single slice intra refresh using ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps.
  1438. This flag will be ignored if the value returned for ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps is false. */
  1439. uint32_t enableTimeCode :1; /**< [in]: Set to 1 to enable writing of clock timestamp sets in picture timing SEI. Note that this flag will be ignored for D3D12 interface. */
  1440. uint32_t reservedBitFields :10; /**< [in]: Reserved bitfields and must be set to 0 */
  1441. uint32_t level; /**< [in]: Specifies the encoding level. Client is recommended to set this to NV_ENC_LEVEL_AUTOSELECT in order to enable the NvEncodeAPI interface to select the correct level. */
  1442. uint32_t idrPeriod; /**< [in]: Specifies the IDR interval. If not set, this is made equal to gopLength in NV_ENC_CONFIG.Low latency application client can set IDR interval to NVENC_INFINITE_GOPLENGTH so that IDR frames are not inserted automatically. */
  1443. uint32_t separateColourPlaneFlag; /**< [in]: Set to 1 to enable 4:4:4 separate colour planes */
  1444. uint32_t disableDeblockingFilterIDC; /**< [in]: Specifies the deblocking filter mode. Permissible value range: [0,2]. This flag corresponds
  1445. to the flag disable_deblocking_filter_idc specified in section 7.4.3 of H.264 specification,
  1446. which specifies whether the operation of the deblocking filter shall be disabled across some
  1447. block edges of the slice and specifies for which edges the filtering is disabled. See section
  1448. 7.4.3 of H.264 specification for more details.*/
  1449. uint32_t numTemporalLayers; /**< [in]: Specifies number of temporal layers to be used for hierarchical coding / temporal SVC. Valid value range is [1,::NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS] */
  1450. uint32_t spsId; /**< [in]: Specifies the SPS id of the sequence header */
  1451. uint32_t ppsId; /**< [in]: Specifies the PPS id of the picture header */
  1452. NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE adaptiveTransformMode; /**< [in]: Specifies the AdaptiveTransform Mode. Check support for AdaptiveTransform mode using ::NV_ENC_CAPS_SUPPORT_ADAPTIVE_TRANSFORM caps. */
  1453. NV_ENC_H264_FMO_MODE fmoMode; /**< [in]: Specified the FMO Mode. Check support for FMO using ::NV_ENC_CAPS_SUPPORT_FMO caps. */
  1454. NV_ENC_H264_BDIRECT_MODE bdirectMode; /**< [in]: Specifies the BDirect mode. Check support for BDirect mode using ::NV_ENC_CAPS_SUPPORT_BDIRECT_MODE caps.*/
  1455. NV_ENC_H264_ENTROPY_CODING_MODE entropyCodingMode; /**< [in]: Specifies the entropy coding mode. Check support for CABAC mode using ::NV_ENC_CAPS_SUPPORT_CABAC caps. */
  1456. NV_ENC_STEREO_PACKING_MODE stereoMode; /**< [in]: Specifies the stereo frame packing mode which is to be signaled in frame packing arrangement SEI */
  1457. uint32_t intraRefreshPeriod; /**< [in]: Specifies the interval between successive intra refresh if enableIntrarefresh is set. Requires enableIntraRefresh to be set.
  1458. Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */
  1459. uint32_t intraRefreshCnt; /**< [in]: Specifies the length of intra refresh in number of frames for periodic intra refresh. This value should be smaller than intraRefreshPeriod */
  1460. uint32_t maxNumRefFrames; /**< [in]: Specifies the DPB size used for encoding. Setting it to 0 will let driver use the default DPB size.
  1461. The low latency application which wants to invalidate reference frame as an error resilience tool
  1462. is recommended to use a large DPB size so that the encoder can keep old reference frames which can be used if recent
  1463. frames are invalidated. */
  1464. uint32_t sliceMode; /**< [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices
  1465. sliceMode = 0 MB based slices, sliceMode = 1 Byte based slices, sliceMode = 2 MB row based slices, sliceMode = 3 numSlices in Picture.
  1466. When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting
  1467. When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */
  1468. uint32_t sliceModeData; /**< [in]: Specifies the parameter needed for sliceMode. For:
  1469. sliceMode = 0, sliceModeData specifies # of MBs in each slice (except last slice)
  1470. sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice)
  1471. sliceMode = 2, sliceModeData specifies # of MB rows in each slice (except last slice)
  1472. sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */
  1473. NV_ENC_CONFIG_H264_VUI_PARAMETERS h264VUIParameters; /**< [in]: Specifies the H264 video usability info parameters */
  1474. uint32_t ltrNumFrames; /**< [in]: Specifies the number of LTR frames. This parameter has different meaning in two LTR modes.
  1475. In "LTR Trust" mode (ltrTrustMode = 1), encoder will mark the first ltrNumFrames base layer reference frames within each IDR interval as LTR.
  1476. In "LTR Per Picture" mode (ltrTrustMode = 0 and ltrMarkFrame = 1), ltrNumFrames specifies maximum number of LTR frames in DPB. */
  1477. uint32_t ltrTrustMode; /**< [in]: Specifies the LTR operating mode. See comments near NV_ENC_CONFIG_H264::enableLTR for description of the two modes.
  1478. Set to 1 to use "LTR Trust" mode of LTR operation. Clients are discouraged to use "LTR Trust" mode as this mode may
  1479. be deprecated in future releases.
  1480. Set to 0 when using "LTR Per Picture" mode of LTR operation. */
  1481. uint32_t chromaFormatIDC; /**< [in]: Specifies the chroma format. Should be set to 1 for yuv420 input, 3 for yuv444 input.
  1482. Check support for YUV444 encoding using ::NV_ENC_CAPS_SUPPORT_YUV444_ENCODE caps.*/
  1483. uint32_t maxTemporalLayers; /**< [in]: Specifies the max temporal layer used for temporal SVC / hierarchical coding.
  1484. Defaut value of this field is NV_ENC_CAPS::NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS. Note that the value NV_ENC_CONFIG_H264::maxNumRefFrames should
  1485. be greater than or equal to (NV_ENC_CONFIG_H264::maxTemporalLayers - 2) * 2, for NV_ENC_CONFIG_H264::maxTemporalLayers >= 2.*/
  1486. NV_ENC_BFRAME_REF_MODE useBFramesAsRef; /**< [in]: Specifies the B-Frame as reference mode. Check support for useBFramesAsRef mode using ::NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE caps.*/
  1487. NV_ENC_NUM_REF_FRAMES numRefL0; /**< [in]: Specifies max number of reference frames in reference picture list L0, that can be used by hardware for prediction of a frame.
  1488. Check support for numRefL0 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */
  1489. NV_ENC_NUM_REF_FRAMES numRefL1; /**< [in]: Specifies max number of reference frames in reference picture list L1, that can be used by hardware for prediction of a frame.
  1490. Check support for numRefL1 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */
  1491. uint32_t reserved1[267]; /**< [in]: Reserved and must be set to 0 */
  1492. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  1493. } NV_ENC_CONFIG_H264;
  1494. /**
  1495. * \struct _NV_ENC_CONFIG_HEVC
  1496. * HEVC encoder configuration parameters to be set during initialization.
  1497. */
  1498. typedef struct _NV_ENC_CONFIG_HEVC
  1499. {
  1500. uint32_t level; /**< [in]: Specifies the level of the encoded bitstream.*/
  1501. uint32_t tier; /**< [in]: Specifies the level tier of the encoded bitstream.*/
  1502. NV_ENC_HEVC_CUSIZE minCUSize; /**< [in]: Specifies the minimum size of luma coding unit.*/
  1503. NV_ENC_HEVC_CUSIZE maxCUSize; /**< [in]: Specifies the maximum size of luma coding unit. Currently NVENC SDK only supports maxCUSize equal to NV_ENC_HEVC_CUSIZE_32x32.*/
  1504. uint32_t useConstrainedIntraPred :1; /**< [in]: Set 1 to enable constrained intra prediction. */
  1505. uint32_t disableDeblockAcrossSliceBoundary :1; /**< [in]: Set 1 to disable in loop filtering across slice boundary.*/
  1506. uint32_t outputBufferingPeriodSEI :1; /**< [in]: Set 1 to write SEI buffering period syntax in the bitstream */
  1507. uint32_t outputPictureTimingSEI :1; /**< [in]: Set 1 to write SEI picture timing syntax in the bitstream */
  1508. uint32_t outputAUD :1; /**< [in]: Set 1 to write Access Unit Delimiter syntax. */
  1509. uint32_t enableLTR :1; /**< [in]: Set to 1 to enable LTR (Long Term Reference) frame support. LTR can be used in two modes: "LTR Trust" mode and "LTR Per Picture" mode.
  1510. LTR Trust mode: In this mode, ltrNumFrames pictures after IDR are automatically marked as LTR. This mode is enabled by setting ltrTrustMode = 1.
  1511. Use of LTR Trust mode is strongly discouraged as this mode may be deprecated in future releases.
  1512. LTR Per Picture mode: In this mode, client can control whether the current picture should be marked as LTR. Enable this mode by setting
  1513. ltrTrustMode = 0 and ltrMarkFrame = 1 for the picture to be marked as LTR. This is the preferred mode
  1514. for using LTR.
  1515. Note that LTRs are not supported if encoding session is configured with B-frames */
  1516. uint32_t disableSPSPPS :1; /**< [in]: Set 1 to disable VPS, SPS and PPS signaling in the bitstream. */
  1517. uint32_t repeatSPSPPS :1; /**< [in]: Set 1 to output VPS,SPS and PPS for every IDR frame.*/
  1518. uint32_t enableIntraRefresh :1; /**< [in]: Set 1 to enable gradual decoder refresh or intra refresh. If the GOP structure uses B frames this will be ignored */
  1519. uint32_t chromaFormatIDC :2; /**< [in]: Specifies the chroma format. Should be set to 1 for yuv420 input, 3 for yuv444 input.*/
  1520. uint32_t pixelBitDepthMinus8 :3; /**< [in]: Specifies pixel bit depth minus 8. Should be set to 0 for 8 bit input, 2 for 10 bit input.*/
  1521. uint32_t enableFillerDataInsertion :1; /**< [in]: Set to 1 to enable insertion of filler data in the bitstream.
  1522. This flag will take effect only when one of the CBR rate
  1523. control modes (NV_ENC_PARAMS_RC_CBR, NV_ENC_PARAMS_RC_CBR_HQ,
  1524. NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) is in use and both
  1525. NV_ENC_INITIALIZE_PARAMS::frameRateNum and
  1526. NV_ENC_INITIALIZE_PARAMS::frameRateDen are set to non-zero
  1527. values. Setting this field when
  1528. NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is also set
  1529. is currently not supported and will make ::NvEncInitializeEncoder()
  1530. return an error. */
  1531. uint32_t enableConstrainedEncoding :1; /**< [in]: Set this to 1 to enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices.
  1532. Constrained encoding works only with rectangular slices.
  1533. Check support for constrained encoding using ::NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING caps. */
  1534. uint32_t enableAlphaLayerEncoding :1; /**< [in]: Set this to 1 to enable HEVC encode with alpha layer. */
  1535. uint32_t singleSliceIntraRefresh :1; /**< [in]: Set this to 1 to maintain single slice frames during intra refresh.
  1536. Check support for single slice intra refresh using ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps.
  1537. This flag will be ignored if the value returned for ::NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH caps is false. */
  1538. uint32_t outputRecoveryPointSEI :1; /**< [in]: Set to 1 to enable writing of recovery point SEI message */
  1539. uint32_t outputTimeCodeSEI :1; /**< [in]: Set 1 to write SEI time code syntax in the bitstream. Note that this flag will be ignored for D3D12 interface.*/
  1540. uint32_t reserved :12; /**< [in]: Reserved bitfields.*/
  1541. uint32_t idrPeriod; /**< [in]: Specifies the IDR interval. If not set, this is made equal to gopLength in NV_ENC_CONFIG. Low latency application client can set IDR interval to NVENC_INFINITE_GOPLENGTH so that IDR frames are not inserted automatically. */
  1542. uint32_t intraRefreshPeriod; /**< [in]: Specifies the interval between successive intra refresh if enableIntrarefresh is set. Requires enableIntraRefresh to be set.
  1543. Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */
  1544. uint32_t intraRefreshCnt; /**< [in]: Specifies the length of intra refresh in number of frames for periodic intra refresh. This value should be smaller than intraRefreshPeriod */
  1545. uint32_t maxNumRefFramesInDPB; /**< [in]: Specifies the maximum number of references frames in the DPB.*/
  1546. uint32_t ltrNumFrames; /**< [in]: This parameter has different meaning in two LTR modes.
  1547. In "LTR Trust" mode (ltrTrustMode = 1), encoder will mark the first ltrNumFrames base layer reference frames within each IDR interval as LTR.
  1548. In "LTR Per Picture" mode (ltrTrustMode = 0 and ltrMarkFrame = 1), ltrNumFrames specifies maximum number of LTR frames in DPB.
  1549. These ltrNumFrames acts as a guidance to the encoder and are not necessarily honored. To achieve a right balance between the encoding
  1550. quality and keeping LTR frames in the DPB queue, the encoder can internally limit the number of LTR frames.
  1551. The number of LTR frames actually used depends upon the encoding preset being used; Faster encoding presets will use fewer LTR frames.*/
  1552. uint32_t vpsId; /**< [in]: Specifies the VPS id of the video parameter set */
  1553. uint32_t spsId; /**< [in]: Specifies the SPS id of the sequence header */
  1554. uint32_t ppsId; /**< [in]: Specifies the PPS id of the picture header */
  1555. uint32_t sliceMode; /**< [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices
  1556. sliceMode = 0 CTU based slices, sliceMode = 1 Byte based slices, sliceMode = 2 CTU row based slices, sliceMode = 3, numSlices in Picture
  1557. When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */
  1558. uint32_t sliceModeData; /**< [in]: Specifies the parameter needed for sliceMode. For:
  1559. sliceMode = 0, sliceModeData specifies # of CTUs in each slice (except last slice)
  1560. sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice)
  1561. sliceMode = 2, sliceModeData specifies # of CTU rows in each slice (except last slice)
  1562. sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */
  1563. uint32_t maxTemporalLayersMinus1; /**< [in]: Specifies the max temporal layer used for hierarchical coding. */
  1564. NV_ENC_CONFIG_HEVC_VUI_PARAMETERS hevcVUIParameters; /**< [in]: Specifies the HEVC video usability info parameters */
  1565. uint32_t ltrTrustMode; /**< [in]: Specifies the LTR operating mode. See comments near NV_ENC_CONFIG_HEVC::enableLTR for description of the two modes.
  1566. Set to 1 to use "LTR Trust" mode of LTR operation. Clients are discouraged to use "LTR Trust" mode as this mode may
  1567. be deprecated in future releases.
  1568. Set to 0 when using "LTR Per Picture" mode of LTR operation. */
  1569. NV_ENC_BFRAME_REF_MODE useBFramesAsRef; /**< [in]: Specifies the B-Frame as reference mode. Check support for useBFramesAsRef mode using ::NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE caps.*/
  1570. NV_ENC_NUM_REF_FRAMES numRefL0; /**< [in]: Specifies max number of reference frames in reference picture list L0, that can be used by hardware for prediction of a frame.
  1571. Check support for numRefL0 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */
  1572. NV_ENC_NUM_REF_FRAMES numRefL1; /**< [in]: Specifies max number of reference frames in reference picture list L1, that can be used by hardware for prediction of a frame.
  1573. Check support for numRefL1 using ::NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES caps. */
  1574. uint32_t reserved1[214]; /**< [in]: Reserved and must be set to 0.*/
  1575. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  1576. } NV_ENC_CONFIG_HEVC;
  1577. #define NV_MAX_TILE_COLS_AV1 64
  1578. #define NV_MAX_TILE_ROWS_AV1 64
  1579. /**
  1580. * \struct _NV_ENC_FILM_GRAIN_PARAMS_AV1
  1581. * AV1 Film Grain Parameters structure
  1582. */
  1583. typedef struct _NV_ENC_FILM_GRAIN_PARAMS_AV1
  1584. {
  1585. uint32_t applyGrain :1; /**< [in]: Set to 1 to specify film grain should be added to frame */
  1586. uint32_t chromaScalingFromLuma :1; /**< [in]: Set to 1 to specify the chroma scaling is inferred from luma scaling */
  1587. uint32_t overlapFlag :1; /**< [in]: Set to 1 to indicate that overlap between film grain blocks should be applied*/
  1588. uint32_t clipToRestrictedRange :1; /**< [in]: Set to 1 to clip values to restricted (studio) range after adding film grain */
  1589. uint32_t grainScalingMinus8 :2; /**< [in]: Represents the shift - 8 applied to the values of the chroma component */
  1590. uint32_t arCoeffLag :2; /**< [in]: Specifies the number of auto-regressive coefficients for luma and chroma */
  1591. uint32_t numYPoints :4; /**< [in]: Specifies the number of points for the piecewise linear scaling function of the luma component */
  1592. uint32_t numCbPoints :4; /**< [in]: Specifies the number of points for the piecewise linear scaling function of the cb component */
  1593. uint32_t numCrPoints :4; /**< [in]: Specifies the number of points for the piecewise linear scaling function of the cr component */
  1594. uint32_t arCoeffShiftMinus6 :2; /**< [in]: specifies the range of the auto-regressive coefficients */
  1595. uint32_t grainScaleShift :2; /**< [in]: Specifies how much the Gaussian random numbers should be scaled down during the grain synthesi process */
  1596. uint32_t reserved1 :8; /**< [in]: Reserved bits field - should be set to 0 */
  1597. uint8_t pointYValue[14]; /**< [in]: pointYValue[i]: x coordinate for i-th point of luma piecewise linear scaling function. Values on a scale of 0...255 */
  1598. uint8_t pointYScaling[14]; /**< [in]: pointYScaling[i]: i-th point output value of luma piecewise linear scaling function */
  1599. uint8_t pointCbValue[10]; /**< [in]: pointCbValue[i]: x coordinate for i-th point of cb piecewise linear scaling function. Values on a scale of 0...255 */
  1600. uint8_t pointCbScaling[10]; /**< [in]: pointCbScaling[i]: i-th point output value of cb piecewise linear scaling function */
  1601. uint8_t pointCrValue[10]; /**< [in]: pointCrValue[i]: x coordinate for i-th point of cr piecewise linear scaling function. Values on a scale of 0...255 */
  1602. uint8_t pointCrScaling[10]; /**< [in]: pointCrScaling[i]: i-th point output value of cr piecewise linear scaling function */
  1603. uint8_t arCoeffsYPlus128[24]; /**< [in]: Specifies auto-regressive coefficients used for the Y plane */
  1604. uint8_t arCoeffsCbPlus128[25]; /**< [in]: Specifies auto-regressive coefficients used for the U plane */
  1605. uint8_t arCoeffsCrPlus128[25]; /**< [in]: Specifies auto-regressive coefficients used for the V plane */
  1606. uint8_t reserved2[2]; /**< [in]: Reserved bytes - should be set to 0 */
  1607. uint8_t cbMult; /**< [in]: Represents a multiplier for the cb component used in derivation of the input index to the cb component scaling function */
  1608. uint8_t cbLumaMult; /**< [in]: represents a multiplier for the average luma component used in derivation of the input index to the cb component scaling function. */
  1609. uint16_t cbOffset; /**< [in]: Represents an offset used in derivation of the input index to the cb component scaling function */
  1610. uint8_t crMult; /**< [in]: Represents a multiplier for the cr component used in derivation of the input index to the cr component scaling function */
  1611. uint8_t crLumaMult; /**< [in]: represents a multiplier for the average luma component used in derivation of the input index to the cr component scaling function. */
  1612. uint16_t crOffset; /**< [in]: Represents an offset used in derivation of the input index to the cr component scaling function */
  1613. } NV_ENC_FILM_GRAIN_PARAMS_AV1;
  1614. /**
  1615. * \struct _NV_ENC_CONFIG_AV1
  1616. * AV1 encoder configuration parameters to be set during initialization.
  1617. */
  1618. typedef struct _NV_ENC_CONFIG_AV1
  1619. {
  1620. uint32_t level; /**< [in]: Specifies the level of the encoded bitstream.*/
  1621. uint32_t tier; /**< [in]: Specifies the level tier of the encoded bitstream.*/
  1622. NV_ENC_AV1_PART_SIZE minPartSize; /**< [in]: Specifies the minimum size of luma coding block partition.*/
  1623. NV_ENC_AV1_PART_SIZE maxPartSize; /**< [in]: Specifies the maximum size of luma coding block partition.*/
  1624. uint32_t outputAnnexBFormat : 1; /**< [in]: Set 1 to use Annex B format for bitstream output.*/
  1625. uint32_t enableTimingInfo : 1; /**< [in]: Set 1 to write Timing Info into sequence/frame headers */
  1626. uint32_t enableDecoderModelInfo : 1; /**< [in]: Set 1 to write Decoder Model Info into sequence/frame headers */
  1627. uint32_t enableFrameIdNumbers : 1; /**< [in]: Set 1 to write Frame id numbers in bitstream */
  1628. uint32_t disableSeqHdr : 1; /**< [in]: Set 1 to disable Sequence Header signaling in the bitstream. */
  1629. uint32_t repeatSeqHdr : 1; /**< [in]: Set 1 to output Sequence Header for every Key frame.*/
  1630. uint32_t enableIntraRefresh : 1; /**< [in]: Set 1 to enable gradual decoder refresh or intra refresh. If the GOP structure uses B frames this will be ignored */
  1631. uint32_t chromaFormatIDC : 2; /**< [in]: Specifies the chroma format. Should be set to 1 for yuv420 input (yuv444 input currently not supported).*/
  1632. uint32_t enableBitstreamPadding : 1; /**< [in]: Set 1 to enable bitstream padding. */
  1633. uint32_t enableCustomTileConfig : 1; /**< [in]: Set 1 to enable custom tile configuration: numTileColumns and numTileRows must have non zero values and tileWidths and tileHeights must point to a valid address */
  1634. uint32_t enableFilmGrainParams : 1; /**< [in]: Set 1 to enable custom film grain parameters: filmGrainParams must point to a valid address */
  1635. uint32_t inputPixelBitDepthMinus8 : 3; /**< [in]: Specifies pixel bit depth minus 8 of video input. Should be set to 0 for 8 bit input, 2 for 10 bit input.*/
  1636. uint32_t pixelBitDepthMinus8 : 3; /**< [in]: Specifies pixel bit depth minus 8 of encoded video. Should be set to 0 for 8 bit, 2 for 10 bit.
  1637. HW will do the bitdepth conversion internally from inputPixelBitDepthMinus8 -> pixelBitDepthMinus8 if bit dpeths differ
  1638. Support for 8 bit input to 10 bit encode conversion only */
  1639. uint32_t reserved : 14; /**< [in]: Reserved bitfields.*/
  1640. uint32_t idrPeriod; /**< [in]: Specifies the IDR/Key frame interval. If not set, this is made equal to gopLength in NV_ENC_CONFIG.Low latency application client can set IDR interval to NVENC_INFINITE_GOPLENGTH so that IDR frames are not inserted automatically. */
  1641. uint32_t intraRefreshPeriod; /**< [in]: Specifies the interval between successive intra refresh if enableIntrarefresh is set. Requires enableIntraRefresh to be set.
  1642. Will be disabled if NV_ENC_CONFIG::gopLength is not set to NVENC_INFINITE_GOPLENGTH. */
  1643. uint32_t intraRefreshCnt; /**< [in]: Specifies the length of intra refresh in number of frames for periodic intra refresh. This value should be smaller than intraRefreshPeriod */
  1644. uint32_t maxNumRefFramesInDPB; /**< [in]: Specifies the maximum number of references frames in the DPB.*/
  1645. uint32_t numTileColumns; /**< [in]: This parameter in conjunction with the flag enableCustomTileConfig and the array tileWidths[] specifies the way in which the picture is divided into tile columns.
  1646. When enableCustomTileConfig == 0, the picture will be uniformly divided into numTileColumns tile columns. If numTileColumns is not a power of 2,
  1647. it will be rounded down to the next power of 2 value. If numTileColumns == 0, the picture will be coded with the smallest number of vertical tiles as allowed by standard.
  1648. When enableCustomTileConfig == 1, numTileColumns must be > 0 and <= NV_MAX_TILE_COLS_AV1 and tileWidths must point to a valid array of numTileColumns entries.
  1649. Entry i specifies the width in 64x64 CTU unit of tile colum i. The sum of all the entries should be equal to the picture width in 64x64 CTU units. */
  1650. uint32_t numTileRows; /**< [in]: This parameter in conjunction with the flag enableCustomTileConfig and the array tileHeights[] specifies the way in which the picture is divided into tiles rows
  1651. When enableCustomTileConfig == 0, the picture will be uniformly divided into numTileRows tile rows. If numTileRows is not a power of 2,
  1652. it will be rounded down to the next power of 2 value. If numTileRows == 0, the picture will be coded with the smallest number of horizontal tiles as allowed by standard.
  1653. When enableCustomTileConfig == 1, numTileRows must be > 0 and <= NV_MAX_TILE_ROWS_AV1 and tileHeights must point to a valid array of numTileRows entries.
  1654. Entry i specifies the height in 64x64 CTU unit of tile row i. The sum of all the entries should be equal to the picture hieght in 64x64 CTU units. */
  1655. uint32_t *tileWidths; /**< [in]: If enableCustomTileConfig == 1, tileWidths[i] specifies the width of tile column i in 64x64 CTU unit, with 0 <= i <= numTileColumns -1. */
  1656. uint32_t *tileHeights; /**< [in]: If enableCustomTileConfig == 1, tileHeights[i] specifies the height of tile row i in 64x64 CTU unit, with 0 <= i <= numTileRows -1. */
  1657. uint32_t maxTemporalLayersMinus1; /**< [in]: Specifies the max temporal layer used for hierarchical coding. */
  1658. NV_ENC_VUI_COLOR_PRIMARIES colorPrimaries; /**< [in]: as defined in section of ISO/IEC 23091-4/ITU-T H.273 */
  1659. NV_ENC_VUI_TRANSFER_CHARACTERISTIC transferCharacteristics; /**< [in]: as defined in section of ISO/IEC 23091-4/ITU-T H.273 */
  1660. NV_ENC_VUI_MATRIX_COEFFS matrixCoefficients; /**< [in]: as defined in section of ISO/IEC 23091-4/ITU-T H.273 */
  1661. uint32_t colorRange; /**< [in]: 0: studio swing representation - 1: full swing representation */
  1662. uint32_t chromaSamplePosition; /**< [in]: 0: unknown
  1663. 1: Horizontally collocated with luma (0,0) sample, between two vertical samples
  1664. 2: Co-located with luma (0,0) sample */
  1665. NV_ENC_BFRAME_REF_MODE useBFramesAsRef; /**< [in]: Specifies the B-Frame as reference mode. Check support for useBFramesAsRef mode using ::NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE caps.*/
  1666. NV_ENC_FILM_GRAIN_PARAMS_AV1 *filmGrainParams; /**< [in]: If enableFilmGrainParams == 1, filmGrainParams must point to a valid NV_ENC_FILM_GRAIN_PARAMS_AV1 structure */
  1667. NV_ENC_NUM_REF_FRAMES numFwdRefs; /**< [in]: Specifies max number of forward reference frame used for prediction of a frame. It must be in range 1-4 (Last, Last2, last3 and Golden). It's a suggestive value not necessarily be honored always. */
  1668. NV_ENC_NUM_REF_FRAMES numBwdRefs; /**< [in]: Specifies max number of L1 list reference frame used for prediction of a frame. It must be in range 1-3 (Backward, Altref2, Altref). It's a suggestive value not necessarily be honored always. */
  1669. uint32_t reserved1[235]; /**< [in]: Reserved and must be set to 0.*/
  1670. void* reserved2[62]; /**< [in]: Reserved and must be set to NULL */
  1671. } NV_ENC_CONFIG_AV1;
  1672. /**
  1673. * \struct _NV_ENC_CONFIG_H264_MEONLY
  1674. * H264 encoder configuration parameters for ME only Mode
  1675. *
  1676. */
  1677. typedef struct _NV_ENC_CONFIG_H264_MEONLY
  1678. {
  1679. uint32_t disablePartition16x16 :1; /**< [in]: Disable Motion Estimation on 16x16 blocks*/
  1680. uint32_t disablePartition8x16 :1; /**< [in]: Disable Motion Estimation on 8x16 blocks*/
  1681. uint32_t disablePartition16x8 :1; /**< [in]: Disable Motion Estimation on 16x8 blocks*/
  1682. uint32_t disablePartition8x8 :1; /**< [in]: Disable Motion Estimation on 8x8 blocks*/
  1683. uint32_t disableIntraSearch :1; /**< [in]: Disable Intra search during Motion Estimation*/
  1684. uint32_t bStereoEnable :1; /**< [in]: Enable Stereo Mode for Motion Estimation where each view is independently executed*/
  1685. uint32_t reserved :26; /**< [in]: Reserved and must be set to 0 */
  1686. uint32_t reserved1 [255]; /**< [in]: Reserved and must be set to 0 */
  1687. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  1688. } NV_ENC_CONFIG_H264_MEONLY;
  1689. /**
  1690. * \struct _NV_ENC_CONFIG_HEVC_MEONLY
  1691. * HEVC encoder configuration parameters for ME only Mode
  1692. *
  1693. */
  1694. typedef struct _NV_ENC_CONFIG_HEVC_MEONLY
  1695. {
  1696. uint32_t reserved [256]; /**< [in]: Reserved and must be set to 0 */
  1697. void* reserved1[64]; /**< [in]: Reserved and must be set to NULL */
  1698. } NV_ENC_CONFIG_HEVC_MEONLY;
  1699. /**
  1700. * \struct _NV_ENC_CODEC_CONFIG
  1701. * Codec-specific encoder configuration parameters to be set during initialization.
  1702. */
  1703. typedef union _NV_ENC_CODEC_CONFIG
  1704. {
  1705. NV_ENC_CONFIG_H264 h264Config; /**< [in]: Specifies the H.264-specific encoder configuration. */
  1706. NV_ENC_CONFIG_HEVC hevcConfig; /**< [in]: Specifies the HEVC-specific encoder configuration. */
  1707. NV_ENC_CONFIG_AV1 av1Config; /**< [in]: Specifies the AV1-specific encoder configuration. */
  1708. NV_ENC_CONFIG_H264_MEONLY h264MeOnlyConfig; /**< [in]: Specifies the H.264-specific ME only encoder configuration. */
  1709. NV_ENC_CONFIG_HEVC_MEONLY hevcMeOnlyConfig; /**< [in]: Specifies the HEVC-specific ME only encoder configuration. */
  1710. uint32_t reserved[320]; /**< [in]: Reserved and must be set to 0 */
  1711. } NV_ENC_CODEC_CONFIG;
  1712. /**
  1713. * \struct _NV_ENC_CONFIG
  1714. * Encoder configuration parameters to be set during initialization.
  1715. */
  1716. typedef struct _NV_ENC_CONFIG
  1717. {
  1718. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_CONFIG_VER. */
  1719. GUID profileGUID; /**< [in]: Specifies the codec profile GUID. If client specifies \p NV_ENC_CODEC_PROFILE_AUTOSELECT_GUID the NvEncodeAPI interface will select the appropriate codec profile. */
  1720. uint32_t gopLength; /**< [in]: Specifies the number of pictures in one GOP. Low latency application client can set goplength to NVENC_INFINITE_GOPLENGTH so that keyframes are not inserted automatically. */
  1721. int32_t frameIntervalP; /**< [in]: Specifies the GOP pattern as follows: \p frameIntervalP = 0: I, 1: IPP, 2: IBP, 3: IBBP If goplength is set to NVENC_INFINITE_GOPLENGTH \p frameIntervalP should be set to 1. */
  1722. uint32_t monoChromeEncoding; /**< [in]: Set this to 1 to enable monochrome encoding for this session. */
  1723. NV_ENC_PARAMS_FRAME_FIELD_MODE frameFieldMode; /**< [in]: Specifies the frame/field mode.
  1724. Check support for field encoding using ::NV_ENC_CAPS_SUPPORT_FIELD_ENCODING caps.
  1725. Using a frameFieldMode other than NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME for RGB input is not supported. */
  1726. NV_ENC_MV_PRECISION mvPrecision; /**< [in]: Specifies the desired motion vector prediction precision. */
  1727. NV_ENC_RC_PARAMS rcParams; /**< [in]: Specifies the rate control parameters for the current encoding session. */
  1728. NV_ENC_CODEC_CONFIG encodeCodecConfig; /**< [in]: Specifies the codec specific config parameters through this union. */
  1729. uint32_t reserved [278]; /**< [in]: Reserved and must be set to 0 */
  1730. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  1731. } NV_ENC_CONFIG;
  1732. /** macro for constructing the version field of ::_NV_ENC_CONFIG */
  1733. #define NV_ENC_CONFIG_VER (NVENCAPI_STRUCT_VERSION(8) | ( 1<<31 ))
  1734. /**
  1735. * Tuning information of NVENC encoding (TuningInfo is not applicable to H264 and HEVC MEOnly mode).
  1736. */
  1737. typedef enum NV_ENC_TUNING_INFO
  1738. {
  1739. NV_ENC_TUNING_INFO_UNDEFINED = 0, /**< Undefined tuningInfo. Invalid value for encoding. */
  1740. NV_ENC_TUNING_INFO_HIGH_QUALITY = 1, /**< Tune presets for latency tolerant encoding.*/
  1741. NV_ENC_TUNING_INFO_LOW_LATENCY = 2, /**< Tune presets for low latency streaming.*/
  1742. NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY = 3, /**< Tune presets for ultra low latency streaming.*/
  1743. NV_ENC_TUNING_INFO_LOSSLESS = 4, /**< Tune presets for lossless encoding.*/
  1744. NV_ENC_TUNING_INFO_COUNT /**< Count number of tuningInfos. Invalid value. */
  1745. }NV_ENC_TUNING_INFO;
  1746. /**
  1747. * \struct _NV_ENC_INITIALIZE_PARAMS
  1748. * Encode Session Initialization parameters.
  1749. */
  1750. typedef struct _NV_ENC_INITIALIZE_PARAMS
  1751. {
  1752. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_INITIALIZE_PARAMS_VER. */
  1753. GUID encodeGUID; /**< [in]: Specifies the Encode GUID for which the encoder is being created. ::NvEncInitializeEncoder() API will fail if this is not set, or set to unsupported value. */
  1754. GUID presetGUID; /**< [in]: Specifies the preset for encoding. If the preset GUID is set then , the preset configuration will be applied before any other parameter. */
  1755. uint32_t encodeWidth; /**< [in]: Specifies the encode width. If not set ::NvEncInitializeEncoder() API will fail. */
  1756. uint32_t encodeHeight; /**< [in]: Specifies the encode height. If not set ::NvEncInitializeEncoder() API will fail. */
  1757. uint32_t darWidth; /**< [in]: Specifies the display aspect ratio Width. */
  1758. uint32_t darHeight; /**< [in]: Specifies the display aspect ratio height. */
  1759. uint32_t frameRateNum; /**< [in]: Specifies the numerator for frame rate used for encoding in frames per second ( Frame rate = frameRateNum / frameRateDen ). */
  1760. uint32_t frameRateDen; /**< [in]: Specifies the denominator for frame rate used for encoding in frames per second ( Frame rate = frameRateNum / frameRateDen ). */
  1761. uint32_t enableEncodeAsync; /**< [in]: Set this to 1 to enable asynchronous mode and is expected to use events to get picture completion notification. */
  1762. uint32_t enablePTD; /**< [in]: Set this to 1 to enable the Picture Type Decision is be taken by the NvEncodeAPI interface. */
  1763. uint32_t reportSliceOffsets :1; /**< [in]: Set this to 1 to enable reporting slice offsets in ::_NV_ENC_LOCK_BITSTREAM. NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync must be set to 0 to use this feature. Client must set this to 0 if NV_ENC_CONFIG_H264::sliceMode is 1 on Kepler GPUs */
  1764. uint32_t enableSubFrameWrite :1; /**< [in]: Set this to 1 to write out available bitstream to memory at subframe intervals.
  1765. If enableSubFrameWrite = 1, then the hardware encoder returns data as soon as a slice (H264/HEVC) or tile (AV1) has completed encoding.
  1766. This results in better encoding latency, but the downside is that the application has to keep polling via a call to nvEncLockBitstream API continuously to see if any encoded slice/tile data is available.
  1767. Use this mode if you feel that the marginal reduction in latency from sub-frame encoding is worth the increase in complexity due to CPU-based polling. */
  1768. uint32_t enableExternalMEHints :1; /**< [in]: Set to 1 to enable external ME hints for the current frame. For NV_ENC_INITIALIZE_PARAMS::enablePTD=1 with B frames, programming L1 hints is optional for B frames since Client doesn't know internal GOP structure.
  1769. NV_ENC_PIC_PARAMS::meHintRefPicDist should preferably be set with enablePTD=1. */
  1770. uint32_t enableMEOnlyMode :1; /**< [in]: Set to 1 to enable ME Only Mode .*/
  1771. uint32_t enableWeightedPrediction :1; /**< [in]: Set this to 1 to enable weighted prediction. Not supported if encode session is configured for B-Frames (i.e. NV_ENC_CONFIG::frameIntervalP > 1 or preset >=P3 when tuningInfo = ::NV_ENC_TUNING_INFO_HIGH_QUALITY or
  1772. tuningInfo = ::NV_ENC_TUNING_INFO_LOSSLESS. This is because preset >=p3 internally enables B frames when tuningInfo = ::NV_ENC_TUNING_INFO_HIGH_QUALITY or ::NV_ENC_TUNING_INFO_LOSSLESS). */
  1773. uint32_t enableOutputInVidmem :1; /**< [in]: Set this to 1 to enable output of NVENC in video memory buffer created by application. This feature is not supported for HEVC ME only mode. */
  1774. uint32_t reservedBitFields :26; /**< [in]: Reserved bitfields and must be set to 0 */
  1775. uint32_t privDataSize; /**< [in]: Reserved private data buffer size and must be set to 0 */
  1776. void* privData; /**< [in]: Reserved private data buffer and must be set to NULL */
  1777. NV_ENC_CONFIG* encodeConfig; /**< [in]: Specifies the advanced codec specific structure. If client has sent a valid codec config structure, it will override parameters set by the NV_ENC_INITIALIZE_PARAMS::presetGUID parameter. If set to NULL the NvEncodeAPI interface will use the NV_ENC_INITIALIZE_PARAMS::presetGUID to set the codec specific parameters.
  1778. Client can also optionally query the NvEncodeAPI interface to get codec specific parameters for a presetGUID using ::NvEncGetEncodePresetConfig() API. It can then modify (if required) some of the codec config parameters and send down a custom config structure as part of ::_NV_ENC_INITIALIZE_PARAMS.
  1779. Even in this case client is recommended to pass the same preset guid it has used in ::NvEncGetEncodePresetConfig() API to query the config structure; as NV_ENC_INITIALIZE_PARAMS::presetGUID. This will not override the custom config structure but will be used to determine other Encoder HW specific parameters not exposed in the API. */
  1780. uint32_t maxEncodeWidth; /**< [in]: Maximum encode width to be used for current Encode session.
  1781. Client should allocate output buffers according to this dimension for dynamic resolution change. If set to 0, Encoder will not allow dynamic resolution change. */
  1782. uint32_t maxEncodeHeight; /**< [in]: Maximum encode height to be allowed for current Encode session.
  1783. Client should allocate output buffers according to this dimension for dynamic resolution change. If set to 0, Encode will not allow dynamic resolution change. */
  1784. NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE maxMEHintCountsPerBlock[2]; /**< [in]: If Client wants to pass external motion vectors in NV_ENC_PIC_PARAMS::meExternalHints buffer it must specify the maximum number of hint candidates per block per direction for the encode session.
  1785. The NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[0] is for L0 predictors and NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[1] is for L1 predictors.
  1786. This client must also set NV_ENC_INITIALIZE_PARAMS::enableExternalMEHints to 1. */
  1787. NV_ENC_TUNING_INFO tuningInfo; /**< [in]: Tuning Info of NVENC encoding(TuningInfo is not applicable to H264 and HEVC meonly mode). */
  1788. NV_ENC_BUFFER_FORMAT bufferFormat; /**< [in]: Input buffer format. Used only when DX12 interface type is used */
  1789. uint32_t reserved [287]; /**< [in]: Reserved and must be set to 0 */
  1790. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  1791. } NV_ENC_INITIALIZE_PARAMS;
  1792. /** macro for constructing the version field of ::_NV_ENC_INITIALIZE_PARAMS */
  1793. #define NV_ENC_INITIALIZE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(5) | ( 1<<31 ))
  1794. /**
  1795. * \struct _NV_ENC_RECONFIGURE_PARAMS
  1796. * Encode Session Reconfigured parameters.
  1797. */
  1798. typedef struct _NV_ENC_RECONFIGURE_PARAMS
  1799. {
  1800. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_RECONFIGURE_PARAMS_VER. */
  1801. NV_ENC_INITIALIZE_PARAMS reInitEncodeParams; /**< [in]: Encoder session re-initialization parameters.
  1802. If reInitEncodeParams.encodeConfig is NULL and
  1803. reInitEncodeParams.presetGUID is the same as the preset
  1804. GUID specified on the call to NvEncInitializeEncoder(),
  1805. EncodeAPI will continue to use the existing encode
  1806. configuration.
  1807. If reInitEncodeParams.encodeConfig is NULL and
  1808. reInitEncodeParams.presetGUID is different from the preset
  1809. GUID specified on the call to NvEncInitializeEncoder(),
  1810. EncodeAPI will try to use the default configuration for
  1811. the preset specified by reInitEncodeParams.presetGUID.
  1812. In this case, reconfiguration may fail if the new
  1813. configuration is incompatible with the existing
  1814. configuration (e.g. the new configuration results in
  1815. a change in the GOP structure). */
  1816. uint32_t resetEncoder :1; /**< [in]: This resets the rate control states and other internal encoder states. This should be used only with an IDR frame.
  1817. If NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1, encoder will force the frame type to IDR */
  1818. uint32_t forceIDR :1; /**< [in]: Encode the current picture as an IDR picture. This flag is only valid when Picture type decision is taken by the Encoder
  1819. [_NV_ENC_INITIALIZE_PARAMS::enablePTD == 1]. */
  1820. uint32_t reserved :30;
  1821. }NV_ENC_RECONFIGURE_PARAMS;
  1822. /** macro for constructing the version field of ::_NV_ENC_RECONFIGURE_PARAMS */
  1823. #define NV_ENC_RECONFIGURE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(1) | ( 1<<31 ))
  1824. /**
  1825. * \struct _NV_ENC_PRESET_CONFIG
  1826. * Encoder preset config
  1827. */
  1828. typedef struct _NV_ENC_PRESET_CONFIG
  1829. {
  1830. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_PRESET_CONFIG_VER. */
  1831. NV_ENC_CONFIG presetCfg; /**< [out]: preset config returned by the Nvidia Video Encoder interface. */
  1832. uint32_t reserved1[255]; /**< [in]: Reserved and must be set to 0 */
  1833. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  1834. }NV_ENC_PRESET_CONFIG;
  1835. /** macro for constructing the version field of ::_NV_ENC_PRESET_CONFIG */
  1836. #define NV_ENC_PRESET_CONFIG_VER (NVENCAPI_STRUCT_VERSION(4) | ( 1<<31 ))
  1837. /**
  1838. * \struct _NV_ENC_PIC_PARAMS_MVC
  1839. * MVC-specific parameters to be sent on a per-frame basis.
  1840. */
  1841. typedef struct _NV_ENC_PIC_PARAMS_MVC
  1842. {
  1843. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_PIC_PARAMS_MVC_VER. */
  1844. uint32_t viewID; /**< [in]: Specifies the view ID associated with the current input view. */
  1845. uint32_t temporalID; /**< [in]: Specifies the temporal ID associated with the current input view. */
  1846. uint32_t priorityID; /**< [in]: Specifies the priority ID associated with the current input view. Reserved and ignored by the NvEncodeAPI interface. */
  1847. uint32_t reserved1[12]; /**< [in]: Reserved and must be set to 0. */
  1848. void* reserved2[8]; /**< [in]: Reserved and must be set to NULL. */
  1849. }NV_ENC_PIC_PARAMS_MVC;
  1850. /** macro for constructing the version field of ::_NV_ENC_PIC_PARAMS_MVC */
  1851. #define NV_ENC_PIC_PARAMS_MVC_VER NVENCAPI_STRUCT_VERSION(1)
  1852. /**
  1853. * \union _NV_ENC_PIC_PARAMS_H264_EXT
  1854. * H264 extension picture parameters
  1855. */
  1856. typedef union _NV_ENC_PIC_PARAMS_H264_EXT
  1857. {
  1858. NV_ENC_PIC_PARAMS_MVC mvcPicParams; /**< [in]: Specifies the MVC picture parameters. */
  1859. uint32_t reserved1[32]; /**< [in]: Reserved and must be set to 0. */
  1860. }NV_ENC_PIC_PARAMS_H264_EXT;
  1861. /**
  1862. * \struct _NV_ENC_SEI_PAYLOAD
  1863. * User SEI message
  1864. */
  1865. typedef struct _NV_ENC_SEI_PAYLOAD
  1866. {
  1867. uint32_t payloadSize; /**< [in] SEI payload size in bytes. SEI payload must be byte aligned, as described in Annex D */
  1868. uint32_t payloadType; /**< [in] SEI payload types and syntax can be found in Annex D of the H.264 Specification. */
  1869. uint8_t *payload; /**< [in] pointer to user data */
  1870. } NV_ENC_SEI_PAYLOAD;
  1871. #define NV_ENC_H264_SEI_PAYLOAD NV_ENC_SEI_PAYLOAD
  1872. /**
  1873. * \struct _NV_ENC_PIC_PARAMS_H264
  1874. * H264 specific enc pic params. sent on a per frame basis.
  1875. */
  1876. typedef struct _NV_ENC_PIC_PARAMS_H264
  1877. {
  1878. uint32_t displayPOCSyntax; /**< [in]: Specifies the display POC syntax This is required to be set if client is handling the picture type decision. */
  1879. uint32_t reserved3; /**< [in]: Reserved and must be set to 0 */
  1880. uint32_t refPicFlag; /**< [in]: Set to 1 for a reference picture. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
  1881. uint32_t colourPlaneId; /**< [in]: Specifies the colour plane ID associated with the current input. */
  1882. uint32_t forceIntraRefreshWithFrameCnt; /**< [in]: Forces an intra refresh with duration equal to intraRefreshFrameCnt.
  1883. When outputRecoveryPointSEI is set this is value is used for recovery_frame_cnt in recovery point SEI message
  1884. forceIntraRefreshWithFrameCnt cannot be used if B frames are used in the GOP structure specified */
  1885. uint32_t constrainedFrame :1; /**< [in]: Set to 1 if client wants to encode this frame with each slice completely independent of other slices in the frame.
  1886. NV_ENC_INITIALIZE_PARAMS::enableConstrainedEncoding should be set to 1 */
  1887. uint32_t sliceModeDataUpdate :1; /**< [in]: Set to 1 if client wants to change the sliceModeData field to specify new sliceSize Parameter
  1888. When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting */
  1889. uint32_t ltrMarkFrame :1; /**< [in]: Set to 1 if client wants to mark this frame as LTR */
  1890. uint32_t ltrUseFrames :1; /**< [in]: Set to 1 if client allows encoding this frame using the LTR frames specified in ltrFrameBitmap */
  1891. uint32_t reservedBitFields :28; /**< [in]: Reserved bit fields and must be set to 0 */
  1892. uint8_t* sliceTypeData; /**< [in]: Deprecated. */
  1893. uint32_t sliceTypeArrayCnt; /**< [in]: Deprecated. */
  1894. uint32_t seiPayloadArrayCnt; /**< [in]: Specifies the number of elements allocated in seiPayloadArray array. */
  1895. NV_ENC_SEI_PAYLOAD* seiPayloadArray; /**< [in]: Array of SEI payloads which will be inserted for this frame. */
  1896. uint32_t sliceMode; /**< [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices
  1897. sliceMode = 0 MB based slices, sliceMode = 1 Byte based slices, sliceMode = 2 MB row based slices, sliceMode = 3, numSlices in Picture
  1898. When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting
  1899. When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */
  1900. uint32_t sliceModeData; /**< [in]: Specifies the parameter needed for sliceMode. For:
  1901. sliceMode = 0, sliceModeData specifies # of MBs in each slice (except last slice)
  1902. sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice)
  1903. sliceMode = 2, sliceModeData specifies # of MB rows in each slice (except last slice)
  1904. sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */
  1905. uint32_t ltrMarkFrameIdx; /**< [in]: Specifies the long term referenceframe index to use for marking this frame as LTR.*/
  1906. uint32_t ltrUseFrameBitmap; /**< [in]: Specifies the associated bitmap of LTR frame indices to use when encoding this frame. */
  1907. uint32_t ltrUsageMode; /**< [in]: Not supported. Reserved for future use and must be set to 0. */
  1908. uint32_t forceIntraSliceCount; /**< [in]: Specifies the number of slices to be forced to Intra in the current picture.
  1909. This option along with forceIntraSliceIdx[] array needs to be used with sliceMode = 3 only */
  1910. uint32_t *forceIntraSliceIdx; /**< [in]: Slice indices to be forced to intra in the current picture. Each slice index should be <= num_slices_in_picture -1. Index starts from 0 for first slice.
  1911. The number of entries in this array should be equal to forceIntraSliceCount */
  1912. NV_ENC_PIC_PARAMS_H264_EXT h264ExtPicParams; /**< [in]: Specifies the H264 extension config parameters using this config. */
  1913. NV_ENC_TIME_CODE timeCode; /**< [in]: Specifies the clock timestamp sets used in picture timing SEI. Applicable only when NV_ENC_CONFIG_H264::enableTimeCode is set to 1. */
  1914. uint32_t reserved [203]; /**< [in]: Reserved and must be set to 0. */
  1915. void* reserved2[61]; /**< [in]: Reserved and must be set to NULL. */
  1916. } NV_ENC_PIC_PARAMS_H264;
  1917. /**
  1918. * \struct _NV_ENC_PIC_PARAMS_HEVC
  1919. * HEVC specific enc pic params. sent on a per frame basis.
  1920. */
  1921. typedef struct _NV_ENC_PIC_PARAMS_HEVC
  1922. {
  1923. uint32_t displayPOCSyntax; /**< [in]: Specifies the display POC syntax This is required to be set if client is handling the picture type decision. */
  1924. uint32_t refPicFlag; /**< [in]: Set to 1 for a reference picture. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
  1925. uint32_t temporalId; /**< [in]: Specifies the temporal id of the picture */
  1926. uint32_t forceIntraRefreshWithFrameCnt; /**< [in]: Forces an intra refresh with duration equal to intraRefreshFrameCnt.
  1927. When outputRecoveryPointSEI is set this is value is used for recovery_frame_cnt in recovery point SEI message
  1928. forceIntraRefreshWithFrameCnt cannot be used if B frames are used in the GOP structure specified */
  1929. uint32_t constrainedFrame :1; /**< [in]: Set to 1 if client wants to encode this frame with each slice completely independent of other slices in the frame.
  1930. NV_ENC_INITIALIZE_PARAMS::enableConstrainedEncoding should be set to 1 */
  1931. uint32_t sliceModeDataUpdate :1; /**< [in]: Set to 1 if client wants to change the sliceModeData field to specify new sliceSize Parameter
  1932. When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting */
  1933. uint32_t ltrMarkFrame :1; /**< [in]: Set to 1 if client wants to mark this frame as LTR */
  1934. uint32_t ltrUseFrames :1; /**< [in]: Set to 1 if client allows encoding this frame using the LTR frames specified in ltrFrameBitmap */
  1935. uint32_t reservedBitFields :28; /**< [in]: Reserved bit fields and must be set to 0 */
  1936. uint8_t* sliceTypeData; /**< [in]: Array which specifies the slice type used to force intra slice for a particular slice. Currently supported only for NV_ENC_CONFIG_H264::sliceMode == 3.
  1937. Client should allocate array of size sliceModeData where sliceModeData is specified in field of ::_NV_ENC_CONFIG_H264
  1938. Array element with index n corresponds to nth slice. To force a particular slice to intra client should set corresponding array element to NV_ENC_SLICE_TYPE_I
  1939. all other array elements should be set to NV_ENC_SLICE_TYPE_DEFAULT */
  1940. uint32_t sliceTypeArrayCnt; /**< [in]: Client should set this to the number of elements allocated in sliceTypeData array. If sliceTypeData is NULL then this should be set to 0 */
  1941. uint32_t sliceMode; /**< [in]: This parameter in conjunction with sliceModeData specifies the way in which the picture is divided into slices
  1942. sliceMode = 0 CTU based slices, sliceMode = 1 Byte based slices, sliceMode = 2 CTU row based slices, sliceMode = 3, numSlices in Picture
  1943. When forceIntraRefreshWithFrameCnt is set it will have priority over sliceMode setting
  1944. When sliceMode == 0 and sliceModeData == 0 whole picture will be coded with one slice */
  1945. uint32_t sliceModeData; /**< [in]: Specifies the parameter needed for sliceMode. For:
  1946. sliceMode = 0, sliceModeData specifies # of CTUs in each slice (except last slice)
  1947. sliceMode = 1, sliceModeData specifies maximum # of bytes in each slice (except last slice)
  1948. sliceMode = 2, sliceModeData specifies # of CTU rows in each slice (except last slice)
  1949. sliceMode = 3, sliceModeData specifies number of slices in the picture. Driver will divide picture into slices optimally */
  1950. uint32_t ltrMarkFrameIdx; /**< [in]: Specifies the long term reference frame index to use for marking this frame as LTR.*/
  1951. uint32_t ltrUseFrameBitmap; /**< [in]: Specifies the associated bitmap of LTR frame indices to use when encoding this frame. */
  1952. uint32_t ltrUsageMode; /**< [in]: Not supported. Reserved for future use and must be set to 0. */
  1953. uint32_t seiPayloadArrayCnt; /**< [in]: Specifies the number of elements allocated in seiPayloadArray array. */
  1954. uint32_t reserved; /**< [in]: Reserved and must be set to 0. */
  1955. NV_ENC_SEI_PAYLOAD* seiPayloadArray; /**< [in]: Array of SEI payloads which will be inserted for this frame. */
  1956. NV_ENC_TIME_CODE timeCode; /**< [in]: Specifies the clock timestamp sets used in time code SEI. Applicable only when NV_ENC_CONFIG_HEVC::enableTimeCodeSEI is set to 1. */
  1957. uint32_t reserved2 [237]; /**< [in]: Reserved and must be set to 0. */
  1958. void* reserved3[61]; /**< [in]: Reserved and must be set to NULL. */
  1959. } NV_ENC_PIC_PARAMS_HEVC;
  1960. #define NV_ENC_AV1_OBU_PAYLOAD NV_ENC_SEI_PAYLOAD
  1961. /**
  1962. * \struct _NV_ENC_PIC_PARAMS_AV1
  1963. * AV1 specific enc pic params. sent on a per frame basis.
  1964. */
  1965. typedef struct _NV_ENC_PIC_PARAMS_AV1
  1966. {
  1967. uint32_t displayPOCSyntax; /**< [in]: Specifies the display POC syntax This is required to be set if client is handling the picture type decision. */
  1968. uint32_t refPicFlag; /**< [in]: Set to 1 for a reference picture. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
  1969. uint32_t temporalId; /**< [in]: Specifies the temporal id of the picture */
  1970. uint32_t forceIntraRefreshWithFrameCnt; /**< [in]: Forces an intra refresh with duration equal to intraRefreshFrameCnt.
  1971. forceIntraRefreshWithFrameCnt cannot be used if B frames are used in the GOP structure specified */
  1972. uint32_t goldenFrameFlag : 1; /**< [in]: Encode frame as Golden Frame. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
  1973. uint32_t arfFrameFlag : 1; /**< [in]: Encode frame as Alternate Reference Frame. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
  1974. uint32_t arf2FrameFlag : 1; /**< [in]: Encode frame as Alternate Reference 2 Frame. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
  1975. uint32_t bwdFrameFlag : 1; /**< [in]: Encode frame as Backward Reference Frame. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
  1976. uint32_t overlayFrameFlag : 1; /**< [in]: Encode frame as overlay frame. A previously encoded frame with the same displayPOCSyntax value should be present in reference frame buffer.
  1977. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
  1978. uint32_t showExistingFrameFlag : 1; /**< [in]: When ovelayFrameFlag is set to 1, this flag controls the value of the show_existing_frame syntax element associated with the overlay frame.
  1979. This flag is added to the interface as a placeholder. Its value is ignored for now and always assumed to be set to 1.
  1980. This is ignored if NV_ENC_INITIALIZE_PARAMS::enablePTD is set to 1. */
  1981. uint32_t errorResilientModeFlag : 1; /**< [in]: encode frame independently from previously encoded frames */
  1982. uint32_t tileConfigUpdate : 1; /**< [in]: Set to 1 if client wants to overwrite the default tile configuration with the tile parameters specified below
  1983. When forceIntraRefreshWithFrameCnt is set it will have priority over tileConfigUpdate setting */
  1984. uint32_t enableCustomTileConfig : 1; /**< [in]: Set 1 to enable custom tile configuration: numTileColumns and numTileRows must have non zero values and tileWidths and tileHeights must point to a valid address */
  1985. uint32_t filmGrainParamsUpdate : 1; /**< [in]: Set to 1 if client wants to update previous film grain parameters: filmGrainParams must point to a valid address and encoder must have been configured with film grain enabled */
  1986. uint32_t reservedBitFields : 22; /**< [in]: Reserved bitfields and must be set to 0 */
  1987. uint32_t numTileColumns; /**< [in]: This parameter in conjunction with the flag enableCustomTileConfig and the array tileWidths[] specifies the way in which the picture is divided into tile columns.
  1988. When enableCustomTileConfig == 0, the picture will be uniformly divided into numTileColumns tile columns. If numTileColumns is not a power of 2,
  1989. it will be rounded down to the next power of 2 value. If numTileColumns == 0, the picture will be coded with the smallest number of vertical tiles as allowed by standard.
  1990. When enableCustomTileConfig == 1, numTileColumns must be > 0 and <= NV_MAX_TILE_COLS_AV1 and tileWidths must point to a valid array of numTileColumns entries.
  1991. Entry i specifies the width in 64x64 CTU unit of tile colum i. The sum of all the entries should be equal to the picture width in 64x64 CTU units. */
  1992. uint32_t numTileRows; /**< [in]: This parameter in conjunction with the flag enableCustomTileConfig and the array tileHeights[] specifies the way in which the picture is divided into tiles rows
  1993. When enableCustomTileConfig == 0, the picture will be uniformly divided into numTileRows tile rows. If numTileRows is not a power of 2,
  1994. it will be rounded down to the next power of 2 value. If numTileRows == 0, the picture will be coded with the smallest number of horizontal tiles as allowed by standard.
  1995. When enableCustomTileConfig == 1, numTileRows must be > 0 and <= NV_MAX_TILE_ROWS_AV1 and tileHeights must point to a valid array of numTileRows entries.
  1996. Entry i specifies the height in 64x64 CTU unit of tile row i. The sum of all the entries should be equal to the picture hieght in 64x64 CTU units. */
  1997. uint32_t *tileWidths; /**< [in]: If enableCustomTileConfig == 1, tileWidths[i] specifies the width of tile column i in 64x64 CTU unit, with 0 <= i <= numTileColumns -1. */
  1998. uint32_t *tileHeights; /**< [in]: If enableCustomTileConfig == 1, tileHeights[i] specifies the height of tile row i in 64x64 CTU unit, with 0 <= i <= numTileRows -1. */
  1999. uint32_t obuPayloadArrayCnt; /**< [in]: Specifies the number of elements allocated in obuPayloadArray array. */
  2000. uint32_t reserved; /**< [in]: Reserved and must be set to 0. */
  2001. NV_ENC_AV1_OBU_PAYLOAD* obuPayloadArray; /**< [in]: Array of OBU payloads which will be inserted for this frame. */
  2002. NV_ENC_FILM_GRAIN_PARAMS_AV1 *filmGrainParams; /**< [in]: If filmGrainParamsUpdate == 1, filmGrainParams must point to a valid NV_ENC_FILM_GRAIN_PARAMS_AV1 structure */
  2003. uint32_t reserved2[247]; /**< [in]: Reserved and must be set to 0. */
  2004. void* reserved3[61]; /**< [in]: Reserved and must be set to NULL. */
  2005. } NV_ENC_PIC_PARAMS_AV1;
  2006. /**
  2007. * Codec specific per-picture encoding parameters.
  2008. */
  2009. typedef union _NV_ENC_CODEC_PIC_PARAMS
  2010. {
  2011. NV_ENC_PIC_PARAMS_H264 h264PicParams; /**< [in]: H264 encode picture params. */
  2012. NV_ENC_PIC_PARAMS_HEVC hevcPicParams; /**< [in]: HEVC encode picture params. */
  2013. NV_ENC_PIC_PARAMS_AV1 av1PicParams; /**< [in]: AV1 encode picture params. */
  2014. uint32_t reserved[256]; /**< [in]: Reserved and must be set to 0. */
  2015. } NV_ENC_CODEC_PIC_PARAMS;
  2016. /**
  2017. * \struct _NV_ENC_PIC_PARAMS
  2018. * Encoding parameters that need to be sent on a per frame basis.
  2019. */
  2020. typedef struct _NV_ENC_PIC_PARAMS
  2021. {
  2022. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_PIC_PARAMS_VER. */
  2023. uint32_t inputWidth; /**< [in]: Specifies the input frame width */
  2024. uint32_t inputHeight; /**< [in]: Specifies the input frame height */
  2025. uint32_t inputPitch; /**< [in]: Specifies the input buffer pitch. If pitch value is not known, set this to inputWidth. */
  2026. uint32_t encodePicFlags; /**< [in]: Specifies bit-wise OR of encode picture flags. See ::NV_ENC_PIC_FLAGS enum. */
  2027. uint32_t frameIdx; /**< [in]: Specifies the frame index associated with the input frame [optional]. */
  2028. uint64_t inputTimeStamp; /**< [in]: Specifies opaque data which is associated with the encoded frame, but not actually encoded in the output bitstream.
  2029. This opaque data can be used later to uniquely refer to the corresponding encoded frame. For example, it can be used
  2030. for identifying the frame to be invalidated in the reference picture buffer, if lost at the client. */
  2031. uint64_t inputDuration; /**< [in]: Specifies duration of the input picture */
  2032. NV_ENC_INPUT_PTR inputBuffer; /**< [in]: Specifies the input buffer pointer. Client must use a pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource() APIs.*/
  2033. NV_ENC_OUTPUT_PTR outputBitstream; /**< [in]: Specifies the output buffer pointer.
  2034. If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 0, specifies the pointer to output buffer. Client should use a pointer obtained from ::NvEncCreateBitstreamBuffer() API.
  2035. If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 1, client should allocate buffer in video memory for NV_ENC_ENCODE_OUT_PARAMS struct and encoded bitstream data. Client
  2036. should use a pointer obtained from ::NvEncMapInputResource() API, when mapping this output buffer and assign it to NV_ENC_PIC_PARAMS::outputBitstream.
  2037. First 256 bytes of this buffer should be interpreted as NV_ENC_ENCODE_OUT_PARAMS struct followed by encoded bitstream data. Recommended size for output buffer is sum of size of
  2038. NV_ENC_ENCODE_OUT_PARAMS struct and twice the input frame size for lower resolution eg. CIF and 1.5 times the input frame size for higher resolutions. If encoded bitstream size is
  2039. greater than the allocated buffer size for encoded bitstream, then the output buffer will have encoded bitstream data equal to buffer size. All CUDA operations on this buffer must use
  2040. the default stream. */
  2041. void* completionEvent; /**< [in]: Specifies an event to be signaled on completion of encoding of this Frame [only if operating in Asynchronous mode]. Each output buffer should be associated with a distinct event pointer. */
  2042. NV_ENC_BUFFER_FORMAT bufferFmt; /**< [in]: Specifies the input buffer format. */
  2043. NV_ENC_PIC_STRUCT pictureStruct; /**< [in]: Specifies structure of the input picture. */
  2044. NV_ENC_PIC_TYPE pictureType; /**< [in]: Specifies input picture type. Client required to be set explicitly by the client if the client has not set NV_ENC_INITALIZE_PARAMS::enablePTD to 1 while calling NvInitializeEncoder. */
  2045. NV_ENC_CODEC_PIC_PARAMS codecPicParams; /**< [in]: Specifies the codec specific per-picture encoding parameters. */
  2046. NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE meHintCountsPerBlock[2]; /**< [in]: For H264 and Hevc, specifies the number of hint candidates per block per direction for the current frame. meHintCountsPerBlock[0] is for L0 predictors and meHintCountsPerBlock[1] is for L1 predictors.
  2047. The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder initialization. */
  2048. NVENC_EXTERNAL_ME_HINT *meExternalHints; /**< [in]: For H264 and Hevc, Specifies the pointer to ME external hints for the current frame. The size of ME hint buffer should be equal to number of macroblocks * the total number of candidates per macroblock.
  2049. The total number of candidates per MB per direction = 1*meHintCountsPerBlock[Lx].numCandsPerBlk16x16 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk16x8 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk8x8
  2050. + 4*meHintCountsPerBlock[Lx].numCandsPerBlk8x8. For frames using bidirectional ME , the total number of candidates for single macroblock is sum of total number of candidates per MB for each direction (L0 and L1) */
  2051. uint32_t reserved1[6]; /**< [in]: Reserved and must be set to 0 */
  2052. void* reserved2[2]; /**< [in]: Reserved and must be set to NULL */
  2053. int8_t *qpDeltaMap; /**< [in]: Specifies the pointer to signed byte array containing value per MB for H264, per CTB for HEVC and per SB for AV1 in raster scan order for the current picture, which will be interpreted depending on NV_ENC_RC_PARAMS::qpMapMode.
  2054. If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_DELTA, qpDeltaMap specifies QP modifier per MB for H264, per CTB for HEVC and per SB for AV1. This QP modifier will be applied on top of the QP chosen by rate control.
  2055. If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_EMPHASIS, qpDeltaMap specifies Emphasis Level Map per MB for H264. This level value along with QP chosen by rate control is used to
  2056. compute the QP modifier, which in turn is applied on top of QP chosen by rate control.
  2057. If NV_ENC_RC_PARAMS::qpMapMode is NV_ENC_QP_MAP_DISABLED, value in qpDeltaMap will be ignored.*/
  2058. uint32_t qpDeltaMapSize; /**< [in]: Specifies the size in bytes of qpDeltaMap surface allocated by client and pointed to by NV_ENC_PIC_PARAMS::qpDeltaMap. Surface (array) should be picWidthInMbs * picHeightInMbs for H264, picWidthInCtbs * picHeightInCtbs for HEVC and
  2059. picWidthInSbs * picHeightInSbs for AV1 */
  2060. uint32_t reservedBitFields; /**< [in]: Reserved bitfields and must be set to 0 */
  2061. uint16_t meHintRefPicDist[2]; /**< [in]: Specifies temporal distance for reference picture (NVENC_EXTERNAL_ME_HINT::refidx = 0) used during external ME with NV_ENC_INITALIZE_PARAMS::enablePTD = 1 . meHintRefPicDist[0] is for L0 hints and meHintRefPicDist[1] is for L1 hints.
  2062. If not set, will internally infer distance of 1. Ignored for NV_ENC_INITALIZE_PARAMS::enablePTD = 0 */
  2063. NV_ENC_INPUT_PTR alphaBuffer; /**< [in]: Specifies the input alpha buffer pointer. Client must use a pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource() APIs.
  2064. Applicable only when encoding hevc with alpha layer is enabled. */
  2065. NVENC_EXTERNAL_ME_SB_HINT *meExternalSbHints; /**< [in]: For AV1,Specifies the pointer to ME external SB hints for the current frame. The size of ME hint buffer should be equal to meSbHintsCount. */
  2066. uint32_t meSbHintsCount; /**< [in]: For AV1, specifies the total number of external ME SB hint candidates for the frame
  2067. NV_ENC_PIC_PARAMS::meSbHintsCount must never exceed the total number of SBs in frame * the max number of candidates per SB provided during encoder initialization.
  2068. The max number of candidates per SB is maxMeHintCountsPerBlock[0].numCandsPerSb + maxMeHintCountsPerBlock[1].numCandsPerSb */
  2069. uint32_t reserved3[285]; /**< [in]: Reserved and must be set to 0 */
  2070. void* reserved4[58]; /**< [in]: Reserved and must be set to NULL */
  2071. } NV_ENC_PIC_PARAMS;
  2072. /** Macro for constructing the version field of ::_NV_ENC_PIC_PARAMS */
  2073. #define NV_ENC_PIC_PARAMS_VER (NVENCAPI_STRUCT_VERSION(6) | ( 1<<31 ))
  2074. /**
  2075. * \struct _NV_ENC_MEONLY_PARAMS
  2076. * MEOnly parameters that need to be sent on a per motion estimation basis.
  2077. * NV_ENC_MEONLY_PARAMS::meExternalHints is supported for H264 only.
  2078. */
  2079. typedef struct _NV_ENC_MEONLY_PARAMS
  2080. {
  2081. uint32_t version; /**< [in]: Struct version. Must be set to NV_ENC_MEONLY_PARAMS_VER.*/
  2082. uint32_t inputWidth; /**< [in]: Specifies the input frame width */
  2083. uint32_t inputHeight; /**< [in]: Specifies the input frame height */
  2084. NV_ENC_INPUT_PTR inputBuffer; /**< [in]: Specifies the input buffer pointer. Client must use a pointer obtained from NvEncCreateInputBuffer() or NvEncMapInputResource() APIs. */
  2085. NV_ENC_INPUT_PTR referenceFrame; /**< [in]: Specifies the reference frame pointer */
  2086. NV_ENC_OUTPUT_PTR mvBuffer; /**< [in]: Specifies the output buffer pointer.
  2087. If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 0, specifies the pointer to motion vector data buffer allocated by NvEncCreateMVBuffer.
  2088. Client must lock mvBuffer using ::NvEncLockBitstream() API to get the motion vector data.
  2089. If NV_ENC_INITIALIZE_PARAMS::enableOutputInVidmem is set to 1, client should allocate buffer in video memory for storing the motion vector data. The size of this buffer must
  2090. be equal to total number of macroblocks multiplied by size of NV_ENC_H264_MV_DATA struct. Client should use a pointer obtained from ::NvEncMapInputResource() API, when mapping this
  2091. output buffer and assign it to NV_ENC_MEONLY_PARAMS::mvBuffer. All CUDA operations on this buffer must use the default stream. */
  2092. NV_ENC_BUFFER_FORMAT bufferFmt; /**< [in]: Specifies the input buffer format. */
  2093. void* completionEvent; /**< [in]: Specifies an event to be signaled on completion of motion estimation
  2094. of this Frame [only if operating in Asynchronous mode].
  2095. Each output buffer should be associated with a distinct event pointer. */
  2096. uint32_t viewID; /**< [in]: Specifies left or right viewID if NV_ENC_CONFIG_H264_MEONLY::bStereoEnable is set.
  2097. viewID can be 0,1 if bStereoEnable is set, 0 otherwise. */
  2098. NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE
  2099. meHintCountsPerBlock[2]; /**< [in]: Specifies the number of hint candidates per block for the current frame. meHintCountsPerBlock[0] is for L0 predictors.
  2100. The candidate count in NV_ENC_PIC_PARAMS::meHintCountsPerBlock[lx] must never exceed NV_ENC_INITIALIZE_PARAMS::maxMEHintCountsPerBlock[lx] provided during encoder initialization. */
  2101. NVENC_EXTERNAL_ME_HINT *meExternalHints; /**< [in]: Specifies the pointer to ME external hints for the current frame. The size of ME hint buffer should be equal to number of macroblocks * the total number of candidates per macroblock.
  2102. The total number of candidates per MB per direction = 1*meHintCountsPerBlock[Lx].numCandsPerBlk16x16 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk16x8 + 2*meHintCountsPerBlock[Lx].numCandsPerBlk8x8
  2103. + 4*meHintCountsPerBlock[Lx].numCandsPerBlk8x8. For frames using bidirectional ME , the total number of candidates for single macroblock is sum of total number of candidates per MB for each direction (L0 and L1) */
  2104. uint32_t reserved1[243]; /**< [in]: Reserved and must be set to 0 */
  2105. void* reserved2[59]; /**< [in]: Reserved and must be set to NULL */
  2106. } NV_ENC_MEONLY_PARAMS;
  2107. /** NV_ENC_MEONLY_PARAMS struct version*/
  2108. #define NV_ENC_MEONLY_PARAMS_VER NVENCAPI_STRUCT_VERSION(3)
  2109. /**
  2110. * \struct _NV_ENC_LOCK_BITSTREAM
  2111. * Bitstream buffer lock parameters.
  2112. */
  2113. typedef struct _NV_ENC_LOCK_BITSTREAM
  2114. {
  2115. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_LOCK_BITSTREAM_VER. */
  2116. uint32_t doNotWait :1; /**< [in]: If this flag is set, the NvEncodeAPI interface will return buffer pointer even if operation is not completed. If not set, the call will block until operation completes. */
  2117. uint32_t ltrFrame :1; /**< [out]: Flag indicating this frame is marked as LTR frame */
  2118. uint32_t getRCStats :1; /**< [in]: If this flag is set then lockBitstream call will add additional intra-inter MB count and average MVX, MVY */
  2119. uint32_t reservedBitFields :29; /**< [in]: Reserved bit fields and must be set to 0 */
  2120. void* outputBitstream; /**< [in]: Pointer to the bitstream buffer being locked. */
  2121. uint32_t* sliceOffsets; /**< [in, out]: Array which receives the slice (H264/HEVC) or tile (AV1) offsets. This is not supported if NV_ENC_CONFIG_H264::sliceMode is 1 on Kepler GPUs. Array size must be equal to size of frame in MBs. */
  2122. uint32_t frameIdx; /**< [out]: Frame no. for which the bitstream is being retrieved. */
  2123. uint32_t hwEncodeStatus; /**< [out]: The NvEncodeAPI interface status for the locked picture. */
  2124. uint32_t numSlices; /**< [out]: Number of slices (H264/HEVC) or tiles (AV1) in the encoded picture. Will be reported only if NV_ENC_INITIALIZE_PARAMS::reportSliceOffsets set to 1. */
  2125. uint32_t bitstreamSizeInBytes; /**< [out]: Actual number of bytes generated and copied to the memory pointed by bitstreamBufferPtr.
  2126. When HEVC alpha layer encoding is enabled, this field reports the total encoded size in bytes i.e it is the encoded size of the base plus the alpha layer.
  2127. For AV1 when enablePTD is set, this field reports the total encoded size in bytes of all the encoded frames packed into the current output surface i.e. show frame plus all preceding no-show frames */
  2128. uint64_t outputTimeStamp; /**< [out]: Presentation timestamp associated with the encoded output. */
  2129. uint64_t outputDuration; /**< [out]: Presentation duration associates with the encoded output. */
  2130. void* bitstreamBufferPtr; /**< [out]: Pointer to the generated output bitstream.
  2131. For MEOnly mode _NV_ENC_LOCK_BITSTREAM::bitstreamBufferPtr should be typecast to
  2132. NV_ENC_H264_MV_DATA/NV_ENC_HEVC_MV_DATA pointer respectively for H264/HEVC */
  2133. NV_ENC_PIC_TYPE pictureType; /**< [out]: Picture type of the encoded picture. */
  2134. NV_ENC_PIC_STRUCT pictureStruct; /**< [out]: Structure of the generated output picture. */
  2135. uint32_t frameAvgQP; /**< [out]: Average QP of the frame. */
  2136. uint32_t frameSatd; /**< [out]: Total SATD cost for whole frame. */
  2137. uint32_t ltrFrameIdx; /**< [out]: Frame index associated with this LTR frame. */
  2138. uint32_t ltrFrameBitmap; /**< [out]: Bitmap of LTR frames indices which were used for encoding this frame. Value of 0 if no LTR frames were used. */
  2139. uint32_t temporalId; /**< [out]: TemporalId value of the frame when using temporalSVC encoding */
  2140. uint32_t reserved[12]; /**< [in]: Reserved and must be set to 0 */
  2141. uint32_t intraMBCount; /**< [out]: For H264, Number of Intra MBs in the encoded frame. For HEVC, Number of Intra CTBs in the encoded frame. For AV1, Number of Intra SBs in the encoded show frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */
  2142. uint32_t interMBCount; /**< [out]: For H264, Number of Inter MBs in the encoded frame, includes skip MBs. For HEVC, Number of Inter CTBs in the encoded frame. For AV1, Number of Inter SBs in the encoded show frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */
  2143. int32_t averageMVX; /**< [out]: Average Motion Vector in X direction for the encoded frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */
  2144. int32_t averageMVY; /**< [out]: Average Motion Vector in y direction for the encoded frame. Supported only if _NV_ENC_LOCK_BITSTREAM::getRCStats set to 1. */
  2145. uint32_t alphaLayerSizeInBytes; /**< [out]: Number of bytes generated for the alpha layer in the encoded output. Applicable only when HEVC with alpha encoding is enabled. */
  2146. uint32_t reserved1[218]; /**< [in]: Reserved and must be set to 0 */
  2147. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  2148. } NV_ENC_LOCK_BITSTREAM;
  2149. /** Macro for constructing the version field of ::_NV_ENC_LOCK_BITSTREAM */
  2150. #define NV_ENC_LOCK_BITSTREAM_VER NVENCAPI_STRUCT_VERSION(2)
  2151. /**
  2152. * \struct _NV_ENC_LOCK_INPUT_BUFFER
  2153. * Uncompressed Input Buffer lock parameters.
  2154. */
  2155. typedef struct _NV_ENC_LOCK_INPUT_BUFFER
  2156. {
  2157. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_LOCK_INPUT_BUFFER_VER. */
  2158. uint32_t doNotWait :1; /**< [in]: Set to 1 to make ::NvEncLockInputBuffer() a unblocking call. If the encoding is not completed, driver will return ::NV_ENC_ERR_ENCODER_BUSY error code. */
  2159. uint32_t reservedBitFields :31; /**< [in]: Reserved bitfields and must be set to 0 */
  2160. NV_ENC_INPUT_PTR inputBuffer; /**< [in]: Pointer to the input buffer to be locked, client should pass the pointer obtained from ::NvEncCreateInputBuffer() or ::NvEncMapInputResource API. */
  2161. void* bufferDataPtr; /**< [out]: Pointed to the locked input buffer data. Client can only access input buffer using the \p bufferDataPtr. */
  2162. uint32_t pitch; /**< [out]: Pitch of the locked input buffer. */
  2163. uint32_t reserved1[251]; /**< [in]: Reserved and must be set to 0 */
  2164. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  2165. } NV_ENC_LOCK_INPUT_BUFFER;
  2166. /** Macro for constructing the version field of ::_NV_ENC_LOCK_INPUT_BUFFER */
  2167. #define NV_ENC_LOCK_INPUT_BUFFER_VER NVENCAPI_STRUCT_VERSION(1)
  2168. /**
  2169. * \struct _NV_ENC_MAP_INPUT_RESOURCE
  2170. * Map an input resource to a Nvidia Encoder Input Buffer
  2171. */
  2172. typedef struct _NV_ENC_MAP_INPUT_RESOURCE
  2173. {
  2174. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_MAP_INPUT_RESOURCE_VER. */
  2175. uint32_t subResourceIndex; /**< [in]: Deprecated. Do not use. */
  2176. void* inputResource; /**< [in]: Deprecated. Do not use. */
  2177. NV_ENC_REGISTERED_PTR registeredResource; /**< [in]: The Registered resource handle obtained by calling NvEncRegisterInputResource. */
  2178. NV_ENC_INPUT_PTR mappedResource; /**< [out]: Mapped pointer corresponding to the registeredResource. This pointer must be used in NV_ENC_PIC_PARAMS::inputBuffer parameter in ::NvEncEncodePicture() API. */
  2179. NV_ENC_BUFFER_FORMAT mappedBufferFmt; /**< [out]: Buffer format of the outputResource. This buffer format must be used in NV_ENC_PIC_PARAMS::bufferFmt if client using the above mapped resource pointer. */
  2180. uint32_t reserved1[251]; /**< [in]: Reserved and must be set to 0. */
  2181. void* reserved2[63]; /**< [in]: Reserved and must be set to NULL */
  2182. } NV_ENC_MAP_INPUT_RESOURCE;
  2183. /** Macro for constructing the version field of ::_NV_ENC_MAP_INPUT_RESOURCE */
  2184. #define NV_ENC_MAP_INPUT_RESOURCE_VER NVENCAPI_STRUCT_VERSION(4)
  2185. /**
  2186. * \struct _NV_ENC_INPUT_RESOURCE_OPENGL_TEX
  2187. * NV_ENC_REGISTER_RESOURCE::resourceToRegister must be a pointer to a variable of this type,
  2188. * when NV_ENC_REGISTER_RESOURCE::resourceType is NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX
  2189. */
  2190. typedef struct _NV_ENC_INPUT_RESOURCE_OPENGL_TEX
  2191. {
  2192. uint32_t texture; /**< [in]: The name of the texture to be used. */
  2193. uint32_t target; /**< [in]: Accepted values are GL_TEXTURE_RECTANGLE and GL_TEXTURE_2D. */
  2194. } NV_ENC_INPUT_RESOURCE_OPENGL_TEX;
  2195. /** \struct NV_ENC_FENCE_POINT_D3D12
  2196. * Fence and fence value for synchronization.
  2197. */
  2198. typedef struct _NV_ENC_FENCE_POINT_D3D12
  2199. {
  2200. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_FENCE_POINT_D3D12_VER. */
  2201. uint32_t reserved; /**< [in]: Reserved and must be set to 0. */
  2202. void* pFence; /**< [in]: Pointer to ID3D12Fence. This fence object is used for synchronization. */
  2203. uint64_t waitValue; /**< [in]: Fence value to reach or exceed before the GPU operation. */
  2204. uint64_t signalValue; /**< [in]: Fence value to set the fence to, after the GPU operation. */
  2205. uint32_t bWait:1; /**< [in]: Wait on 'waitValue' if bWait is set to 1, before starting GPU operation. */
  2206. uint32_t bSignal:1; /**< [in]: Signal on 'signalValue' if bSignal is set to 1, after GPU operation is complete. */
  2207. uint32_t reservedBitField:30; /**< [in]: Reserved and must be set to 0. */
  2208. uint32_t reserved1[7]; /**< [in]: Reserved and must be set to 0. */
  2209. } NV_ENC_FENCE_POINT_D3D12;
  2210. #define NV_ENC_FENCE_POINT_D3D12_VER NVENCAPI_STRUCT_VERSION(1)
  2211. /**
  2212. * \struct _NV_ENC_INPUT_RESOURCE_D3D12
  2213. * NV_ENC_PIC_PARAMS::inputBuffer and NV_ENC_PIC_PARAMS::alphaBuffer must be a pointer to a struct of this type,
  2214. * when D3D12 interface is used
  2215. */
  2216. typedef struct _NV_ENC_INPUT_RESOURCE_D3D12
  2217. {
  2218. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_INPUT_RESOURCE_D3D12_VER. */
  2219. uint32_t reserved; /**< [in]: Reserved and must be set to 0. */
  2220. NV_ENC_INPUT_PTR pInputBuffer; /**< [in]: Specifies the input surface pointer. Client must use a pointer obtained from NvEncMapInputResource() in NV_ENC_MAP_INPUT_RESOURCE::mappedResource
  2221. when mapping the input surface. */
  2222. NV_ENC_FENCE_POINT_D3D12 inputFencePoint; /**< [in]: Specifies the fence and corresponding fence values to do GPU wait and signal. */
  2223. uint32_t reserved1[16]; /**< [in]: Reserved and must be set to 0. */
  2224. void* reserved2[16]; /**< [in]: Reserved and must be set to NULL. */
  2225. } NV_ENC_INPUT_RESOURCE_D3D12;
  2226. #define NV_ENC_INPUT_RESOURCE_D3D12_VER NVENCAPI_STRUCT_VERSION(1)
  2227. /**
  2228. * \struct _NV_ENC_OUTPUT_RESOURCE_D3D12
  2229. * NV_ENC_PIC_PARAMS::outputBitstream and NV_ENC_LOCK_BITSTREAM::outputBitstream must be a pointer to a struct of this type,
  2230. * when D3D12 interface is used
  2231. */
  2232. typedef struct _NV_ENC_OUTPUT_RESOURCE_D3D12
  2233. {
  2234. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_OUTPUT_RESOURCE_D3D12_VER. */
  2235. uint32_t reserved; /**< [in]: Reserved and must be set to 0. */
  2236. NV_ENC_INPUT_PTR pOutputBuffer; /**< [in]: Specifies the output buffer pointer. Client must use a pointer obtained from NvEncMapInputResource() in NV_ENC_MAP_INPUT_RESOURCE::mappedResource
  2237. when mapping output bitstream buffer */
  2238. NV_ENC_FENCE_POINT_D3D12 outputFencePoint; /**< [in]: Specifies the fence and corresponding fence values to do GPU wait and signal.*/
  2239. uint32_t reserved1[16]; /**< [in]: Reserved and must be set to 0. */
  2240. void* reserved2[16]; /**< [in]: Reserved and must be set to NULL. */
  2241. } NV_ENC_OUTPUT_RESOURCE_D3D12;
  2242. #define NV_ENC_OUTPUT_RESOURCE_D3D12_VER NVENCAPI_STRUCT_VERSION(1)
  2243. /**
  2244. * \struct _NV_ENC_REGISTER_RESOURCE
  2245. * Register a resource for future use with the Nvidia Video Encoder Interface.
  2246. */
  2247. typedef struct _NV_ENC_REGISTER_RESOURCE
  2248. {
  2249. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_REGISTER_RESOURCE_VER. */
  2250. NV_ENC_INPUT_RESOURCE_TYPE resourceType; /**< [in]: Specifies the type of resource to be registered.
  2251. Supported values are
  2252. ::NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX,
  2253. ::NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR,
  2254. ::NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX */
  2255. uint32_t width; /**< [in]: Input frame width. */
  2256. uint32_t height; /**< [in]: Input frame height. */
  2257. uint32_t pitch; /**< [in]: Input buffer pitch.
  2258. For ::NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX resources, set this to 0.
  2259. For ::NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR resources, set this to
  2260. the pitch as obtained from cuMemAllocPitch(), or to the width in
  2261. bytes (if this resource was created by using cuMemAlloc()). This
  2262. value must be a multiple of 4.
  2263. For ::NV_ENC_INPUT_RESOURCE_TYPE_CUDAARRAY resources, set this to the
  2264. width of the allocation in bytes (i.e.
  2265. CUDA_ARRAY3D_DESCRIPTOR::Width * CUDA_ARRAY3D_DESCRIPTOR::NumChannels).
  2266. For ::NV_ENC_INPUT_RESOURCE_TYPE_OPENGL_TEX resources, set this to the
  2267. texture width multiplied by the number of components in the texture
  2268. format. */
  2269. uint32_t subResourceIndex; /**< [in]: Subresource Index of the DirectX resource to be registered. Should be set to 0 for other interfaces. */
  2270. void* resourceToRegister; /**< [in]: Handle to the resource that is being registered. */
  2271. NV_ENC_REGISTERED_PTR registeredResource; /**< [out]: Registered resource handle. This should be used in future interactions with the Nvidia Video Encoder Interface. */
  2272. NV_ENC_BUFFER_FORMAT bufferFormat; /**< [in]: Buffer format of resource to be registered. */
  2273. NV_ENC_BUFFER_USAGE bufferUsage; /**< [in]: Usage of resource to be registered. */
  2274. NV_ENC_FENCE_POINT_D3D12* pInputFencePoint; /**< [in]: Specifies the input fence and corresponding fence values to do GPU wait and signal.
  2275. To be used only when NV_ENC_REGISTER_RESOURCE::resourceToRegister represents D3D12 surface and
  2276. NV_ENC_BUFFER_USAGE::bufferUsage is NV_ENC_INPUT_IMAGE.
  2277. The fence NV_ENC_FENCE_POINT_D3D12::pFence and NV_ENC_FENCE_POINT_D3D12::waitValue will be used to do GPU wait
  2278. before starting GPU operation, if NV_ENC_FENCE_POINT_D3D12::bWait is set.
  2279. The fence NV_ENC_FENCE_POINT_D3D12::pFence and NV_ENC_FENCE_POINT_D3D12::signalValue will be used to do GPU signal
  2280. when GPU operation finishes, if NV_ENC_FENCE_POINT_D3D12::bSignal is set. */
  2281. uint32_t reserved1[247]; /**< [in]: Reserved and must be set to 0. */
  2282. void* reserved2[61]; /**< [in]: Reserved and must be set to NULL. */
  2283. } NV_ENC_REGISTER_RESOURCE;
  2284. /** Macro for constructing the version field of ::_NV_ENC_REGISTER_RESOURCE */
  2285. #define NV_ENC_REGISTER_RESOURCE_VER NVENCAPI_STRUCT_VERSION(4)
  2286. /**
  2287. * \struct _NV_ENC_STAT
  2288. * Encode Stats structure.
  2289. */
  2290. typedef struct _NV_ENC_STAT
  2291. {
  2292. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_STAT_VER. */
  2293. uint32_t reserved; /**< [in]: Reserved and must be set to 0 */
  2294. NV_ENC_OUTPUT_PTR outputBitStream; /**< [out]: Specifies the pointer to output bitstream. */
  2295. uint32_t bitStreamSize; /**< [out]: Size of generated bitstream in bytes. */
  2296. uint32_t picType; /**< [out]: Picture type of encoded picture. See ::NV_ENC_PIC_TYPE. */
  2297. uint32_t lastValidByteOffset; /**< [out]: Offset of last valid bytes of completed bitstream */
  2298. uint32_t sliceOffsets[16]; /**< [out]: Offsets of each slice */
  2299. uint32_t picIdx; /**< [out]: Picture number */
  2300. uint32_t frameAvgQP; /**< [out]: Average QP of the frame. */
  2301. uint32_t ltrFrame :1; /**< [out]: Flag indicating this frame is marked as LTR frame */
  2302. uint32_t reservedBitFields :31; /**< [in]: Reserved bit fields and must be set to 0 */
  2303. uint32_t ltrFrameIdx; /**< [out]: Frame index associated with this LTR frame. */
  2304. uint32_t intraMBCount; /**< [out]: For H264, Number of Intra MBs in the encoded frame. For HEVC, Number of Intra CTBs in the encoded frame. */
  2305. uint32_t interMBCount; /**< [out]: For H264, Number of Inter MBs in the encoded frame, includes skip MBs. For HEVC, Number of Inter CTBs in the encoded frame. */
  2306. int32_t averageMVX; /**< [out]: Average Motion Vector in X direction for the encoded frame. */
  2307. int32_t averageMVY; /**< [out]: Average Motion Vector in y direction for the encoded frame. */
  2308. uint32_t reserved1[226]; /**< [in]: Reserved and must be set to 0 */
  2309. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  2310. } NV_ENC_STAT;
  2311. /** Macro for constructing the version field of ::_NV_ENC_STAT */
  2312. #define NV_ENC_STAT_VER NVENCAPI_STRUCT_VERSION(1)
  2313. /**
  2314. * \struct _NV_ENC_SEQUENCE_PARAM_PAYLOAD
  2315. * Sequence and picture paramaters payload.
  2316. */
  2317. typedef struct _NV_ENC_SEQUENCE_PARAM_PAYLOAD
  2318. {
  2319. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_INITIALIZE_PARAMS_VER. */
  2320. uint32_t inBufferSize; /**< [in]: Specifies the size of the spsppsBuffer provided by the client */
  2321. uint32_t spsId; /**< [in]: Specifies the SPS id to be used in sequence header. Default value is 0. */
  2322. uint32_t ppsId; /**< [in]: Specifies the PPS id to be used in picture header. Default value is 0. */
  2323. void* spsppsBuffer; /**< [in]: Specifies bitstream header pointer of size NV_ENC_SEQUENCE_PARAM_PAYLOAD::inBufferSize.
  2324. It is the client's responsibility to manage this memory. */
  2325. uint32_t* outSPSPPSPayloadSize; /**< [out]: Size of the sequence and picture header in bytes. */
  2326. uint32_t reserved [250]; /**< [in]: Reserved and must be set to 0 */
  2327. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  2328. } NV_ENC_SEQUENCE_PARAM_PAYLOAD;
  2329. /** Macro for constructing the version field of ::_NV_ENC_SEQUENCE_PARAM_PAYLOAD */
  2330. #define NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER NVENCAPI_STRUCT_VERSION(1)
  2331. /**
  2332. * Event registration/unregistration parameters.
  2333. */
  2334. typedef struct _NV_ENC_EVENT_PARAMS
  2335. {
  2336. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_EVENT_PARAMS_VER. */
  2337. uint32_t reserved; /**< [in]: Reserved and must be set to 0 */
  2338. void* completionEvent; /**< [in]: Handle to event to be registered/unregistered with the NvEncodeAPI interface. */
  2339. uint32_t reserved1[253]; /**< [in]: Reserved and must be set to 0 */
  2340. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  2341. } NV_ENC_EVENT_PARAMS;
  2342. /** Macro for constructing the version field of ::_NV_ENC_EVENT_PARAMS */
  2343. #define NV_ENC_EVENT_PARAMS_VER NVENCAPI_STRUCT_VERSION(1)
  2344. /**
  2345. * Encoder Session Creation parameters
  2346. */
  2347. typedef struct _NV_ENC_OPEN_ENCODE_SESSIONEX_PARAMS
  2348. {
  2349. uint32_t version; /**< [in]: Struct version. Must be set to ::NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER. */
  2350. NV_ENC_DEVICE_TYPE deviceType; /**< [in]: Specified the device Type */
  2351. void* device; /**< [in]: Pointer to client device. */
  2352. void* reserved; /**< [in]: Reserved and must be set to 0. */
  2353. uint32_t apiVersion; /**< [in]: API version. Should be set to NVENCAPI_VERSION. */
  2354. uint32_t reserved1[253]; /**< [in]: Reserved and must be set to 0 */
  2355. void* reserved2[64]; /**< [in]: Reserved and must be set to NULL */
  2356. } NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS;
  2357. /** Macro for constructing the version field of ::_NV_ENC_OPEN_ENCODE_SESSIONEX_PARAMS */
  2358. #define NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER NVENCAPI_STRUCT_VERSION(1)
  2359. /** @} */ /* END ENCODER_STRUCTURE */
  2360. /**
  2361. * \addtogroup ENCODE_FUNC NvEncodeAPI Functions
  2362. * @{
  2363. */
  2364. // NvEncOpenEncodeSession
  2365. /**
  2366. * \brief Opens an encoding session.
  2367. *
  2368. * Deprecated.
  2369. *
  2370. * \return
  2371. * ::NV_ENC_ERR_INVALID_CALL\n
  2372. *
  2373. */
  2374. NVENCSTATUS NVENCAPI NvEncOpenEncodeSession (void* device, uint32_t deviceType, void** encoder);
  2375. // NvEncGetEncodeGuidCount
  2376. /**
  2377. * \brief Retrieves the number of supported encode GUIDs.
  2378. *
  2379. * The function returns the number of codec GUIDs supported by the NvEncodeAPI
  2380. * interface.
  2381. *
  2382. * \param [in] encoder
  2383. * Pointer to the NvEncodeAPI interface.
  2384. * \param [out] encodeGUIDCount
  2385. * Number of supported encode GUIDs.
  2386. *
  2387. * \return
  2388. * ::NV_ENC_SUCCESS \n
  2389. * ::NV_ENC_ERR_INVALID_PTR \n
  2390. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2391. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2392. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2393. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2394. * ::NV_ENC_ERR_INVALID_PARAM \n
  2395. * ::NV_ENC_ERR_GENERIC \n
  2396. *
  2397. */
  2398. NVENCSTATUS NVENCAPI NvEncGetEncodeGUIDCount (void* encoder, uint32_t* encodeGUIDCount);
  2399. // NvEncGetEncodeGUIDs
  2400. /**
  2401. * \brief Retrieves an array of supported encoder codec GUIDs.
  2402. *
  2403. * The function returns an array of codec GUIDs supported by the NvEncodeAPI interface.
  2404. * The client must allocate an array where the NvEncodeAPI interface can
  2405. * fill the supported GUIDs and pass the pointer in \p *GUIDs parameter.
  2406. * The size of the array can be determined by using ::NvEncGetEncodeGUIDCount() API.
  2407. * The Nvidia Encoding interface returns the number of codec GUIDs it has actually
  2408. * filled in the GUID array in the \p GUIDCount parameter.
  2409. *
  2410. * \param [in] encoder
  2411. * Pointer to the NvEncodeAPI interface.
  2412. * \param [in] guidArraySize
  2413. * Number of GUIDs to retrieved. Should be set to the number retrieved using
  2414. * ::NvEncGetEncodeGUIDCount.
  2415. * \param [out] GUIDs
  2416. * Array of supported Encode GUIDs.
  2417. * \param [out] GUIDCount
  2418. * Number of supported Encode GUIDs.
  2419. *
  2420. * \return
  2421. * ::NV_ENC_SUCCESS \n
  2422. * ::NV_ENC_ERR_INVALID_PTR \n
  2423. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2424. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2425. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2426. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2427. * ::NV_ENC_ERR_INVALID_PARAM \n
  2428. * ::NV_ENC_ERR_GENERIC \n
  2429. *
  2430. */
  2431. NVENCSTATUS NVENCAPI NvEncGetEncodeGUIDs (void* encoder, GUID* GUIDs, uint32_t guidArraySize, uint32_t* GUIDCount);
  2432. // NvEncGetEncodeProfileGuidCount
  2433. /**
  2434. * \brief Retrieves the number of supported profile GUIDs.
  2435. *
  2436. * The function returns the number of profile GUIDs supported for a given codec.
  2437. * The client must first enumerate the codec GUIDs supported by the NvEncodeAPI
  2438. * interface. After determining the codec GUID, it can query the NvEncodeAPI
  2439. * interface to determine the number of profile GUIDs supported for a particular
  2440. * codec GUID.
  2441. *
  2442. * \param [in] encoder
  2443. * Pointer to the NvEncodeAPI interface.
  2444. * \param [in] encodeGUID
  2445. * The codec GUID for which the profile GUIDs are being enumerated.
  2446. * \param [out] encodeProfileGUIDCount
  2447. * Number of encode profiles supported for the given encodeGUID.
  2448. *
  2449. * \return
  2450. * ::NV_ENC_SUCCESS \n
  2451. * ::NV_ENC_ERR_INVALID_PTR \n
  2452. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2453. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2454. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2455. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2456. * ::NV_ENC_ERR_INVALID_PARAM \n
  2457. * ::NV_ENC_ERR_GENERIC \n
  2458. *
  2459. */
  2460. NVENCSTATUS NVENCAPI NvEncGetEncodeProfileGUIDCount (void* encoder, GUID encodeGUID, uint32_t* encodeProfileGUIDCount);
  2461. // NvEncGetEncodeProfileGUIDs
  2462. /**
  2463. * \brief Retrieves an array of supported encode profile GUIDs.
  2464. *
  2465. * The function returns an array of supported profile GUIDs for a particular
  2466. * codec GUID. The client must allocate an array where the NvEncodeAPI interface
  2467. * can populate the profile GUIDs. The client can determine the array size using
  2468. * ::NvEncGetEncodeProfileGUIDCount() API. The client must also validiate that the
  2469. * NvEncodeAPI interface supports the GUID the client wants to pass as \p encodeGUID
  2470. * parameter.
  2471. *
  2472. * \param [in] encoder
  2473. * Pointer to the NvEncodeAPI interface.
  2474. * \param [in] encodeGUID
  2475. * The encode GUID whose profile GUIDs are being enumerated.
  2476. * \param [in] guidArraySize
  2477. * Number of GUIDs to be retrieved. Should be set to the number retrieved using
  2478. * ::NvEncGetEncodeProfileGUIDCount.
  2479. * \param [out] profileGUIDs
  2480. * Array of supported Encode Profile GUIDs
  2481. * \param [out] GUIDCount
  2482. * Number of valid encode profile GUIDs in \p profileGUIDs array.
  2483. *
  2484. * \return
  2485. * ::NV_ENC_SUCCESS \n
  2486. * ::NV_ENC_ERR_INVALID_PTR \n
  2487. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2488. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2489. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2490. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2491. * ::NV_ENC_ERR_INVALID_PARAM \n
  2492. * ::NV_ENC_ERR_GENERIC \n
  2493. *
  2494. */
  2495. NVENCSTATUS NVENCAPI NvEncGetEncodeProfileGUIDs (void* encoder, GUID encodeGUID, GUID* profileGUIDs, uint32_t guidArraySize, uint32_t* GUIDCount);
  2496. // NvEncGetInputFormatCount
  2497. /**
  2498. * \brief Retrieve the number of supported Input formats.
  2499. *
  2500. * The function returns the number of supported input formats. The client must
  2501. * query the NvEncodeAPI interface to determine the supported input formats
  2502. * before creating the input surfaces.
  2503. *
  2504. * \param [in] encoder
  2505. * Pointer to the NvEncodeAPI interface.
  2506. * \param [in] encodeGUID
  2507. * Encode GUID, corresponding to which the number of supported input formats
  2508. * is to be retrieved.
  2509. * \param [out] inputFmtCount
  2510. * Number of input formats supported for specified Encode GUID.
  2511. *
  2512. * \return
  2513. * ::NV_ENC_SUCCESS \n
  2514. * ::NV_ENC_ERR_INVALID_PTR \n
  2515. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2516. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2517. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2518. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2519. * ::NV_ENC_ERR_INVALID_PARAM \n
  2520. * ::NV_ENC_ERR_GENERIC \n
  2521. */
  2522. NVENCSTATUS NVENCAPI NvEncGetInputFormatCount (void* encoder, GUID encodeGUID, uint32_t* inputFmtCount);
  2523. // NvEncGetInputFormats
  2524. /**
  2525. * \brief Retrieves an array of supported Input formats
  2526. *
  2527. * Returns an array of supported input formats The client must use the input
  2528. * format to create input surface using ::NvEncCreateInputBuffer() API.
  2529. *
  2530. * \param [in] encoder
  2531. * Pointer to the NvEncodeAPI interface.
  2532. * \param [in] encodeGUID
  2533. * Encode GUID, corresponding to which the number of supported input formats
  2534. * is to be retrieved.
  2535. *\param [in] inputFmtArraySize
  2536. * Size input format count array passed in \p inputFmts.
  2537. *\param [out] inputFmts
  2538. * Array of input formats supported for this Encode GUID.
  2539. *\param [out] inputFmtCount
  2540. * The number of valid input format types returned by the NvEncodeAPI
  2541. * interface in \p inputFmts array.
  2542. *
  2543. * \return
  2544. * ::NV_ENC_SUCCESS \n
  2545. * ::NV_ENC_ERR_INVALID_PTR \n
  2546. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2547. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2548. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2549. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2550. * ::NV_ENC_ERR_INVALID_PARAM \n
  2551. * ::NV_ENC_ERR_GENERIC \n
  2552. *
  2553. */
  2554. NVENCSTATUS NVENCAPI NvEncGetInputFormats (void* encoder, GUID encodeGUID, NV_ENC_BUFFER_FORMAT* inputFmts, uint32_t inputFmtArraySize, uint32_t* inputFmtCount);
  2555. // NvEncGetEncodeCaps
  2556. /**
  2557. * \brief Retrieves the capability value for a specified encoder attribute.
  2558. *
  2559. * The function returns the capability value for a given encoder attribute. The
  2560. * client must validate the encodeGUID using ::NvEncGetEncodeGUIDs() API before
  2561. * calling this function. The encoder attribute being queried are enumerated in
  2562. * ::NV_ENC_CAPS_PARAM enum.
  2563. *
  2564. * \param [in] encoder
  2565. * Pointer to the NvEncodeAPI interface.
  2566. * \param [in] encodeGUID
  2567. * Encode GUID, corresponding to which the capability attribute is to be retrieved.
  2568. * \param [in] capsParam
  2569. * Used to specify attribute being queried. Refer ::NV_ENC_CAPS_PARAM for more
  2570. * details.
  2571. * \param [out] capsVal
  2572. * The value corresponding to the capability attribute being queried.
  2573. *
  2574. * \return
  2575. * ::NV_ENC_SUCCESS \n
  2576. * ::NV_ENC_ERR_INVALID_PTR \n
  2577. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2578. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2579. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2580. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2581. * ::NV_ENC_ERR_INVALID_PARAM \n
  2582. * ::NV_ENC_ERR_GENERIC \n
  2583. */
  2584. NVENCSTATUS NVENCAPI NvEncGetEncodeCaps (void* encoder, GUID encodeGUID, NV_ENC_CAPS_PARAM* capsParam, int* capsVal);
  2585. // NvEncGetEncodePresetCount
  2586. /**
  2587. * \brief Retrieves the number of supported preset GUIDs.
  2588. *
  2589. * The function returns the number of preset GUIDs available for a given codec.
  2590. * The client must validate the codec GUID using ::NvEncGetEncodeGUIDs() API
  2591. * before calling this function.
  2592. *
  2593. * \param [in] encoder
  2594. * Pointer to the NvEncodeAPI interface.
  2595. * \param [in] encodeGUID
  2596. * Encode GUID, corresponding to which the number of supported presets is to
  2597. * be retrieved.
  2598. * \param [out] encodePresetGUIDCount
  2599. * Receives the number of supported preset GUIDs.
  2600. *
  2601. * \return
  2602. * ::NV_ENC_SUCCESS \n
  2603. * ::NV_ENC_ERR_INVALID_PTR \n
  2604. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2605. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2606. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2607. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2608. * ::NV_ENC_ERR_INVALID_PARAM \n
  2609. * ::NV_ENC_ERR_GENERIC \n
  2610. *
  2611. */
  2612. NVENCSTATUS NVENCAPI NvEncGetEncodePresetCount (void* encoder, GUID encodeGUID, uint32_t* encodePresetGUIDCount);
  2613. // NvEncGetEncodePresetGUIDs
  2614. /**
  2615. * \brief Receives an array of supported encoder preset GUIDs.
  2616. *
  2617. * The function returns an array of encode preset GUIDs available for a given codec.
  2618. * The client can directly use one of the preset GUIDs based upon the use case
  2619. * or target device. The preset GUID chosen can be directly used in
  2620. * NV_ENC_INITIALIZE_PARAMS::presetGUID parameter to ::NvEncEncodePicture() API.
  2621. * Alternately client can also use the preset GUID to retrieve the encoding config
  2622. * parameters being used by NvEncodeAPI interface for that given preset, using
  2623. * ::NvEncGetEncodePresetConfig() API. It can then modify preset config parameters
  2624. * as per its use case and send it to NvEncodeAPI interface as part of
  2625. * NV_ENC_INITIALIZE_PARAMS::encodeConfig parameter for NvEncInitializeEncoder()
  2626. * API.
  2627. *
  2628. *
  2629. * \param [in] encoder
  2630. * Pointer to the NvEncodeAPI interface.
  2631. * \param [in] encodeGUID
  2632. * Encode GUID, corresponding to which the list of supported presets is to be
  2633. * retrieved.
  2634. * \param [in] guidArraySize
  2635. * Size of array of preset GUIDs passed in \p preset GUIDs
  2636. * \param [out] presetGUIDs
  2637. * Array of supported Encode preset GUIDs from the NvEncodeAPI interface
  2638. * to client.
  2639. * \param [out] encodePresetGUIDCount
  2640. * Receives the number of preset GUIDs returned by the NvEncodeAPI
  2641. * interface.
  2642. *
  2643. * \return
  2644. * ::NV_ENC_SUCCESS \n
  2645. * ::NV_ENC_ERR_INVALID_PTR \n
  2646. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2647. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2648. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2649. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2650. * ::NV_ENC_ERR_INVALID_PARAM \n
  2651. * ::NV_ENC_ERR_GENERIC \n
  2652. *
  2653. */
  2654. NVENCSTATUS NVENCAPI NvEncGetEncodePresetGUIDs (void* encoder, GUID encodeGUID, GUID* presetGUIDs, uint32_t guidArraySize, uint32_t* encodePresetGUIDCount);
  2655. // NvEncGetEncodePresetConfig
  2656. /**
  2657. * \brief Returns a preset config structure supported for given preset GUID.
  2658. *
  2659. * The function returns a preset config structure for a given preset GUID.
  2660. * NvEncGetEncodePresetConfig() API is not applicable to AV1.
  2661. * Before using this function the client must enumerate the preset GUIDs available for
  2662. * a given codec. The preset config structure can be modified by the client depending
  2663. * upon its use case and can be then used to initialize the encoder using
  2664. * ::NvEncInitializeEncoder() API. The client can use this function only if it
  2665. * wants to modify the NvEncodeAPI preset configuration, otherwise it can
  2666. * directly use the preset GUID.
  2667. *
  2668. * \param [in] encoder
  2669. * Pointer to the NvEncodeAPI interface.
  2670. * \param [in] encodeGUID
  2671. * Encode GUID, corresponding to which the list of supported presets is to be
  2672. * retrieved.
  2673. * \param [in] presetGUID
  2674. * Preset GUID, corresponding to which the Encoding configurations is to be
  2675. * retrieved.
  2676. * \param [out] presetConfig
  2677. * The requested Preset Encoder Attribute set. Refer ::_NV_ENC_CONFIG for
  2678. * more details.
  2679. *
  2680. * \return
  2681. * ::NV_ENC_SUCCESS \n
  2682. * ::NV_ENC_ERR_INVALID_PTR \n
  2683. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2684. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2685. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2686. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2687. * ::NV_ENC_ERR_INVALID_PARAM \n
  2688. * ::NV_ENC_ERR_INVALID_VERSION \n
  2689. * ::NV_ENC_ERR_GENERIC \n
  2690. *
  2691. */
  2692. NVENCSTATUS NVENCAPI NvEncGetEncodePresetConfig (void* encoder, GUID encodeGUID, GUID presetGUID, NV_ENC_PRESET_CONFIG* presetConfig);
  2693. // NvEncGetEncodePresetConfigEx
  2694. /**
  2695. * \brief Returns a preset config structure supported for given preset GUID.
  2696. *
  2697. * The function returns a preset config structure for a given preset GUID and tuning info.
  2698. * NvEncGetEncodePresetConfigEx() API is not applicable to H264 and HEVC meonly mode.
  2699. * Before using this function the client must enumerate the preset GUIDs available for
  2700. * a given codec. The preset config structure can be modified by the client depending
  2701. * upon its use case and can be then used to initialize the encoder using
  2702. * ::NvEncInitializeEncoder() API. The client can use this function only if it
  2703. * wants to modify the NvEncodeAPI preset configuration, otherwise it can
  2704. * directly use the preset GUID.
  2705. *
  2706. * \param [in] encoder
  2707. * Pointer to the NvEncodeAPI interface.
  2708. * \param [in] encodeGUID
  2709. * Encode GUID, corresponding to which the list of supported presets is to be
  2710. * retrieved.
  2711. * \param [in] presetGUID
  2712. * Preset GUID, corresponding to which the Encoding configurations is to be
  2713. * retrieved.
  2714. * \param [in] tuningInfo
  2715. * tuning info, corresponding to which the Encoding configurations is to be
  2716. * retrieved.
  2717. * \param [out] presetConfig
  2718. * The requested Preset Encoder Attribute set. Refer ::_NV_ENC_CONFIG for
  2719. * more details.
  2720. *
  2721. * \return
  2722. * ::NV_ENC_SUCCESS \n
  2723. * ::NV_ENC_ERR_INVALID_PTR \n
  2724. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2725. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2726. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2727. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2728. * ::NV_ENC_ERR_INVALID_PARAM \n
  2729. * ::NV_ENC_ERR_INVALID_VERSION \n
  2730. * ::NV_ENC_ERR_GENERIC \n
  2731. *
  2732. */
  2733. NVENCSTATUS NVENCAPI NvEncGetEncodePresetConfigEx (void* encoder, GUID encodeGUID, GUID presetGUID, NV_ENC_TUNING_INFO tuningInfo, NV_ENC_PRESET_CONFIG* presetConfig);
  2734. // NvEncInitializeEncoder
  2735. /**
  2736. * \brief Initialize the encoder.
  2737. *
  2738. * This API must be used to initialize the encoder. The initialization parameter
  2739. * is passed using \p *createEncodeParams The client must send the following
  2740. * fields of the _NV_ENC_INITIALIZE_PARAMS structure with a valid value.
  2741. * - NV_ENC_INITIALIZE_PARAMS::encodeGUID
  2742. * - NV_ENC_INITIALIZE_PARAMS::encodeWidth
  2743. * - NV_ENC_INITIALIZE_PARAMS::encodeHeight
  2744. *
  2745. * The client can pass a preset GUID directly to the NvEncodeAPI interface using
  2746. * NV_ENC_INITIALIZE_PARAMS::presetGUID field. If the client doesn't pass
  2747. * NV_ENC_INITIALIZE_PARAMS::encodeConfig structure, the codec specific parameters
  2748. * will be selected based on the preset GUID. The preset GUID must have been
  2749. * validated by the client using ::NvEncGetEncodePresetGUIDs() API.
  2750. * If the client passes a custom ::_NV_ENC_CONFIG structure through
  2751. * NV_ENC_INITIALIZE_PARAMS::encodeConfig , it will override the codec specific parameters
  2752. * based on the preset GUID. It is recommended that even if the client passes a custom config,
  2753. * it should also send a preset GUID. In this case, the preset GUID passed by the client
  2754. * will not override any of the custom config parameters programmed by the client,
  2755. * it is only used as a hint by the NvEncodeAPI interface to determine certain encoder parameters
  2756. * which are not exposed to the client.
  2757. *
  2758. * There are two modes of operation for the encoder namely:
  2759. * - Asynchronous mode
  2760. * - Synchronous mode
  2761. *
  2762. * The client can select asynchronous or synchronous mode by setting the \p
  2763. * enableEncodeAsync field in ::_NV_ENC_INITIALIZE_PARAMS to 1 or 0 respectively.
  2764. *\par Asynchronous mode of operation:
  2765. * The Asynchronous mode can be enabled by setting NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync to 1.
  2766. * The client operating in asynchronous mode must allocate completion event object
  2767. * for each output buffer and pass the completion event object in the
  2768. * ::NvEncEncodePicture() API. The client can create another thread and wait on
  2769. * the event object to be signaled by NvEncodeAPI interface on completion of the
  2770. * encoding process for the output frame. This should unblock the main thread from
  2771. * submitting work to the encoder. When the event is signaled the client can call
  2772. * NvEncodeAPI interfaces to copy the bitstream data using ::NvEncLockBitstream()
  2773. * API. This is the preferred mode of operation.
  2774. *
  2775. * NOTE: Asynchronous mode is not supported on Linux.
  2776. *
  2777. *\par Synchronous mode of operation:
  2778. * The client can select synchronous mode by setting NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync to 0.
  2779. * The client working in synchronous mode can work in a single threaded or multi
  2780. * threaded mode. The client need not allocate any event objects. The client can
  2781. * only lock the bitstream data after NvEncodeAPI interface has returned
  2782. * ::NV_ENC_SUCCESS from encode picture. The NvEncodeAPI interface can return
  2783. * ::NV_ENC_ERR_NEED_MORE_INPUT error code from ::NvEncEncodePicture() API. The
  2784. * client must not lock the output buffer in such case but should send the next
  2785. * frame for encoding. The client must keep on calling ::NvEncEncodePicture() API
  2786. * until it returns ::NV_ENC_SUCCESS. \n
  2787. * The client must always lock the bitstream data in order in which it has submitted.
  2788. * This is true for both asynchronous and synchronous mode.
  2789. *
  2790. *\par Picture type decision:
  2791. * If the client is taking the picture type decision and it must disable the picture
  2792. * type decision module in NvEncodeAPI by setting NV_ENC_INITIALIZE_PARAMS::enablePTD
  2793. * to 0. In this case the client is required to send the picture in encoding
  2794. * order to NvEncodeAPI by doing the re-ordering for B frames. \n
  2795. * If the client doesn't want to take the picture type decision it can enable
  2796. * picture type decision module in the NvEncodeAPI interface by setting
  2797. * NV_ENC_INITIALIZE_PARAMS::enablePTD to 1 and send the input pictures in display
  2798. * order.
  2799. *
  2800. * \param [in] encoder
  2801. * Pointer to the NvEncodeAPI interface.
  2802. * \param [in] createEncodeParams
  2803. * Refer ::_NV_ENC_INITIALIZE_PARAMS for details.
  2804. *
  2805. * \return
  2806. * ::NV_ENC_SUCCESS \n
  2807. * ::NV_ENC_ERR_INVALID_PTR \n
  2808. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2809. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2810. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2811. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2812. * ::NV_ENC_ERR_INVALID_PARAM \n
  2813. * ::NV_ENC_ERR_INVALID_VERSION \n
  2814. * ::NV_ENC_ERR_GENERIC \n
  2815. *
  2816. */
  2817. NVENCSTATUS NVENCAPI NvEncInitializeEncoder (void* encoder, NV_ENC_INITIALIZE_PARAMS* createEncodeParams);
  2818. // NvEncCreateInputBuffer
  2819. /**
  2820. * \brief Allocates Input buffer.
  2821. *
  2822. * This function is used to allocate an input buffer. The client must enumerate
  2823. * the input buffer format before allocating the input buffer resources. The
  2824. * NV_ENC_INPUT_PTR returned by the NvEncodeAPI interface in the
  2825. * NV_ENC_CREATE_INPUT_BUFFER::inputBuffer field can be directly used in
  2826. * ::NvEncEncodePicture() API. The number of input buffers to be allocated by the
  2827. * client must be at least 4 more than the number of B frames being used for encoding.
  2828. *
  2829. * \param [in] encoder
  2830. * Pointer to the NvEncodeAPI interface.
  2831. * \param [in,out] createInputBufferParams
  2832. * Pointer to the ::NV_ENC_CREATE_INPUT_BUFFER structure.
  2833. *
  2834. * \return
  2835. * ::NV_ENC_SUCCESS \n
  2836. * ::NV_ENC_ERR_INVALID_PTR \n
  2837. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2838. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2839. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2840. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2841. * ::NV_ENC_ERR_INVALID_PARAM \n
  2842. * ::NV_ENC_ERR_INVALID_VERSION \n
  2843. * ::NV_ENC_ERR_GENERIC \n
  2844. *
  2845. */
  2846. NVENCSTATUS NVENCAPI NvEncCreateInputBuffer (void* encoder, NV_ENC_CREATE_INPUT_BUFFER* createInputBufferParams);
  2847. // NvEncDestroyInputBuffer
  2848. /**
  2849. * \brief Release an input buffers.
  2850. *
  2851. * This function is used to free an input buffer. If the client has allocated
  2852. * any input buffer using ::NvEncCreateInputBuffer() API, it must free those
  2853. * input buffers by calling this function. The client must release the input
  2854. * buffers before destroying the encoder using ::NvEncDestroyEncoder() API.
  2855. *
  2856. * \param [in] encoder
  2857. * Pointer to the NvEncodeAPI interface.
  2858. * \param [in] inputBuffer
  2859. * Pointer to the input buffer to be released.
  2860. *
  2861. * \return
  2862. * ::NV_ENC_SUCCESS \n
  2863. * ::NV_ENC_ERR_INVALID_PTR \n
  2864. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2865. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2866. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2867. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2868. * ::NV_ENC_ERR_INVALID_PARAM \n
  2869. * ::NV_ENC_ERR_INVALID_VERSION \n
  2870. * ::NV_ENC_ERR_GENERIC \n
  2871. *
  2872. */
  2873. NVENCSTATUS NVENCAPI NvEncDestroyInputBuffer (void* encoder, NV_ENC_INPUT_PTR inputBuffer);
  2874. // NvEncSetIOCudaStreams
  2875. /**
  2876. * \brief Set input and output CUDA stream for specified encoder attribute.
  2877. *
  2878. * Encoding may involve CUDA pre-processing on the input and post-processing on encoded output.
  2879. * This function is used to set input and output CUDA streams to pipeline the CUDA pre-processing
  2880. * and post-processing tasks. Clients should call this function before the call to
  2881. * NvEncUnlockInputBuffer(). If this function is not called, the default CUDA stream is used for
  2882. * input and output processing. After a successful call to this function, the streams specified
  2883. * in that call will replace the previously-used streams.
  2884. * This API is supported for NVCUVID interface only.
  2885. *
  2886. * \param [in] encoder
  2887. * Pointer to the NvEncodeAPI interface.
  2888. * \param [in] inputStream
  2889. * Pointer to CUstream which is used to process ::NV_ENC_PIC_PARAMS::inputFrame for encode.
  2890. * In case of ME-only mode, inputStream is used to process ::NV_ENC_MEONLY_PARAMS::inputBuffer and
  2891. * ::NV_ENC_MEONLY_PARAMS::referenceFrame
  2892. * \param [in] outputStream
  2893. * Pointer to CUstream which is used to process ::NV_ENC_PIC_PARAMS::outputBuffer for encode.
  2894. * In case of ME-only mode, outputStream is used to process ::NV_ENC_MEONLY_PARAMS::mvBuffer
  2895. *
  2896. * \return
  2897. * ::NV_ENC_SUCCESS \n
  2898. * ::NV_ENC_ERR_INVALID_PTR \n
  2899. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2900. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2901. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2902. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2903. * ::NV_ENC_ERR_INVALID_PARAM \n
  2904. * ::NV_ENC_ERR_INVALID_VERSION \n
  2905. * ::NV_ENC_ERR_GENERIC \n
  2906. */
  2907. NVENCSTATUS NVENCAPI NvEncSetIOCudaStreams (void* encoder, NV_ENC_CUSTREAM_PTR inputStream, NV_ENC_CUSTREAM_PTR outputStream);
  2908. // NvEncCreateBitstreamBuffer
  2909. /**
  2910. * \brief Allocates an output bitstream buffer
  2911. *
  2912. * This function is used to allocate an output bitstream buffer and returns a
  2913. * NV_ENC_OUTPUT_PTR to bitstream buffer to the client in the
  2914. * NV_ENC_CREATE_BITSTREAM_BUFFER::bitstreamBuffer field.
  2915. * The client can only call this function after the encoder session has been
  2916. * initialized using ::NvEncInitializeEncoder() API. The minimum number of output
  2917. * buffers allocated by the client must be at least 4 more than the number of B
  2918. * B frames being used for encoding. The client can only access the output
  2919. * bitstream data by locking the \p bitstreamBuffer using the ::NvEncLockBitstream()
  2920. * function.
  2921. *
  2922. * \param [in] encoder
  2923. * Pointer to the NvEncodeAPI interface.
  2924. * \param [in,out] createBitstreamBufferParams
  2925. * Pointer ::NV_ENC_CREATE_BITSTREAM_BUFFER for details.
  2926. *
  2927. * \return
  2928. * ::NV_ENC_SUCCESS \n
  2929. * ::NV_ENC_ERR_INVALID_PTR \n
  2930. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2931. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2932. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2933. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2934. * ::NV_ENC_ERR_INVALID_PARAM \n
  2935. * ::NV_ENC_ERR_INVALID_VERSION \n
  2936. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  2937. * ::NV_ENC_ERR_GENERIC \n
  2938. *
  2939. */
  2940. NVENCSTATUS NVENCAPI NvEncCreateBitstreamBuffer (void* encoder, NV_ENC_CREATE_BITSTREAM_BUFFER* createBitstreamBufferParams);
  2941. // NvEncDestroyBitstreamBuffer
  2942. /**
  2943. * \brief Release a bitstream buffer.
  2944. *
  2945. * This function is used to release the output bitstream buffer allocated using
  2946. * the ::NvEncCreateBitstreamBuffer() function. The client must release the output
  2947. * bitstreamBuffer using this function before destroying the encoder session.
  2948. *
  2949. * \param [in] encoder
  2950. * Pointer to the NvEncodeAPI interface.
  2951. * \param [in] bitstreamBuffer
  2952. * Pointer to the bitstream buffer being released.
  2953. *
  2954. * \return
  2955. * ::NV_ENC_SUCCESS \n
  2956. * ::NV_ENC_ERR_INVALID_PTR \n
  2957. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  2958. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  2959. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  2960. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  2961. * ::NV_ENC_ERR_INVALID_PARAM \n
  2962. * ::NV_ENC_ERR_INVALID_VERSION \n
  2963. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  2964. * ::NV_ENC_ERR_GENERIC \n
  2965. *
  2966. */
  2967. NVENCSTATUS NVENCAPI NvEncDestroyBitstreamBuffer (void* encoder, NV_ENC_OUTPUT_PTR bitstreamBuffer);
  2968. // NvEncEncodePicture
  2969. /**
  2970. * \brief Submit an input picture for encoding.
  2971. *
  2972. * This function is used to submit an input picture buffer for encoding. The
  2973. * encoding parameters are passed using \p *encodePicParams which is a pointer
  2974. * to the ::_NV_ENC_PIC_PARAMS structure.
  2975. *
  2976. * If the client has set NV_ENC_INITIALIZE_PARAMS::enablePTD to 0, then it must
  2977. * send a valid value for the following fields.
  2978. * - NV_ENC_PIC_PARAMS::pictureType
  2979. * - NV_ENC_PIC_PARAMS_H264::displayPOCSyntax (H264 only)
  2980. * - NV_ENC_PIC_PARAMS_H264::frameNumSyntax(H264 only)
  2981. * - NV_ENC_PIC_PARAMS_H264::refPicFlag(H264 only)
  2982. *
  2983. *\par MVC Encoding:
  2984. * For MVC encoding the client must call encode picture API for each view separately
  2985. * and must pass valid view id in NV_ENC_PIC_PARAMS_MVC::viewID field. Currently
  2986. * NvEncodeAPI only support stereo MVC so client must send viewID as 0 for base
  2987. * view and view ID as 1 for dependent view.
  2988. *
  2989. *\par Asynchronous Encoding
  2990. * If the client has enabled asynchronous mode of encoding by setting
  2991. * NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync to 1 in the ::NvEncInitializeEncoder()
  2992. * API ,then the client must send a valid NV_ENC_PIC_PARAMS::completionEvent.
  2993. * Incase of asynchronous mode of operation, client can queue the ::NvEncEncodePicture()
  2994. * API commands from the main thread and then queue output buffers to be processed
  2995. * to a secondary worker thread. Before the locking the output buffers in the
  2996. * secondary thread , the client must wait on NV_ENC_PIC_PARAMS::completionEvent
  2997. * it has queued in ::NvEncEncodePicture() API call. The client must always process
  2998. * completion event and the output buffer in the same order in which they have been
  2999. * submitted for encoding. The NvEncodeAPI interface is responsible for any
  3000. * re-ordering required for B frames and will always ensure that encoded bitstream
  3001. * data is written in the same order in which output buffer is submitted.
  3002. * The NvEncodeAPI interface may return ::NV_ENC_ERR_NEED_MORE_INPUT error code for
  3003. * some ::NvEncEncodePicture() API calls but the client must not treat it as a fatal error.
  3004. * The NvEncodeAPI interface might not be able to submit an input picture buffer for encoding
  3005. * immediately due to re-ordering for B frames.
  3006. *\code
  3007. The below example shows how asynchronous encoding in case of 1 B frames
  3008. ------------------------------------------------------------------------
  3009. Suppose the client allocated 4 input buffers(I1,I2..), 4 output buffers(O1,O2..)
  3010. and 4 completion events(E1, E2, ...). The NvEncodeAPI interface will need to
  3011. keep a copy of the input buffers for re-ordering and it allocates following
  3012. internal buffers (NvI1, NvI2...). These internal buffers are managed by NvEncodeAPI
  3013. and the client is not responsible for the allocating or freeing the memory of
  3014. the internal buffers.
  3015. a) The client main thread will queue the following encode frame calls.
  3016. Note the picture type is unknown to the client, the decision is being taken by
  3017. NvEncodeAPI interface. The client should pass ::_NV_ENC_PIC_PARAMS parameter
  3018. consisting of allocated input buffer, output buffer and output events in successive
  3019. ::NvEncEncodePicture() API calls along with other required encode picture params.
  3020. For example:
  3021. 1st EncodePicture parameters - (I1, O1, E1)
  3022. 2nd EncodePicture parameters - (I2, O2, E2)
  3023. 3rd EncodePicture parameters - (I3, O3, E3)
  3024. b) NvEncodeAPI SW will receive the following encode Commands from the client.
  3025. The left side shows input from client in the form (Input buffer, Output Buffer,
  3026. Output Event). The right hand side shows a possible picture type decision take by
  3027. the NvEncodeAPI interface.
  3028. (I1, O1, E1) ---P1 Frame
  3029. (I2, O2, E2) ---B2 Frame
  3030. (I3, O3, E3) ---P3 Frame
  3031. c) NvEncodeAPI interface will make a copy of the input buffers to its internal
  3032. buffers for re-ordering. These copies are done as part of nvEncEncodePicture
  3033. function call from the client and NvEncodeAPI interface is responsible for
  3034. synchronization of copy operation with the actual encoding operation.
  3035. I1 --> NvI1
  3036. I2 --> NvI2
  3037. I3 --> NvI3
  3038. d) The NvEncodeAPI encodes I1 as P frame and submits I1 to encoder HW and returns ::NV_ENC_SUCCESS.
  3039. The NvEncodeAPI tries to encode I2 as B frame and fails with ::NV_ENC_ERR_NEED_MORE_INPUT error code.
  3040. The error is not fatal and it notifies client that I2 is not submitted to encoder immediately.
  3041. The NvEncodeAPI encodes I3 as P frame and submits I3 for encoding which will be used as backward
  3042. reference frame for I2. The NvEncodeAPI then submits I2 for encoding and returns ::NV_ENC_SUCESS.
  3043. Both the submission are part of the same ::NvEncEncodePicture() function call.
  3044. e) After returning from ::NvEncEncodePicture() call , the client must queue the output
  3045. bitstream processing work to the secondary thread. The output bitstream processing
  3046. for asynchronous mode consist of first waiting on completion event(E1, E2..)
  3047. and then locking the output bitstream buffer(O1, O2..) for reading the encoded
  3048. data. The work queued to the secondary thread by the client is in the following order
  3049. (I1, O1, E1)
  3050. (I2, O2, E2)
  3051. (I3, O3, E3)
  3052. Note they are in the same order in which client calls ::NvEncEncodePicture() API
  3053. in \p step a).
  3054. f) NvEncodeAPI interface will do the re-ordering such that Encoder HW will receive
  3055. the following encode commands:
  3056. (NvI1, O1, E1) ---P1 Frame
  3057. (NvI3, O2, E2) ---P3 Frame
  3058. (NvI2, O3, E3) ---B2 frame
  3059. g) After the encoding operations are completed, the events will be signaled
  3060. by NvEncodeAPI interface in the following order :
  3061. (O1, E1) ---P1 Frame ,output bitstream copied to O1 and event E1 signaled.
  3062. (O2, E2) ---P3 Frame ,output bitstream copied to O2 and event E2 signaled.
  3063. (O3, E3) ---B2 Frame ,output bitstream copied to O3 and event E3 signaled.
  3064. h) The client must lock the bitstream data using ::NvEncLockBitstream() API in
  3065. the order O1,O2,O3 to read the encoded data, after waiting for the events
  3066. to be signaled in the same order i.e E1, E2 and E3.The output processing is
  3067. done in the secondary thread in the following order:
  3068. Waits on E1, copies encoded bitstream from O1
  3069. Waits on E2, copies encoded bitstream from O2
  3070. Waits on E3, copies encoded bitstream from O3
  3071. -Note the client will receive the events signaling and output buffer in the
  3072. same order in which they have submitted for encoding.
  3073. -Note the LockBitstream will have picture type field which will notify the
  3074. output picture type to the clients.
  3075. -Note the input, output buffer and the output completion event are free to be
  3076. reused once NvEncodeAPI interfaced has signaled the event and the client has
  3077. copied the data from the output buffer.
  3078. * \endcode
  3079. *
  3080. *\par Synchronous Encoding
  3081. * The client can enable synchronous mode of encoding by setting
  3082. * NV_ENC_INITIALIZE_PARAMS::enableEncodeAsync to 0 in ::NvEncInitializeEncoder() API.
  3083. * The NvEncodeAPI interface may return ::NV_ENC_ERR_NEED_MORE_INPUT error code for
  3084. * some ::NvEncEncodePicture() API calls when NV_ENC_INITIALIZE_PARAMS::enablePTD
  3085. * is set to 1, but the client must not treat it as a fatal error. The NvEncodeAPI
  3086. * interface might not be able to submit an input picture buffer for encoding
  3087. * immediately due to re-ordering for B frames. The NvEncodeAPI interface cannot
  3088. * submit the input picture which is decided to be encoded as B frame as it waits
  3089. * for backward reference from temporally subsequent frames. This input picture
  3090. * is buffered internally and waits for more input picture to arrive. The client
  3091. * must not call ::NvEncLockBitstream() API on the output buffers whose
  3092. * ::NvEncEncodePicture() API returns ::NV_ENC_ERR_NEED_MORE_INPUT. The client must
  3093. * wait for the NvEncodeAPI interface to return ::NV_ENC_SUCCESS before locking the
  3094. * output bitstreams to read the encoded bitstream data. The following example
  3095. * explains the scenario with synchronous encoding with 2 B frames.
  3096. *\code
  3097. The below example shows how synchronous encoding works in case of 1 B frames
  3098. -----------------------------------------------------------------------------
  3099. Suppose the client allocated 4 input buffers(I1,I2..), 4 output buffers(O1,O2..)
  3100. and 4 completion events(E1, E2, ...). The NvEncodeAPI interface will need to
  3101. keep a copy of the input buffers for re-ordering and it allocates following
  3102. internal buffers (NvI1, NvI2...). These internal buffers are managed by NvEncodeAPI
  3103. and the client is not responsible for the allocating or freeing the memory of
  3104. the internal buffers.
  3105. The client calls ::NvEncEncodePicture() API with input buffer I1 and output buffer O1.
  3106. The NvEncodeAPI decides to encode I1 as P frame and submits it to encoder
  3107. HW and returns ::NV_ENC_SUCCESS.
  3108. The client can now read the encoded data by locking the output O1 by calling
  3109. NvEncLockBitstream API.
  3110. The client calls ::NvEncEncodePicture() API with input buffer I2 and output buffer O2.
  3111. The NvEncodeAPI decides to encode I2 as B frame and buffers I2 by copying it
  3112. to internal buffer and returns ::NV_ENC_ERR_NEED_MORE_INPUT.
  3113. The error is not fatal and it notifies client that it cannot read the encoded
  3114. data by locking the output O2 by calling ::NvEncLockBitstream() API without submitting
  3115. more work to the NvEncodeAPI interface.
  3116. The client calls ::NvEncEncodePicture() with input buffer I3 and output buffer O3.
  3117. The NvEncodeAPI decides to encode I3 as P frame and it first submits I3 for
  3118. encoding which will be used as backward reference frame for I2.
  3119. The NvEncodeAPI then submits I2 for encoding and returns ::NV_ENC_SUCESS. Both
  3120. the submission are part of the same ::NvEncEncodePicture() function call.
  3121. The client can now read the encoded data for both the frames by locking the output
  3122. O2 followed by O3 ,by calling ::NvEncLockBitstream() API.
  3123. The client must always lock the output in the same order in which it has submitted
  3124. to receive the encoded bitstream in correct encoding order.
  3125. * \endcode
  3126. *
  3127. * \param [in] encoder
  3128. * Pointer to the NvEncodeAPI interface.
  3129. * \param [in,out] encodePicParams
  3130. * Pointer to the ::_NV_ENC_PIC_PARAMS structure.
  3131. *
  3132. * \return
  3133. * ::NV_ENC_SUCCESS \n
  3134. * ::NV_ENC_ERR_INVALID_PTR \n
  3135. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3136. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3137. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3138. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3139. * ::NV_ENC_ERR_INVALID_PARAM \n
  3140. * ::NV_ENC_ERR_INVALID_VERSION \n
  3141. * ::NV_ENC_ERR_ENCODER_BUSY \n
  3142. * ::NV_ENC_ERR_NEED_MORE_INPUT \n
  3143. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3144. * ::NV_ENC_ERR_GENERIC \n
  3145. *
  3146. */
  3147. NVENCSTATUS NVENCAPI NvEncEncodePicture (void* encoder, NV_ENC_PIC_PARAMS* encodePicParams);
  3148. // NvEncLockBitstream
  3149. /**
  3150. * \brief Lock output bitstream buffer
  3151. *
  3152. * This function is used to lock the bitstream buffer to read the encoded data.
  3153. * The client can only access the encoded data by calling this function.
  3154. * The pointer to client accessible encoded data is returned in the
  3155. * NV_ENC_LOCK_BITSTREAM::bitstreamBufferPtr field. The size of the encoded data
  3156. * in the output buffer is returned in the NV_ENC_LOCK_BITSTREAM::bitstreamSizeInBytes
  3157. * The NvEncodeAPI interface also returns the output picture type and picture structure
  3158. * of the encoded frame in NV_ENC_LOCK_BITSTREAM::pictureType and
  3159. * NV_ENC_LOCK_BITSTREAM::pictureStruct fields respectively. If the client has
  3160. * set NV_ENC_LOCK_BITSTREAM::doNotWait to 1, the function might return
  3161. * ::NV_ENC_ERR_LOCK_BUSY if client is operating in synchronous mode. This is not
  3162. * a fatal failure if NV_ENC_LOCK_BITSTREAM::doNotWait is set to 1. In the above case the client can
  3163. * retry the function after few milliseconds.
  3164. *
  3165. * \param [in] encoder
  3166. * Pointer to the NvEncodeAPI interface.
  3167. * \param [in,out] lockBitstreamBufferParams
  3168. * Pointer to the ::_NV_ENC_LOCK_BITSTREAM structure.
  3169. *
  3170. * \return
  3171. * ::NV_ENC_SUCCESS \n
  3172. * ::NV_ENC_ERR_INVALID_PTR \n
  3173. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3174. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3175. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3176. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3177. * ::NV_ENC_ERR_INVALID_PARAM \n
  3178. * ::NV_ENC_ERR_INVALID_VERSION \n
  3179. * ::NV_ENC_ERR_LOCK_BUSY \n
  3180. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3181. * ::NV_ENC_ERR_GENERIC \n
  3182. *
  3183. */
  3184. NVENCSTATUS NVENCAPI NvEncLockBitstream (void* encoder, NV_ENC_LOCK_BITSTREAM* lockBitstreamBufferParams);
  3185. // NvEncUnlockBitstream
  3186. /**
  3187. * \brief Unlock the output bitstream buffer
  3188. *
  3189. * This function is used to unlock the output bitstream buffer after the client
  3190. * has read the encoded data from output buffer. The client must call this function
  3191. * to unlock the output buffer which it has previously locked using ::NvEncLockBitstream()
  3192. * function. Using a locked bitstream buffer in ::NvEncEncodePicture() API will cause
  3193. * the function to fail.
  3194. *
  3195. * \param [in] encoder
  3196. * Pointer to the NvEncodeAPI interface.
  3197. * \param [in,out] bitstreamBuffer
  3198. * bitstream buffer pointer being unlocked
  3199. *
  3200. * \return
  3201. * ::NV_ENC_SUCCESS \n
  3202. * ::NV_ENC_ERR_INVALID_PTR \n
  3203. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3204. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3205. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3206. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3207. * ::NV_ENC_ERR_INVALID_PARAM \n
  3208. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3209. * ::NV_ENC_ERR_GENERIC \n
  3210. *
  3211. */
  3212. NVENCSTATUS NVENCAPI NvEncUnlockBitstream (void* encoder, NV_ENC_OUTPUT_PTR bitstreamBuffer);
  3213. // NvLockInputBuffer
  3214. /**
  3215. * \brief Locks an input buffer
  3216. *
  3217. * This function is used to lock the input buffer to load the uncompressed YUV
  3218. * pixel data into input buffer memory. The client must pass the NV_ENC_INPUT_PTR
  3219. * it had previously allocated using ::NvEncCreateInputBuffer()in the
  3220. * NV_ENC_LOCK_INPUT_BUFFER::inputBuffer field.
  3221. * The NvEncodeAPI interface returns pointer to client accessible input buffer
  3222. * memory in NV_ENC_LOCK_INPUT_BUFFER::bufferDataPtr field.
  3223. *
  3224. * \param [in] encoder
  3225. * Pointer to the NvEncodeAPI interface.
  3226. * \param [in,out] lockInputBufferParams
  3227. * Pointer to the ::_NV_ENC_LOCK_INPUT_BUFFER structure
  3228. *
  3229. * \return
  3230. * \return
  3231. * ::NV_ENC_SUCCESS \n
  3232. * ::NV_ENC_ERR_INVALID_PTR \n
  3233. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3234. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3235. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3236. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3237. * ::NV_ENC_ERR_INVALID_PARAM \n
  3238. * ::NV_ENC_ERR_INVALID_VERSION \n
  3239. * ::NV_ENC_ERR_LOCK_BUSY \n
  3240. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3241. * ::NV_ENC_ERR_GENERIC \n
  3242. *
  3243. */
  3244. NVENCSTATUS NVENCAPI NvEncLockInputBuffer (void* encoder, NV_ENC_LOCK_INPUT_BUFFER* lockInputBufferParams);
  3245. // NvUnlockInputBuffer
  3246. /**
  3247. * \brief Unlocks the input buffer
  3248. *
  3249. * This function is used to unlock the input buffer memory previously locked for
  3250. * uploading YUV pixel data. The input buffer must be unlocked before being used
  3251. * again for encoding, otherwise NvEncodeAPI will fail the ::NvEncEncodePicture()
  3252. *
  3253. * \param [in] encoder
  3254. * Pointer to the NvEncodeAPI interface.
  3255. * \param [in] inputBuffer
  3256. * Pointer to the input buffer that is being unlocked.
  3257. *
  3258. * \return
  3259. * ::NV_ENC_SUCCESS \n
  3260. * ::NV_ENC_ERR_INVALID_PTR \n
  3261. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3262. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3263. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3264. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3265. * ::NV_ENC_ERR_INVALID_VERSION \n
  3266. * ::NV_ENC_ERR_INVALID_PARAM \n
  3267. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3268. * ::NV_ENC_ERR_GENERIC \n
  3269. *
  3270. *
  3271. */
  3272. NVENCSTATUS NVENCAPI NvEncUnlockInputBuffer (void* encoder, NV_ENC_INPUT_PTR inputBuffer);
  3273. // NvEncGetEncodeStats
  3274. /**
  3275. * \brief Get encoding statistics.
  3276. *
  3277. * This function is used to retrieve the encoding statistics.
  3278. * This API is not supported when encode device type is CUDA.
  3279. * Note that this API will be removed in future Video Codec SDK release.
  3280. * Clients should use NvEncLockBitstream() API to retrieve the encoding statistics.
  3281. *
  3282. * \param [in] encoder
  3283. * Pointer to the NvEncodeAPI interface.
  3284. * \param [in,out] encodeStats
  3285. * Pointer to the ::_NV_ENC_STAT structure.
  3286. *
  3287. * \return
  3288. * ::NV_ENC_SUCCESS \n
  3289. * ::NV_ENC_ERR_INVALID_PTR \n
  3290. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3291. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3292. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3293. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3294. * ::NV_ENC_ERR_INVALID_PARAM \n
  3295. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3296. * ::NV_ENC_ERR_GENERIC \n
  3297. *
  3298. */
  3299. NVENCSTATUS NVENCAPI NvEncGetEncodeStats (void* encoder, NV_ENC_STAT* encodeStats);
  3300. // NvEncGetSequenceParams
  3301. /**
  3302. * \brief Get encoded sequence and picture header.
  3303. *
  3304. * This function can be used to retrieve the sequence and picture header out of
  3305. * band. The client must call this function only after the encoder has been
  3306. * initialized using ::NvEncInitializeEncoder() function. The client must
  3307. * allocate the memory where the NvEncodeAPI interface can copy the bitstream
  3308. * header and pass the pointer to the memory in NV_ENC_SEQUENCE_PARAM_PAYLOAD::spsppsBuffer.
  3309. * The size of buffer is passed in the field NV_ENC_SEQUENCE_PARAM_PAYLOAD::inBufferSize.
  3310. * The NvEncodeAPI interface will copy the bitstream header payload and returns
  3311. * the actual size of the bitstream header in the field
  3312. * NV_ENC_SEQUENCE_PARAM_PAYLOAD::outSPSPPSPayloadSize.
  3313. * The client must call ::NvEncGetSequenceParams() function from the same thread which is
  3314. * being used to call ::NvEncEncodePicture() function.
  3315. *
  3316. * \param [in] encoder
  3317. * Pointer to the NvEncodeAPI interface.
  3318. * \param [in,out] sequenceParamPayload
  3319. * Pointer to the ::_NV_ENC_SEQUENCE_PARAM_PAYLOAD structure.
  3320. *
  3321. * \return
  3322. * ::NV_ENC_SUCCESS \n
  3323. * ::NV_ENC_ERR_INVALID_PTR \n
  3324. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3325. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3326. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3327. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3328. * ::NV_ENC_ERR_INVALID_VERSION \n
  3329. * ::NV_ENC_ERR_INVALID_PARAM \n
  3330. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3331. * ::NV_ENC_ERR_GENERIC \n
  3332. *
  3333. */
  3334. NVENCSTATUS NVENCAPI NvEncGetSequenceParams (void* encoder, NV_ENC_SEQUENCE_PARAM_PAYLOAD* sequenceParamPayload);
  3335. // NvEncGetSequenceParamEx
  3336. /**
  3337. * \brief Get sequence and picture header.
  3338. *
  3339. * This function can be used to retrieve the sequence and picture header out of band, even when
  3340. * encoder has not been initialized using ::NvEncInitializeEncoder() function.
  3341. * The client must allocate the memory where the NvEncodeAPI interface can copy the bitstream
  3342. * header and pass the pointer to the memory in NV_ENC_SEQUENCE_PARAM_PAYLOAD::spsppsBuffer.
  3343. * The size of buffer is passed in the field NV_ENC_SEQUENCE_PARAM_PAYLOAD::inBufferSize.
  3344. * If encoder has not been initialized using ::NvEncInitializeEncoder() function, client must
  3345. * send NV_ENC_INITIALIZE_PARAMS as input. The NV_ENC_INITIALIZE_PARAMS passed must be same as the
  3346. * one which will be used for initializing encoder using ::NvEncInitializeEncoder() function later.
  3347. * If encoder is already initialized using ::NvEncInitializeEncoder() function, the provided
  3348. * NV_ENC_INITIALIZE_PARAMS structure is ignored. The NvEncodeAPI interface will copy the bitstream
  3349. * header payload and returns the actual size of the bitstream header in the field
  3350. * NV_ENC_SEQUENCE_PARAM_PAYLOAD::outSPSPPSPayloadSize. The client must call ::NvEncGetSequenceParamsEx()
  3351. * function from the same thread which is being used to call ::NvEncEncodePicture() function.
  3352. *
  3353. * \param [in] encoder
  3354. * Pointer to the NvEncodeAPI interface.
  3355. * \param [in] encInitParams
  3356. * Pointer to the _NV_ENC_INITIALIZE_PARAMS structure.
  3357. * \param [in,out] sequenceParamPayload
  3358. * Pointer to the ::_NV_ENC_SEQUENCE_PARAM_PAYLOAD structure.
  3359. *
  3360. * \return
  3361. * ::NV_ENC_SUCCESS \n
  3362. * ::NV_ENC_ERR_INVALID_PTR \n
  3363. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3364. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3365. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3366. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3367. * ::NV_ENC_ERR_INVALID_VERSION \n
  3368. * ::NV_ENC_ERR_INVALID_PARAM \n
  3369. * ::NV_ENC_ERR_GENERIC \n
  3370. *
  3371. */
  3372. NVENCSTATUS NVENCAPI NvEncGetSequenceParamEx (void* encoder, NV_ENC_INITIALIZE_PARAMS* encInitParams, NV_ENC_SEQUENCE_PARAM_PAYLOAD* sequenceParamPayload);
  3373. // NvEncRegisterAsyncEvent
  3374. /**
  3375. * \brief Register event for notification to encoding completion.
  3376. *
  3377. * This function is used to register the completion event with NvEncodeAPI
  3378. * interface. The event is required when the client has configured the encoder to
  3379. * work in asynchronous mode. In this mode the client needs to send a completion
  3380. * event with every output buffer. The NvEncodeAPI interface will signal the
  3381. * completion of the encoding process using this event. Only after the event is
  3382. * signaled the client can get the encoded data using ::NvEncLockBitstream() function.
  3383. *
  3384. * \param [in] encoder
  3385. * Pointer to the NvEncodeAPI interface.
  3386. * \param [in] eventParams
  3387. * Pointer to the ::_NV_ENC_EVENT_PARAMS structure.
  3388. *
  3389. * \return
  3390. * ::NV_ENC_SUCCESS \n
  3391. * ::NV_ENC_ERR_INVALID_PTR \n
  3392. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3393. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3394. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3395. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3396. * ::NV_ENC_ERR_INVALID_VERSION \n
  3397. * ::NV_ENC_ERR_INVALID_PARAM \n
  3398. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3399. * ::NV_ENC_ERR_GENERIC \n
  3400. *
  3401. */
  3402. NVENCSTATUS NVENCAPI NvEncRegisterAsyncEvent (void* encoder, NV_ENC_EVENT_PARAMS* eventParams);
  3403. // NvEncUnregisterAsyncEvent
  3404. /**
  3405. * \brief Unregister completion event.
  3406. *
  3407. * This function is used to unregister completion event which has been previously
  3408. * registered using ::NvEncRegisterAsyncEvent() function. The client must unregister
  3409. * all events before destroying the encoder using ::NvEncDestroyEncoder() function.
  3410. *
  3411. * \param [in] encoder
  3412. * Pointer to the NvEncodeAPI interface.
  3413. * \param [in] eventParams
  3414. * Pointer to the ::_NV_ENC_EVENT_PARAMS structure.
  3415. *
  3416. * \return
  3417. * ::NV_ENC_SUCCESS \n
  3418. * ::NV_ENC_ERR_INVALID_PTR \n
  3419. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3420. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3421. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3422. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3423. * ::NV_ENC_ERR_INVALID_VERSION \n
  3424. * ::NV_ENC_ERR_INVALID_PARAM \n
  3425. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3426. * ::NV_ENC_ERR_GENERIC \n
  3427. *
  3428. */
  3429. NVENCSTATUS NVENCAPI NvEncUnregisterAsyncEvent (void* encoder, NV_ENC_EVENT_PARAMS* eventParams);
  3430. // NvEncMapInputResource
  3431. /**
  3432. * \brief Map an externally created input resource pointer for encoding.
  3433. *
  3434. * Maps an externally allocated input resource [using and returns a NV_ENC_INPUT_PTR
  3435. * which can be used for encoding in the ::NvEncEncodePicture() function. The
  3436. * mapped resource is returned in the field NV_ENC_MAP_INPUT_RESOURCE::outputResourcePtr.
  3437. * The NvEncodeAPI interface also returns the buffer format of the mapped resource
  3438. * in the field NV_ENC_MAP_INPUT_RESOURCE::outbufferFmt.
  3439. * This function provides synchronization guarantee that any graphics work submitted
  3440. * on the input buffer is completed before the buffer is used for encoding. This is
  3441. * also true for compute (i.e. CUDA) work, provided that the previous workload using
  3442. * the input resource was submitted to the default stream.
  3443. * The client should not access any input buffer while they are mapped by the encoder.
  3444. * For D3D12 interface type, this function does not provide synchronization guarantee.
  3445. *
  3446. * \param [in] encoder
  3447. * Pointer to the NvEncodeAPI interface.
  3448. * \param [in,out] mapInputResParams
  3449. * Pointer to the ::_NV_ENC_MAP_INPUT_RESOURCE structure.
  3450. *
  3451. * \return
  3452. * ::NV_ENC_SUCCESS \n
  3453. * ::NV_ENC_ERR_INVALID_PTR \n
  3454. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3455. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3456. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3457. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3458. * ::NV_ENC_ERR_INVALID_VERSION \n
  3459. * ::NV_ENC_ERR_INVALID_PARAM \n
  3460. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3461. * ::NV_ENC_ERR_RESOURCE_NOT_REGISTERED \n
  3462. * ::NV_ENC_ERR_MAP_FAILED \n
  3463. * ::NV_ENC_ERR_GENERIC \n
  3464. *
  3465. */
  3466. NVENCSTATUS NVENCAPI NvEncMapInputResource (void* encoder, NV_ENC_MAP_INPUT_RESOURCE* mapInputResParams);
  3467. // NvEncUnmapInputResource
  3468. /**
  3469. * \brief UnMaps a NV_ENC_INPUT_PTR which was mapped for encoding
  3470. *
  3471. *
  3472. * UnMaps an input buffer which was previously mapped using ::NvEncMapInputResource()
  3473. * API. The mapping created using ::NvEncMapInputResource() should be invalidated
  3474. * using this API before the external resource is destroyed by the client. The client
  3475. * must unmap the buffer after ::NvEncLockBitstream() API returns successfully for encode
  3476. * work submitted using the mapped input buffer.
  3477. *
  3478. *
  3479. * \param [in] encoder
  3480. * Pointer to the NvEncodeAPI interface.
  3481. * \param [in] mappedInputBuffer
  3482. * Pointer to the NV_ENC_INPUT_PTR
  3483. *
  3484. * \return
  3485. * ::NV_ENC_SUCCESS \n
  3486. * ::NV_ENC_ERR_INVALID_PTR \n
  3487. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3488. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3489. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3490. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3491. * ::NV_ENC_ERR_INVALID_VERSION \n
  3492. * ::NV_ENC_ERR_INVALID_PARAM \n
  3493. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3494. * ::NV_ENC_ERR_RESOURCE_NOT_REGISTERED \n
  3495. * ::NV_ENC_ERR_RESOURCE_NOT_MAPPED \n
  3496. * ::NV_ENC_ERR_GENERIC \n
  3497. *
  3498. */
  3499. NVENCSTATUS NVENCAPI NvEncUnmapInputResource (void* encoder, NV_ENC_INPUT_PTR mappedInputBuffer);
  3500. // NvEncDestroyEncoder
  3501. /**
  3502. * \brief Destroy Encoding Session
  3503. *
  3504. * Destroys the encoder session previously created using ::NvEncOpenEncodeSession()
  3505. * function. The client must flush the encoder before freeing any resources. In order
  3506. * to flush the encoder the client must pass a NULL encode picture packet and either
  3507. * wait for the ::NvEncEncodePicture() function to return in synchronous mode or wait
  3508. * for the flush event to be signaled by the encoder in asynchronous mode.
  3509. * The client must free all the input and output resources created using the
  3510. * NvEncodeAPI interface before destroying the encoder. If the client is operating
  3511. * in asynchronous mode, it must also unregister the completion events previously
  3512. * registered.
  3513. *
  3514. * \param [in] encoder
  3515. * Pointer to the NvEncodeAPI interface.
  3516. *
  3517. * \return
  3518. * ::NV_ENC_SUCCESS \n
  3519. * ::NV_ENC_ERR_INVALID_PTR \n
  3520. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3521. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3522. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3523. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3524. * ::NV_ENC_ERR_INVALID_PARAM \n
  3525. * ::NV_ENC_ERR_GENERIC \n
  3526. *
  3527. */
  3528. NVENCSTATUS NVENCAPI NvEncDestroyEncoder (void* encoder);
  3529. // NvEncInvalidateRefFrames
  3530. /**
  3531. * \brief Invalidate reference frames
  3532. *
  3533. * Invalidates reference frame based on the time stamp provided by the client.
  3534. * The encoder marks any reference frames or any frames which have been reconstructed
  3535. * using the corrupt frame as invalid for motion estimation and uses older reference
  3536. * frames for motion estimation. The encoder forces the current frame to be encoded
  3537. * as an intra frame if no reference frames are left after invalidation process.
  3538. * This is useful for low latency application for error resiliency. The client
  3539. * is recommended to set NV_ENC_CONFIG_H264::maxNumRefFrames to a large value so
  3540. * that encoder can keep a backup of older reference frames in the DPB and can use them
  3541. * for motion estimation when the newer reference frames have been invalidated.
  3542. * This API can be called multiple times.
  3543. *
  3544. * \param [in] encoder
  3545. * Pointer to the NvEncodeAPI interface.
  3546. * \param [in] invalidRefFrameTimeStamp
  3547. * Timestamp of the invalid reference frames which needs to be invalidated.
  3548. *
  3549. * \return
  3550. * ::NV_ENC_SUCCESS \n
  3551. * ::NV_ENC_ERR_INVALID_PTR \n
  3552. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3553. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3554. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3555. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3556. * ::NV_ENC_ERR_INVALID_PARAM \n
  3557. * ::NV_ENC_ERR_GENERIC \n
  3558. *
  3559. */
  3560. NVENCSTATUS NVENCAPI NvEncInvalidateRefFrames(void* encoder, uint64_t invalidRefFrameTimeStamp);
  3561. // NvEncOpenEncodeSessionEx
  3562. /**
  3563. * \brief Opens an encoding session.
  3564. *
  3565. * Opens an encoding session and returns a pointer to the encoder interface in
  3566. * the \p **encoder parameter. The client should start encoding process by calling
  3567. * this API first.
  3568. * The client must pass a pointer to IDirect3DDevice9 device or CUDA context in the \p *device parameter.
  3569. * For the OpenGL interface, \p device must be NULL. An OpenGL context must be current when
  3570. * calling all NvEncodeAPI functions.
  3571. * If the creation of encoder session fails, the client must call ::NvEncDestroyEncoder API
  3572. * before exiting.
  3573. *
  3574. * \param [in] openSessionExParams
  3575. * Pointer to a ::NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS structure.
  3576. * \param [out] encoder
  3577. * Encode Session pointer to the NvEncodeAPI interface.
  3578. * \return
  3579. * ::NV_ENC_SUCCESS \n
  3580. * ::NV_ENC_ERR_INVALID_PTR \n
  3581. * ::NV_ENC_ERR_NO_ENCODE_DEVICE \n
  3582. * ::NV_ENC_ERR_UNSUPPORTED_DEVICE \n
  3583. * ::NV_ENC_ERR_INVALID_DEVICE \n
  3584. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3585. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3586. * ::NV_ENC_ERR_GENERIC \n
  3587. *
  3588. */
  3589. NVENCSTATUS NVENCAPI NvEncOpenEncodeSessionEx (NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS *openSessionExParams, void** encoder);
  3590. // NvEncRegisterResource
  3591. /**
  3592. * \brief Registers a resource with the Nvidia Video Encoder Interface.
  3593. *
  3594. * Registers a resource with the Nvidia Video Encoder Interface for book keeping.
  3595. * The client is expected to pass the registered resource handle as well, while calling ::NvEncMapInputResource API.
  3596. *
  3597. * \param [in] encoder
  3598. * Pointer to the NVEncodeAPI interface.
  3599. *
  3600. * \param [in] registerResParams
  3601. * Pointer to a ::_NV_ENC_REGISTER_RESOURCE structure
  3602. *
  3603. * \return
  3604. * ::NV_ENC_SUCCESS \n
  3605. * ::NV_ENC_ERR_INVALID_PTR \n
  3606. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3607. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3608. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3609. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3610. * ::NV_ENC_ERR_INVALID_VERSION \n
  3611. * ::NV_ENC_ERR_INVALID_PARAM \n
  3612. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3613. * ::NV_ENC_ERR_RESOURCE_REGISTER_FAILED \n
  3614. * ::NV_ENC_ERR_GENERIC \n
  3615. * ::NV_ENC_ERR_UNIMPLEMENTED \n
  3616. *
  3617. */
  3618. NVENCSTATUS NVENCAPI NvEncRegisterResource (void* encoder, NV_ENC_REGISTER_RESOURCE* registerResParams);
  3619. // NvEncUnregisterResource
  3620. /**
  3621. * \brief Unregisters a resource previously registered with the Nvidia Video Encoder Interface.
  3622. *
  3623. * Unregisters a resource previously registered with the Nvidia Video Encoder Interface.
  3624. * The client is expected to unregister any resource that it has registered with the
  3625. * Nvidia Video Encoder Interface before destroying the resource.
  3626. *
  3627. * \param [in] encoder
  3628. * Pointer to the NVEncodeAPI interface.
  3629. *
  3630. * \param [in] registeredResource
  3631. * The registered resource pointer that was returned in ::NvEncRegisterResource.
  3632. *
  3633. * \return
  3634. * ::NV_ENC_SUCCESS \n
  3635. * ::NV_ENC_ERR_INVALID_PTR \n
  3636. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3637. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3638. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3639. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3640. * ::NV_ENC_ERR_INVALID_VERSION \n
  3641. * ::NV_ENC_ERR_INVALID_PARAM \n
  3642. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3643. * ::NV_ENC_ERR_RESOURCE_NOT_REGISTERED \n
  3644. * ::NV_ENC_ERR_GENERIC \n
  3645. * ::NV_ENC_ERR_UNIMPLEMENTED \n
  3646. *
  3647. */
  3648. NVENCSTATUS NVENCAPI NvEncUnregisterResource (void* encoder, NV_ENC_REGISTERED_PTR registeredResource);
  3649. // NvEncReconfigureEncoder
  3650. /**
  3651. * \brief Reconfigure an existing encoding session.
  3652. *
  3653. * Reconfigure an existing encoding session.
  3654. * The client should call this API to change/reconfigure the parameter passed during
  3655. * NvEncInitializeEncoder API call.
  3656. * Currently Reconfiguration of following are not supported.
  3657. * Change in GOP structure.
  3658. * Change in sync-Async mode.
  3659. * Change in MaxWidth & MaxHeight.
  3660. * Change in PTD mode.
  3661. *
  3662. * Resolution change is possible only if maxEncodeWidth & maxEncodeHeight of NV_ENC_INITIALIZE_PARAMS
  3663. * is set while creating encoder session.
  3664. *
  3665. * \param [in] encoder
  3666. * Pointer to the NVEncodeAPI interface.
  3667. *
  3668. * \param [in] reInitEncodeParams
  3669. * Pointer to a ::NV_ENC_RECONFIGURE_PARAMS structure.
  3670. * \return
  3671. * ::NV_ENC_SUCCESS \n
  3672. * ::NV_ENC_ERR_INVALID_PTR \n
  3673. * ::NV_ENC_ERR_NO_ENCODE_DEVICE \n
  3674. * ::NV_ENC_ERR_UNSUPPORTED_DEVICE \n
  3675. * ::NV_ENC_ERR_INVALID_DEVICE \n
  3676. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3677. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3678. * ::NV_ENC_ERR_GENERIC \n
  3679. *
  3680. */
  3681. NVENCSTATUS NVENCAPI NvEncReconfigureEncoder (void *encoder, NV_ENC_RECONFIGURE_PARAMS* reInitEncodeParams);
  3682. // NvEncCreateMVBuffer
  3683. /**
  3684. * \brief Allocates output MV buffer for ME only mode.
  3685. *
  3686. * This function is used to allocate an output MV buffer. The size of the mvBuffer is
  3687. * dependent on the frame height and width of the last ::NvEncCreateInputBuffer() call.
  3688. * The NV_ENC_OUTPUT_PTR returned by the NvEncodeAPI interface in the
  3689. * ::NV_ENC_CREATE_MV_BUFFER::mvBuffer field should be used in
  3690. * ::NvEncRunMotionEstimationOnly() API.
  3691. * Client must lock ::NV_ENC_CREATE_MV_BUFFER::mvBuffer using ::NvEncLockBitstream() API to get the motion vector data.
  3692. *
  3693. * \param [in] encoder
  3694. * Pointer to the NvEncodeAPI interface.
  3695. * \param [in,out] createMVBufferParams
  3696. * Pointer to the ::NV_ENC_CREATE_MV_BUFFER structure.
  3697. *
  3698. * \return
  3699. * ::NV_ENC_SUCCESS \n
  3700. * ::NV_ENC_ERR_INVALID_PTR \n
  3701. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3702. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3703. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3704. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3705. * ::NV_ENC_ERR_INVALID_PARAM \n
  3706. * ::NV_ENC_ERR_INVALID_VERSION \n
  3707. * ::NV_ENC_ERR_GENERIC \n
  3708. */
  3709. NVENCSTATUS NVENCAPI NvEncCreateMVBuffer (void* encoder, NV_ENC_CREATE_MV_BUFFER* createMVBufferParams);
  3710. // NvEncDestroyMVBuffer
  3711. /**
  3712. * \brief Release an output MV buffer for ME only mode.
  3713. *
  3714. * This function is used to release the output MV buffer allocated using
  3715. * the ::NvEncCreateMVBuffer() function. The client must release the output
  3716. * mvBuffer using this function before destroying the encoder session.
  3717. *
  3718. * \param [in] encoder
  3719. * Pointer to the NvEncodeAPI interface.
  3720. * \param [in] mvBuffer
  3721. * Pointer to the mvBuffer being released.
  3722. *
  3723. * \return
  3724. * ::NV_ENC_SUCCESS \n
  3725. * ::NV_ENC_ERR_INVALID_PTR \n
  3726. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3727. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3728. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3729. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3730. * ::NV_ENC_ERR_INVALID_PARAM \n
  3731. * ::NV_ENC_ERR_INVALID_VERSION \n
  3732. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3733. * ::NV_ENC_ERR_GENERIC \n
  3734. */
  3735. NVENCSTATUS NVENCAPI NvEncDestroyMVBuffer (void* encoder, NV_ENC_OUTPUT_PTR mvBuffer);
  3736. // NvEncRunMotionEstimationOnly
  3737. /**
  3738. * \brief Submit an input picture and reference frame for motion estimation in ME only mode.
  3739. *
  3740. * This function is used to submit the input frame and reference frame for motion
  3741. * estimation. The ME parameters are passed using *meOnlyParams which is a pointer
  3742. * to ::_NV_ENC_MEONLY_PARAMS structure.
  3743. * Client must lock ::NV_ENC_CREATE_MV_BUFFER::mvBuffer using ::NvEncLockBitstream() API to get the motion vector data.
  3744. * to get motion vector data.
  3745. *
  3746. * \param [in] encoder
  3747. * Pointer to the NvEncodeAPI interface.
  3748. * \param [in] meOnlyParams
  3749. * Pointer to the ::_NV_ENC_MEONLY_PARAMS structure.
  3750. *
  3751. * \return
  3752. * ::NV_ENC_SUCCESS \n
  3753. * ::NV_ENC_ERR_INVALID_PTR \n
  3754. * ::NV_ENC_ERR_INVALID_ENCODERDEVICE \n
  3755. * ::NV_ENC_ERR_DEVICE_NOT_EXIST \n
  3756. * ::NV_ENC_ERR_UNSUPPORTED_PARAM \n
  3757. * ::NV_ENC_ERR_OUT_OF_MEMORY \n
  3758. * ::NV_ENC_ERR_INVALID_PARAM \n
  3759. * ::NV_ENC_ERR_INVALID_VERSION \n
  3760. * ::NV_ENC_ERR_NEED_MORE_INPUT \n
  3761. * ::NV_ENC_ERR_ENCODER_NOT_INITIALIZED \n
  3762. * ::NV_ENC_ERR_GENERIC \n
  3763. */
  3764. NVENCSTATUS NVENCAPI NvEncRunMotionEstimationOnly (void* encoder, NV_ENC_MEONLY_PARAMS* meOnlyParams);
  3765. // NvEncodeAPIGetMaxSupportedVersion
  3766. /**
  3767. * \brief Get the largest NvEncodeAPI version supported by the driver.
  3768. *
  3769. * This function can be used by clients to determine if the driver supports
  3770. * the NvEncodeAPI header the application was compiled with.
  3771. *
  3772. * \param [out] version
  3773. * Pointer to the requested value. The 4 least significant bits in the returned
  3774. * indicate the minor version and the rest of the bits indicate the major
  3775. * version of the largest supported version.
  3776. *
  3777. * \return
  3778. * ::NV_ENC_SUCCESS \n
  3779. * ::NV_ENC_ERR_INVALID_PTR \n
  3780. */
  3781. NVENCSTATUS NVENCAPI NvEncodeAPIGetMaxSupportedVersion (uint32_t* version);
  3782. // NvEncGetLastErrorString
  3783. /**
  3784. * \brief Get the description of the last error reported by the API.
  3785. *
  3786. * This function returns a null-terminated string that can be used by clients to better understand the reason
  3787. * for failure of a previous API call.
  3788. *
  3789. * \param [in] encoder
  3790. * Pointer to the NvEncodeAPI interface.
  3791. *
  3792. * \return
  3793. * Pointer to buffer containing the details of the last error encountered by the API.
  3794. */
  3795. const char * NVENCAPI NvEncGetLastErrorString (void* encoder);
  3796. /// \cond API PFN
  3797. /*
  3798. * Defines API function pointers
  3799. */
  3800. typedef NVENCSTATUS (NVENCAPI* PNVENCOPENENCODESESSION) (void* device, uint32_t deviceType, void** encoder);
  3801. typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEGUIDCOUNT) (void* encoder, uint32_t* encodeGUIDCount);
  3802. typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEGUIDS) (void* encoder, GUID* GUIDs, uint32_t guidArraySize, uint32_t* GUIDCount);
  3803. typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEPROFILEGUIDCOUNT) (void* encoder, GUID encodeGUID, uint32_t* encodeProfileGUIDCount);
  3804. typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEPROFILEGUIDS) (void* encoder, GUID encodeGUID, GUID* profileGUIDs, uint32_t guidArraySize, uint32_t* GUIDCount);
  3805. typedef NVENCSTATUS (NVENCAPI* PNVENCGETINPUTFORMATCOUNT) (void* encoder, GUID encodeGUID, uint32_t* inputFmtCount);
  3806. typedef NVENCSTATUS (NVENCAPI* PNVENCGETINPUTFORMATS) (void* encoder, GUID encodeGUID, NV_ENC_BUFFER_FORMAT* inputFmts, uint32_t inputFmtArraySize, uint32_t* inputFmtCount);
  3807. typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODECAPS) (void* encoder, GUID encodeGUID, NV_ENC_CAPS_PARAM* capsParam, int* capsVal);
  3808. typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEPRESETCOUNT) (void* encoder, GUID encodeGUID, uint32_t* encodePresetGUIDCount);
  3809. typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEPRESETGUIDS) (void* encoder, GUID encodeGUID, GUID* presetGUIDs, uint32_t guidArraySize, uint32_t* encodePresetGUIDCount);
  3810. typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEPRESETCONFIG) (void* encoder, GUID encodeGUID, GUID presetGUID, NV_ENC_PRESET_CONFIG* presetConfig);
  3811. typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODEPRESETCONFIGEX) (void* encoder, GUID encodeGUID, GUID presetGUID, NV_ENC_TUNING_INFO tuningInfo, NV_ENC_PRESET_CONFIG* presetConfig);
  3812. typedef NVENCSTATUS (NVENCAPI* PNVENCINITIALIZEENCODER) (void* encoder, NV_ENC_INITIALIZE_PARAMS* createEncodeParams);
  3813. typedef NVENCSTATUS (NVENCAPI* PNVENCCREATEINPUTBUFFER) (void* encoder, NV_ENC_CREATE_INPUT_BUFFER* createInputBufferParams);
  3814. typedef NVENCSTATUS (NVENCAPI* PNVENCDESTROYINPUTBUFFER) (void* encoder, NV_ENC_INPUT_PTR inputBuffer);
  3815. typedef NVENCSTATUS (NVENCAPI* PNVENCCREATEBITSTREAMBUFFER) (void* encoder, NV_ENC_CREATE_BITSTREAM_BUFFER* createBitstreamBufferParams);
  3816. typedef NVENCSTATUS (NVENCAPI* PNVENCDESTROYBITSTREAMBUFFER) (void* encoder, NV_ENC_OUTPUT_PTR bitstreamBuffer);
  3817. typedef NVENCSTATUS (NVENCAPI* PNVENCENCODEPICTURE) (void* encoder, NV_ENC_PIC_PARAMS* encodePicParams);
  3818. typedef NVENCSTATUS (NVENCAPI* PNVENCLOCKBITSTREAM) (void* encoder, NV_ENC_LOCK_BITSTREAM* lockBitstreamBufferParams);
  3819. typedef NVENCSTATUS (NVENCAPI* PNVENCUNLOCKBITSTREAM) (void* encoder, NV_ENC_OUTPUT_PTR bitstreamBuffer);
  3820. typedef NVENCSTATUS (NVENCAPI* PNVENCLOCKINPUTBUFFER) (void* encoder, NV_ENC_LOCK_INPUT_BUFFER* lockInputBufferParams);
  3821. typedef NVENCSTATUS (NVENCAPI* PNVENCUNLOCKINPUTBUFFER) (void* encoder, NV_ENC_INPUT_PTR inputBuffer);
  3822. typedef NVENCSTATUS (NVENCAPI* PNVENCGETENCODESTATS) (void* encoder, NV_ENC_STAT* encodeStats);
  3823. typedef NVENCSTATUS (NVENCAPI* PNVENCGETSEQUENCEPARAMS) (void* encoder, NV_ENC_SEQUENCE_PARAM_PAYLOAD* sequenceParamPayload);
  3824. typedef NVENCSTATUS (NVENCAPI* PNVENCREGISTERASYNCEVENT) (void* encoder, NV_ENC_EVENT_PARAMS* eventParams);
  3825. typedef NVENCSTATUS (NVENCAPI* PNVENCUNREGISTERASYNCEVENT) (void* encoder, NV_ENC_EVENT_PARAMS* eventParams);
  3826. typedef NVENCSTATUS (NVENCAPI* PNVENCMAPINPUTRESOURCE) (void* encoder, NV_ENC_MAP_INPUT_RESOURCE* mapInputResParams);
  3827. typedef NVENCSTATUS (NVENCAPI* PNVENCUNMAPINPUTRESOURCE) (void* encoder, NV_ENC_INPUT_PTR mappedInputBuffer);
  3828. typedef NVENCSTATUS (NVENCAPI* PNVENCDESTROYENCODER) (void* encoder);
  3829. typedef NVENCSTATUS (NVENCAPI* PNVENCINVALIDATEREFFRAMES) (void* encoder, uint64_t invalidRefFrameTimeStamp);
  3830. typedef NVENCSTATUS (NVENCAPI* PNVENCOPENENCODESESSIONEX) (NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS *openSessionExParams, void** encoder);
  3831. typedef NVENCSTATUS (NVENCAPI* PNVENCREGISTERRESOURCE) (void* encoder, NV_ENC_REGISTER_RESOURCE* registerResParams);
  3832. typedef NVENCSTATUS (NVENCAPI* PNVENCUNREGISTERRESOURCE) (void* encoder, NV_ENC_REGISTERED_PTR registeredRes);
  3833. typedef NVENCSTATUS (NVENCAPI* PNVENCRECONFIGUREENCODER) (void* encoder, NV_ENC_RECONFIGURE_PARAMS* reInitEncodeParams);
  3834. typedef NVENCSTATUS (NVENCAPI* PNVENCCREATEMVBUFFER) (void* encoder, NV_ENC_CREATE_MV_BUFFER* createMVBufferParams);
  3835. typedef NVENCSTATUS (NVENCAPI* PNVENCDESTROYMVBUFFER) (void* encoder, NV_ENC_OUTPUT_PTR mvBuffer);
  3836. typedef NVENCSTATUS (NVENCAPI* PNVENCRUNMOTIONESTIMATIONONLY) (void* encoder, NV_ENC_MEONLY_PARAMS* meOnlyParams);
  3837. typedef const char * (NVENCAPI* PNVENCGETLASTERROR) (void* encoder);
  3838. typedef NVENCSTATUS (NVENCAPI* PNVENCSETIOCUDASTREAMS) (void* encoder, NV_ENC_CUSTREAM_PTR inputStream, NV_ENC_CUSTREAM_PTR outputStream);
  3839. typedef NVENCSTATUS (NVENCAPI* PNVENCGETSEQUENCEPARAMEX) (void* encoder, NV_ENC_INITIALIZE_PARAMS* encInitParams, NV_ENC_SEQUENCE_PARAM_PAYLOAD* sequenceParamPayload);
  3840. /// \endcond
  3841. /** @} */ /* END ENCODE_FUNC */
  3842. /**
  3843. * \ingroup ENCODER_STRUCTURE
  3844. * NV_ENCODE_API_FUNCTION_LIST
  3845. */
  3846. typedef struct _NV_ENCODE_API_FUNCTION_LIST
  3847. {
  3848. uint32_t version; /**< [in]: Client should pass NV_ENCODE_API_FUNCTION_LIST_VER. */
  3849. uint32_t reserved; /**< [in]: Reserved and should be set to 0. */
  3850. PNVENCOPENENCODESESSION nvEncOpenEncodeSession; /**< [out]: Client should access ::NvEncOpenEncodeSession() API through this pointer. */
  3851. PNVENCGETENCODEGUIDCOUNT nvEncGetEncodeGUIDCount; /**< [out]: Client should access ::NvEncGetEncodeGUIDCount() API through this pointer. */
  3852. PNVENCGETENCODEPRESETCOUNT nvEncGetEncodeProfileGUIDCount; /**< [out]: Client should access ::NvEncGetEncodeProfileGUIDCount() API through this pointer.*/
  3853. PNVENCGETENCODEPRESETGUIDS nvEncGetEncodeProfileGUIDs; /**< [out]: Client should access ::NvEncGetEncodeProfileGUIDs() API through this pointer. */
  3854. PNVENCGETENCODEGUIDS nvEncGetEncodeGUIDs; /**< [out]: Client should access ::NvEncGetEncodeGUIDs() API through this pointer. */
  3855. PNVENCGETINPUTFORMATCOUNT nvEncGetInputFormatCount; /**< [out]: Client should access ::NvEncGetInputFormatCount() API through this pointer. */
  3856. PNVENCGETINPUTFORMATS nvEncGetInputFormats; /**< [out]: Client should access ::NvEncGetInputFormats() API through this pointer. */
  3857. PNVENCGETENCODECAPS nvEncGetEncodeCaps; /**< [out]: Client should access ::NvEncGetEncodeCaps() API through this pointer. */
  3858. PNVENCGETENCODEPRESETCOUNT nvEncGetEncodePresetCount; /**< [out]: Client should access ::NvEncGetEncodePresetCount() API through this pointer. */
  3859. PNVENCGETENCODEPRESETGUIDS nvEncGetEncodePresetGUIDs; /**< [out]: Client should access ::NvEncGetEncodePresetGUIDs() API through this pointer. */
  3860. PNVENCGETENCODEPRESETCONFIG nvEncGetEncodePresetConfig; /**< [out]: Client should access ::NvEncGetEncodePresetConfig() API through this pointer. */
  3861. PNVENCINITIALIZEENCODER nvEncInitializeEncoder; /**< [out]: Client should access ::NvEncInitializeEncoder() API through this pointer. */
  3862. PNVENCCREATEINPUTBUFFER nvEncCreateInputBuffer; /**< [out]: Client should access ::NvEncCreateInputBuffer() API through this pointer. */
  3863. PNVENCDESTROYINPUTBUFFER nvEncDestroyInputBuffer; /**< [out]: Client should access ::NvEncDestroyInputBuffer() API through this pointer. */
  3864. PNVENCCREATEBITSTREAMBUFFER nvEncCreateBitstreamBuffer; /**< [out]: Client should access ::NvEncCreateBitstreamBuffer() API through this pointer. */
  3865. PNVENCDESTROYBITSTREAMBUFFER nvEncDestroyBitstreamBuffer; /**< [out]: Client should access ::NvEncDestroyBitstreamBuffer() API through this pointer. */
  3866. PNVENCENCODEPICTURE nvEncEncodePicture; /**< [out]: Client should access ::NvEncEncodePicture() API through this pointer. */
  3867. PNVENCLOCKBITSTREAM nvEncLockBitstream; /**< [out]: Client should access ::NvEncLockBitstream() API through this pointer. */
  3868. PNVENCUNLOCKBITSTREAM nvEncUnlockBitstream; /**< [out]: Client should access ::NvEncUnlockBitstream() API through this pointer. */
  3869. PNVENCLOCKINPUTBUFFER nvEncLockInputBuffer; /**< [out]: Client should access ::NvEncLockInputBuffer() API through this pointer. */
  3870. PNVENCUNLOCKINPUTBUFFER nvEncUnlockInputBuffer; /**< [out]: Client should access ::NvEncUnlockInputBuffer() API through this pointer. */
  3871. PNVENCGETENCODESTATS nvEncGetEncodeStats; /**< [out]: Client should access ::NvEncGetEncodeStats() API through this pointer. */
  3872. PNVENCGETSEQUENCEPARAMS nvEncGetSequenceParams; /**< [out]: Client should access ::NvEncGetSequenceParams() API through this pointer. */
  3873. PNVENCREGISTERASYNCEVENT nvEncRegisterAsyncEvent; /**< [out]: Client should access ::NvEncRegisterAsyncEvent() API through this pointer. */
  3874. PNVENCUNREGISTERASYNCEVENT nvEncUnregisterAsyncEvent; /**< [out]: Client should access ::NvEncUnregisterAsyncEvent() API through this pointer. */
  3875. PNVENCMAPINPUTRESOURCE nvEncMapInputResource; /**< [out]: Client should access ::NvEncMapInputResource() API through this pointer. */
  3876. PNVENCUNMAPINPUTRESOURCE nvEncUnmapInputResource; /**< [out]: Client should access ::NvEncUnmapInputResource() API through this pointer. */
  3877. PNVENCDESTROYENCODER nvEncDestroyEncoder; /**< [out]: Client should access ::NvEncDestroyEncoder() API through this pointer. */
  3878. PNVENCINVALIDATEREFFRAMES nvEncInvalidateRefFrames; /**< [out]: Client should access ::NvEncInvalidateRefFrames() API through this pointer. */
  3879. PNVENCOPENENCODESESSIONEX nvEncOpenEncodeSessionEx; /**< [out]: Client should access ::NvEncOpenEncodeSession() API through this pointer. */
  3880. PNVENCREGISTERRESOURCE nvEncRegisterResource; /**< [out]: Client should access ::NvEncRegisterResource() API through this pointer. */
  3881. PNVENCUNREGISTERRESOURCE nvEncUnregisterResource; /**< [out]: Client should access ::NvEncUnregisterResource() API through this pointer. */
  3882. PNVENCRECONFIGUREENCODER nvEncReconfigureEncoder; /**< [out]: Client should access ::NvEncReconfigureEncoder() API through this pointer. */
  3883. void* reserved1;
  3884. PNVENCCREATEMVBUFFER nvEncCreateMVBuffer; /**< [out]: Client should access ::NvEncCreateMVBuffer API through this pointer. */
  3885. PNVENCDESTROYMVBUFFER nvEncDestroyMVBuffer; /**< [out]: Client should access ::NvEncDestroyMVBuffer API through this pointer. */
  3886. PNVENCRUNMOTIONESTIMATIONONLY nvEncRunMotionEstimationOnly; /**< [out]: Client should access ::NvEncRunMotionEstimationOnly API through this pointer. */
  3887. PNVENCGETLASTERROR nvEncGetLastErrorString; /**< [out]: Client should access ::nvEncGetLastErrorString API through this pointer. */
  3888. PNVENCSETIOCUDASTREAMS nvEncSetIOCudaStreams; /**< [out]: Client should access ::nvEncSetIOCudaStreams API through this pointer. */
  3889. PNVENCGETENCODEPRESETCONFIGEX nvEncGetEncodePresetConfigEx; /**< [out]: Client should access ::NvEncGetEncodePresetConfigEx() API through this pointer. */
  3890. PNVENCGETSEQUENCEPARAMEX nvEncGetSequenceParamEx; /**< [out]: Client should access ::NvEncGetSequenceParamEx() API through this pointer. */
  3891. void* reserved2[277]; /**< [in]: Reserved and must be set to NULL */
  3892. } NV_ENCODE_API_FUNCTION_LIST;
  3893. /** Macro for constructing the version field of ::_NV_ENCODEAPI_FUNCTION_LIST. */
  3894. #define NV_ENCODE_API_FUNCTION_LIST_VER NVENCAPI_STRUCT_VERSION(2)
  3895. // NvEncodeAPICreateInstance
  3896. /**
  3897. * \ingroup ENCODE_FUNC
  3898. * Entry Point to the NvEncodeAPI interface.
  3899. *
  3900. * Creates an instance of the NvEncodeAPI interface, and populates the
  3901. * pFunctionList with function pointers to the API routines implemented by the
  3902. * NvEncodeAPI interface.
  3903. *
  3904. * \param [out] functionList
  3905. *
  3906. * \return
  3907. * ::NV_ENC_SUCCESS
  3908. * ::NV_ENC_ERR_INVALID_PTR
  3909. */
  3910. NVENCSTATUS NVENCAPI NvEncodeAPICreateInstance(NV_ENCODE_API_FUNCTION_LIST *functionList);
  3911. #ifdef __cplusplus
  3912. }
  3913. #endif
  3914. #endif