v4l2_nv_extensions.h 92 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720
  1. /*
  2. * Copyright (c) 2016-2023, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in
  11. * the documentation and/or other materials provided with the
  12. * distribution.
  13. * 3. The names of its contributors may not be used to endorse or promote
  14. * products derived from this software without specific prior written
  15. * permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  20. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  21. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  22. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
  23. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  24. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  25. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  26. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  27. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. /* This file contains amendments to the V4L2 headers made after the
  30. * supported kernel version and NVIDIA extensions.
  31. */
  32. #ifndef __V4L2_NV_EXTENSIONS_H__
  33. #define __V4L2_NV_EXTENSIONS_H__
  34. /**
  35. * @file
  36. * <b>NVIDIA V4L2 API Extensions</b>
  37. *
  38. * @b Description: This file declares NVIDIA V4L2 extensions,
  39. * controls and structures.
  40. */
  41. /**
  42. *
  43. * @defgroup ee_extensions_group V4L2 NV Extensions API
  44. *
  45. * This file declares NVIDIA V4L2 extensions, controls, and structures.
  46. *
  47. */
  48. /**
  49. * Defines V4L2 pixel format for DIVX.
  50. */
  51. #define V4L2_PIX_FMT_DIVX4 v4l2_fourcc('D', 'V', 'X', '4')
  52. #define V4L2_PIX_FMT_DIVX5 v4l2_fourcc('D', 'V', 'X', '5')
  53. /**
  54. * Defines V4L2 pixel format for H.265.
  55. */
  56. #define V4L2_PIX_FMT_H265 v4l2_fourcc('H', '2', '6', '5')
  57. /**
  58. * Defines the V4L2 pixel format for VP9.
  59. */
  60. #define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0')
  61. /**
  62. * Defines the V4L2 pixel format for AV1.
  63. */
  64. #define V4L2_PIX_FMT_AV1 v4l2_fourcc('A', 'V', '1', '0')
  65. /**
  66. * Defines the V4L2 pixel format for representing single plane 10-bit Y/CbCr 4:2:0 decoder data.
  67. */
  68. #define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* Y/CbCr 4:2:0, 10 bits per channel */
  69. /**
  70. * Defines the V4L2 pixel format for representing semi-planar 10-bit Y/CbCr 4:2:0 decoder data.
  71. */
  72. #define V4L2_PIX_FMT_P010M v4l2_fourcc('P', 'M', '1', '0') /* Y/CbCr 4:2:0, 10 bits per channel */
  73. /**
  74. * Defines the V4L2 pixel format for representing single plane 12-bit Y/CbCr 4:2:0 decoder data.
  75. */
  76. #define V4L2_PIX_FMT_P012 v4l2_fourcc('P', '0', '1', '2') /* Y/CbCr 4:2:0, 12 bits per channel */
  77. /**
  78. * Defines the V4L2 pixel format for representing semi-planar 12-bit Y/CbCr 4:2:0 decoder data.
  79. */
  80. #define V4L2_PIX_FMT_P012M v4l2_fourcc('P', 'M', '1', '2') /* Y/CbCr 4:2:0, 12 bits per channel */
  81. /**
  82. * Defines the V4L2 pixel format for representing semi-planar 8-bit Y/CbCr 4:4:4 decoder data.
  83. */
  84. #define V4L2_PIX_FMT_NV24M v4l2_fourcc('N', 'M', '2', '4') /* Y/CbCr 4:4:4, 8 bits per channel */
  85. /**
  86. * Defines the V4L2 pixel format for representing semi-planar 10-bit Y/CbCr 4:4:4 decoder data.
  87. */
  88. #define V4L2_PIX_FMT_NV24_10LE v4l2_fourcc('N', 'V', '1', '0') /* Y/CbCr 4:4:4, 10 bits per channel */
  89. /**
  90. * Defines the V4L2 pixel format for representing planar 10-bit Y/CbCr 4:4:4 decoder data.
  91. */
  92. #define V4L2_PIX_FMT_YUV444_10LE v4l2_fourcc('P', '4', '1', '0') /* Y/Cb/Cr 4:4:4, 10 bits per channel */
  93. /**
  94. * Defines the V4L2 pixel format for representing planar 12-bit Y/CbCr 4:4:4 decoder data.
  95. */
  96. #define V4L2_PIX_FMT_YUV444_12LE v4l2_fourcc('P', '4', '1', '2') /* Y/Cb/Cr 4:4:4, 12 bits per channel */
  97. /** @cond UNUSED */
  98. /* >> The declarations from here to the next endcond statement are not
  99. * >> currently implemented. DO NOT USE. */
  100. #define V4L2_PIX_FMT_YUV422RM v4l2_fourcc('4', '2', 'R', 'M')
  101. #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /** H264 parsed slices. */
  102. #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') /** VP8 parsed frames. */
  103. #define V4L2_CTRL_FLAG_CAN_STORE 0x0200
  104. /** @endcond */
  105. /**
  106. * Defines the V4L2 event type for decoder resolution event change.
  107. */
  108. #define V4L2_EVENT_RESOLUTION_CHANGE 5
  109. /** @cond UNUSED */
  110. /* >> The declarations from here to the next endcond statement are not
  111. * >> currently implemented. DO NOT USE. */
  112. /*---------------Below are changes from the v4l2-controls.h----------------------*/
  113. #define V4L2_CID_MPEG_VIDEO_H264_SPS (V4L2_CID_MPEG_BASE+383)
  114. #define V4L2_CID_MPEG_VIDEO_H264_PPS (V4L2_CID_MPEG_BASE+384)
  115. #define V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX (V4L2_CID_MPEG_BASE+385)
  116. #define V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAM (V4L2_CID_MPEG_BASE+386)
  117. #define V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAM (V4L2_CID_MPEG_BASE+387)
  118. #define V4L2_CID_MPEG_VIDEO_VP8_FRAME_HDR (V4L2_CID_MPEG_BASE+512)
  119. /** @endcond */
  120. /**
  121. * Defines the control ID to set the H.265 encoder profile.
  122. *
  123. * A v4l2_mpeg_video_h265_profile must be passed.
  124. */
  125. #define V4L2_CID_MPEG_VIDEO_H265_PROFILE (V4L2_CID_MPEG_BASE+513)
  126. /**
  127. * Defines the possible profiles for H.265 encoder.
  128. */
  129. enum v4l2_mpeg_video_h265_profile {
  130. /** H.265 Main profile. */
  131. V4L2_MPEG_VIDEO_H265_PROFILE_MAIN = 0,
  132. /** H.265 Main10 profile. */
  133. V4L2_MPEG_VIDEO_H265_PROFILE_MAIN10 = 1,
  134. /** H.265 MainStillPicture profile. */
  135. V4L2_MPEG_VIDEO_H265_PROFILE_MAINSTILLPICTURE = 2,
  136. /** H.265 FREXT profile. */
  137. V4L2_MPEG_VIDEO_H265_PROFILE_FREXT = 3,
  138. };
  139. /**
  140. * Defines the control ID to set the encoder IDR frame interval.
  141. * Must be used with \c VIDIOC_S_EXT_CTRLS IOCTL.
  142. */
  143. #define V4L2_CID_MPEG_VIDEO_IDR_INTERVAL (V4L2_CID_MPEG_BASE+514)
  144. /** @cond UNUSED */
  145. /* >> The declarations from here to the next endcond statement are not
  146. * >> currently implemented. DO NOT USE. */
  147. /* Complex controls */
  148. #define V4L2_H264_SPS_CONSTRAINT_SET0_FLAG 0x01
  149. #define V4L2_H264_SPS_CONSTRAINT_SET1_FLAG 0x02
  150. #define V4L2_H264_SPS_CONSTRAINT_SET2_FLAG 0x04
  151. #define V4L2_H264_SPS_CONSTRAINT_SET3_FLAG 0x08
  152. #define V4L2_H264_SPS_CONSTRAINT_SET4_FLAG 0x10
  153. #define V4L2_H264_SPS_CONSTRAINT_SET5_FLAG 0x20
  154. #define V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE 0x01
  155. #define V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS 0x02
  156. #define V4L2_H264_SPS_FLAG_DELTA_PIC_ORDER_ALWAYS_ZERO 0x04
  157. #define V4L2_H264_SPS_FLAG_GAPS_IN_FRAME_NUM_VALUE_ALLOWED 0x08
  158. #define V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY 0x10
  159. #define V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD 0x20
  160. #define V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE 0x40
  161. struct v4l2_ctrl_h264_sps {
  162. __u8 profile_idc;
  163. __u8 constraint_set_flags;
  164. __u8 level_idc;
  165. __u8 seq_parameter_set_id;
  166. __u8 chroma_format_idc;
  167. __u8 bit_depth_luma_minus8;
  168. __u8 bit_depth_chroma_minus8;
  169. __u8 log2_max_frame_num_minus4;
  170. __u8 pic_order_cnt_type;
  171. __u8 log2_max_pic_order_cnt_lsb_minus4;
  172. __s32 offset_for_non_ref_pic;
  173. __s32 offset_for_top_to_bottom_field;
  174. __u8 num_ref_frames_in_pic_order_cnt_cycle;
  175. __s32 offset_for_ref_frame[255];
  176. __u8 max_num_ref_frames;
  177. __u16 pic_width_in_mbs_minus1;
  178. __u16 pic_height_in_map_units_minus1;
  179. __u8 flags;
  180. };
  181. #define V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE 0x0001
  182. #define V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT 0x0002
  183. #define V4L2_H264_PPS_FLAG_WEIGHTED_PRED 0x0004
  184. #define V4L2_H264_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT 0x0008
  185. #define V4L2_H264_PPS_FLAG_CONSTRAINED_INTRA_PRED 0x0010
  186. #define V4L2_H264_PPS_FLAG_REDUNDANT_PIC_CNT_PRESENT 0x0020
  187. #define V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE 0x0040
  188. #define V4L2_H264_PPS_FLAG_PIC_SCALING_MATRIX_PRESENT 0x0080
  189. struct v4l2_ctrl_h264_pps {
  190. __u8 pic_parameter_set_id;
  191. __u8 seq_parameter_set_id;
  192. __u8 num_slice_groups_minus1;
  193. __u8 num_ref_idx_l0_default_active_minus1;
  194. __u8 num_ref_idx_l1_default_active_minus1;
  195. __u8 weighted_bipred_idc;
  196. __s8 pic_init_qp_minus26;
  197. __s8 pic_init_qs_minus26;
  198. __s8 chroma_qp_index_offset;
  199. __s8 second_chroma_qp_index_offset;
  200. __u8 flags;
  201. };
  202. struct v4l2_ctrl_h264_scaling_matrix {
  203. __u8 scaling_list_4x4[6][16];
  204. __u8 scaling_list_8x8[6][64];
  205. };
  206. struct v4l2_h264_weight_factors {
  207. __s8 luma_weight[32];
  208. __s8 luma_offset[32];
  209. __s8 chroma_weight[32][2];
  210. __s8 chroma_offset[32][2];
  211. };
  212. struct v4l2_h264_pred_weight_table {
  213. __u8 luma_log2_weight_denom;
  214. __u8 chroma_log2_weight_denom;
  215. struct v4l2_h264_weight_factors weight_factors[2];
  216. };
  217. #define V4L2_SLICE_FLAG_FIELD_PIC 0x01
  218. #define V4L2_SLICE_FLAG_BOTTOM_FIELD 0x02
  219. #define V4L2_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x04
  220. #define V4L2_SLICE_FLAG_SP_FOR_SWITCH 0x08
  221. struct v4l2_ctrl_h264_slice_param {
  222. /** Holds the size in bytes, including the header. */
  223. __u32 size;
  224. /** Holds the offset in bits to slice_data() from the beginning of this slice. */
  225. __u32 header_bit_size;
  226. __u16 first_mb_in_slice;
  227. __u8 slice_type;
  228. __u8 pic_parameter_set_id;
  229. __u8 colour_plane_id;
  230. __u16 frame_num;
  231. __u16 idr_pic_id;
  232. __u16 pic_order_cnt_lsb;
  233. __s32 delta_pic_order_cnt_bottom;
  234. __s32 delta_pic_order_cnt0;
  235. __s32 delta_pic_order_cnt1;
  236. __u8 redundant_pic_cnt;
  237. struct v4l2_h264_pred_weight_table pred_weight_table;
  238. /* Size in bits of dec_ref_pic_marking() syntax element. */
  239. __u32 dec_ref_pic_marking_bit_size;
  240. /* Size in bits of pic order count syntax. */
  241. __u32 pic_order_cnt_bit_size;
  242. __u8 cabac_init_idc;
  243. __s8 slice_qp_delta;
  244. __s8 slice_qs_delta;
  245. __u8 disable_deblocking_filter_idc;
  246. __s8 slice_alpha_c0_offset_div2;
  247. __s8 slice_beta_offset_div2;
  248. __u32 slice_group_change_cycle;
  249. __u8 num_ref_idx_l0_active_minus1;
  250. __u8 num_ref_idx_l1_active_minus1;
  251. /* Entries on each list are indices
  252. * into v4l2_ctrl_h264_decode_param.dpb[]. */
  253. __u8 ref_pic_list0[32];
  254. __u8 ref_pic_list1[32];
  255. __u8 flags;
  256. };
  257. /** Defines whether the v4l2_h264_dpb_entry structure is used.
  258. If not set, this entry is unused for reference. */
  259. #define V4L2_H264_DPB_ENTRY_FLAG_ACTIVE 0x01
  260. #define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM 0x02
  261. struct v4l2_h264_dpb_entry {
  262. __u32 buf_index; /**< v4l2_buffer index. */
  263. __u16 frame_num;
  264. __u16 pic_num;
  265. /** @note `v4l2_buffer.field` specifies this field. */
  266. __s32 top_field_order_cnt;
  267. __s32 bottom_field_order_cnt;
  268. __u8 flags; /* V4L2_H264_DPB_ENTRY_FLAG_* */
  269. };
  270. struct v4l2_ctrl_h264_decode_param {
  271. __u32 num_slices;
  272. __u8 idr_pic_flag;
  273. __u8 nal_ref_idc;
  274. __s32 top_field_order_cnt;
  275. __s32 bottom_field_order_cnt;
  276. __u8 ref_pic_list_p0[32];
  277. __u8 ref_pic_list_b0[32];
  278. __u8 ref_pic_list_b1[32];
  279. struct v4l2_h264_dpb_entry dpb[16];
  280. };
  281. #define V4L2_VP8_SEGMNT_HDR_FLAG_ENABLED 0x01
  282. #define V4L2_VP8_SEGMNT_HDR_FLAG_UPDATE_MAP 0x02
  283. #define V4L2_VP8_SEGMNT_HDR_FLAG_UPDATE_FEATURE_DATA 0x04
  284. struct v4l2_vp8_sgmnt_hdr {
  285. __u8 segment_feature_mode;
  286. __s8 quant_update[4];
  287. __s8 lf_update[4];
  288. __u8 segment_probs[3];
  289. __u8 flags;
  290. };
  291. #define V4L2_VP8_LF_HDR_ADJ_ENABLE 0x01
  292. #define V4L2_VP8_LF_HDR_DELTA_UPDATE 0x02
  293. struct v4l2_vp8_loopfilter_hdr {
  294. __u8 type;
  295. __u8 level;
  296. __u8 sharpness_level;
  297. __s8 ref_frm_delta_magnitude[4];
  298. __s8 mb_mode_delta_magnitude[4];
  299. __u8 flags;
  300. };
  301. struct v4l2_vp8_quantization_hdr {
  302. __u8 y_ac_qi;
  303. __s8 y_dc_delta;
  304. __s8 y2_dc_delta;
  305. __s8 y2_ac_delta;
  306. __s8 uv_dc_delta;
  307. __s8 uv_ac_delta;
  308. __u16 dequant_factors[4][3][2];
  309. };
  310. struct v4l2_vp8_entropy_hdr {
  311. __u8 coeff_probs[4][8][3][11];
  312. __u8 y_mode_probs[4];
  313. __u8 uv_mode_probs[3];
  314. __u8 mv_probs[2][19];
  315. };
  316. #define V4L2_VP8_FRAME_HDR_FLAG_EXPERIMENTAL 0x01
  317. #define V4L2_VP8_FRAME_HDR_FLAG_SHOW_FRAME 0x02
  318. #define V4L2_VP8_FRAME_HDR_FLAG_MB_NO_SKIP_COEFF 0x04
  319. struct v4l2_ctrl_vp8_frame_hdr {
  320. /** 0: keyframe, 1: not a keyframe. */
  321. __u8 key_frame;
  322. __u8 version;
  323. /** Populated also if not a key frame. */
  324. __u16 width;
  325. __u8 horizontal_scale;
  326. __u16 height;
  327. __u8 vertical_scale;
  328. struct v4l2_vp8_sgmnt_hdr sgmnt_hdr;
  329. struct v4l2_vp8_loopfilter_hdr lf_hdr;
  330. struct v4l2_vp8_quantization_hdr quant_hdr;
  331. struct v4l2_vp8_entropy_hdr entropy_hdr;
  332. __u8 sign_bias_golden;
  333. __u8 sign_bias_alternate;
  334. __u8 prob_skip_false;
  335. __u8 prob_intra;
  336. __u8 prob_last;
  337. __u8 prob_gf;
  338. __u32 first_part_size;
  339. /**
  340. * Holds the offset in bits of the MB data in the first partition,
  341. * i.e. bit offset starting from first_part_offset.
  342. */
  343. __u32 first_part_offset;
  344. __u32 macroblock_bit_offset;
  345. __u8 num_dct_parts;
  346. __u32 dct_part_sizes[8];
  347. __u8 bool_dec_range;
  348. __u8 bool_dec_value;
  349. __u8 bool_dec_count;
  350. /** Holds the v4l2_buffer index of the last reference frame. */
  351. __u32 last_frame;
  352. /** Holds the v4l2_buffer index of the golden reference frame. */
  353. __u32 golden_frame;
  354. /** Holds the v4l2_buffer index of the alt reference frame. */
  355. __u32 alt_frame;
  356. __u8 flags;
  357. };
  358. /** @endcond */
  359. /*---------------Add below NVIDIA specific extensions ----------------------*/
  360. /**
  361. * @defgroup V4L2Dec V4L2 Video Decoder
  362. *
  363. * @brief NVIDIA V4L2 Video Decoder Description and Extensions
  364. *
  365. * The video decoder device node is
  366. *
  367. * /dev/nvhost-nvdec
  368. *
  369. * ### Supported Pixel Formats
  370. * OUTPUT PLANE | CAPTURE PLANE | PLATFORM
  371. * :----------------: | :----------------: | :--------------------:
  372. * V4L2_PIX_FMT_H264 | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  373. * V4L2_PIX_FMT_H265 | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  374. * V4L2_PIX_FMT_VP8 | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  375. * V4L2_PIX_FMT_VP9 | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  376. * V4L2_PIX_FMT_MPEG1 | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  377. * V4L2_PIX_FMT_MPEG2 | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  378. * V4L2_PIX_FMT_MPEG4 | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  379. * V4L2_PIX_FMT_DIVX4 | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  380. * V4L2_PIX_FMT_DIVX5 | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  381. * V4L2_PIX_FMT_JPEG | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  382. * V4L2_PIX_FMT_MJPEG | V4L2_PIX_FMT_NV12M | T210, T186, T194, T234
  383. * V4L2_PIX_FMT_AV1 | V4L2_PIX_FMT_NV12M | T234
  384. *
  385. * ### Supported Memory Types
  386. * MEMORY | OUTPUT PLANE | CAPTURE PLANE
  387. * :------------------: | :----------: | :-----------:
  388. * V4L2_MEMORY_MMAP | Y | Y
  389. * V4L2_MEMORY_DMABUF | N | Y
  390. * V4L2_MEMORY_USERPTR | Y | N
  391. *
  392. * ### Supported Controls
  393. * - #V4L2_CID_MPEG_VIDEO_DISABLE_COMPLETE_FRAME_INPUT
  394. * - #V4L2_CID_MPEG_VIDEO_DISABLE_DPB
  395. * - #V4L2_CID_MPEG_VIDEO_ERROR_REPORTING
  396. * - #V4L2_CID_MPEG_VIDEO_SKIP_FRAMES
  397. * - V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (Get the minimum buffers to be allocated on capture plane.
  398. * Read only. Valid after #V4L2_EVENT_RESOLUTION_CHANGE)
  399. * - #V4L2_CID_MPEG_VIDEODEC_INPUT_METADATA
  400. * - #V4L2_CID_MPEG_VIDEODEC_METADATA
  401. * - #V4L2_CID_MPEG_VIDEO_CUDA_MEM_TYPE
  402. * - #V4L2_CID_MPEG_VIDEO_CUDA_GPU_ID
  403. * - #V4L2_CID_MPEG_VIDEODEC_DROP_FRAME_INTERVAL
  404. *
  405. * ### Supported Events
  406. * Event | Purpose
  407. * ----------------------------- | :----------------------------:
  408. * #V4L2_EVENT_RESOLUTION_CHANGE | Resolution of the stream has changed.
  409. *
  410. * ### Handling Resolution Change Events
  411. * When the decoder generates a \c V4L2_EVENT_RESOLUTION_CHANGE event, the
  412. * application calls \c STREAMOFF on the capture plane to tell the decoder to
  413. * deallocate the current buffers by calling REQBUF with count zero, get
  414. * the new capture plane format, and then proceed with setting up the buffers
  415. * for the capture plane.
  416. *
  417. * In case of decoder, the buffer format might differ from the display resolution.
  418. * The application must use \c VIDIOC_G_CROP to get the display resolution.
  419. *
  420. * ### EOS Handling
  421. * The following sequence must be followed for sending EOS and recieving EOS
  422. * from the decoder.
  423. * -# Send EOS to decoder by queueing on the output plane a buffer with
  424. * bytesused = 0 for the 0th plane (`v4l2_buffer.m.planes[0].bytesused = 0`).
  425. * -# Dequeues buffers on the output plane until it gets a buffer with bytesused = 0
  426. * for the 0th plane (`v4l2_buffer.m.planes[0].bytesused == 0`)
  427. * -# Dequeues buffers on the capture plane until it gets a buffer with bytesused = 0
  428. * for the 0th plane.
  429. *
  430. * ### Decoder Input Frame Metadata
  431. * Decoder supports reporting stream header parsing error info as input frame metadata.
  432. * See \c V4L2_CID_MPEG_VIDEO_ERROR_REPORTING, \c V4L2_CID_MPEG_VIDEODEC_INPUT_METADATA
  433. * and \c v4l2_ctrl_video_metadata for more information.
  434. *
  435. * ### Decoder Output Frame Metadata
  436. * Decoder supports reporting frame related metadata, including error reports and
  437. * DPB info. See \c V4L2_CID_MPEG_VIDEO_ERROR_REPORTING, \c V4L2_CID_MPEG_VIDEODEC_METADATA
  438. * and \c v4l2_ctrl_video_metadata for more information.
  439. *
  440. * @note Currently, V4L2 plugins do not support odd resolution.
  441. * @{
  442. * @ingroup ee_extensions_group
  443. */
  444. /**
  445. * Defines the Control ID to indicate to the decoder that the input
  446. * buffers do not contain complete buffers.
  447. *
  448. * @note This control must be set in case of frames containing multiple slices
  449. * when the input buffers do not contain all the slices of the frame.
  450. *
  451. * A boolean value must be supplied with this control.
  452. *
  453. */
  454. #define V4L2_CID_MPEG_VIDEO_DISABLE_COMPLETE_FRAME_INPUT (V4L2_CID_MPEG_BASE+515)
  455. /**
  456. * Defines the Control ID to disable decoder DPB management.
  457. *
  458. * @note This only works for streams having a single reference frame.
  459. *
  460. * A boolean value must be supplied with this control.
  461. *
  462. * @attention This control must be set after setting formats on both the planes
  463. * and before requesting buffers on either plane.
  464. */
  465. #define V4L2_CID_MPEG_VIDEO_DISABLE_DPB (V4L2_CID_MPEG_BASE+516)
  466. /**
  467. * Defines the Control ID to enable decoder error and metadata reporting.
  468. *
  469. * A boolean value must be supplied with this control.
  470. *
  471. * @attention This control must be set after setting formats on both the planes
  472. * and before requesting buffers on either plane.
  473. */
  474. #define V4L2_CID_MPEG_VIDEO_ERROR_REPORTING (V4L2_CID_MPEG_BASE+517)
  475. /**
  476. * Defines the Control ID to set the skip frames property of the decoder.
  477. *
  478. * Decoder must be configured to skip certain types of frames. One
  479. * \c v4l2_skip_frames_type must be passed.
  480. *
  481. * @attention This control must be set after setting formats on both the planes
  482. * and before requesting buffers on either plane.
  483. * This control ID is supported only for H264.
  484. */
  485. #define V4L2_CID_MPEG_VIDEO_SKIP_FRAMES (V4L2_CID_MPEG_BASE+518)
  486. /**
  487. * Defines the Control ID to get the decoder output metadata.
  488. *
  489. * @note Metadata reporting must be enabled using
  490. * #V4L2_CID_MPEG_VIDEO_ERROR_REPORTING IOCTL for this.
  491. *
  492. * A pointer to a valid \c v4l2_ctrl_video_metadata structure must be supplied
  493. * with this control.
  494. *
  495. * @attention This control must be read after dequeueing a buffer successfully from
  496. * the capture plane. The values in the structure are valid until the buffer is queued
  497. * again.
  498. */
  499. #define V4L2_CID_MPEG_VIDEODEC_METADATA (V4L2_CID_MPEG_BASE+519)
  500. /**
  501. * Defines the Control ID to get the decoder input header error metadata.
  502. *
  503. * @note Metadata reporting must be enabled using
  504. * #V4L2_CID_MPEG_VIDEO_ERROR_REPORTING IOCTL for this.
  505. *
  506. * A pointer to a valid \c v4l2_ctrl_video_metadata structure must be supplied
  507. * with this control.
  508. *
  509. * @attention This control must be read after dequeueing a buffer successfully from
  510. * the output plane. The values in the structure are valid until the buffer is queued
  511. * again.
  512. */
  513. #define V4L2_CID_MPEG_VIDEODEC_INPUT_METADATA (V4L2_CID_MPEG_BASE+520)
  514. /**
  515. * Defines the Control ID to check if display data is present.
  516. *
  517. * This control returns true if HDR metadata is present in the stream.
  518. *
  519. */
  520. #define V4L2_CID_VIDEODEC_DISPLAYDATA_PRESENT (V4L2_CID_MPEG_BASE+521)
  521. /**
  522. * Defines the Control ID to get display data if V4L2_CID_VIDEODEC_DISPLAYDATA_PRESENT returns true.
  523. *
  524. * This control returns display data such as display_primaries, white_point and
  525. * display_parameter_luminance required for display module.
  526. *
  527. */
  528. #define V4L2_CID_VIDEODEC_HDR_MASTERING_DISPLAY_DATA (V4L2_CID_MPEG_BASE+522)
  529. /**
  530. * Defines the Control ID to get Sample Aspect Ratio width for decoding.
  531. *
  532. * This control returns unsigned integer of Sample Aspect Ratio width.
  533. *
  534. * @attention This control must be set after receiving V4L2_EVENT_RESOLUTION_CHANGE.
  535. *
  536. */
  537. #define V4L2_CID_MPEG_VIDEODEC_SAR_WIDTH (V4L2_CID_MPEG_BASE+569)
  538. /**
  539. * Defines the Control ID to get Sample Aspect Ratio height for decoding.
  540. *
  541. * This control returns unsigned integer of Sample Aspect Ratio height.
  542. *
  543. * @attention This control must be set after receiving V4L2_EVENT_RESOLUTION_CHANGE.
  544. *
  545. */
  546. #define V4L2_CID_MPEG_VIDEODEC_SAR_HEIGHT (V4L2_CID_MPEG_BASE+570)
  547. /**
  548. * Defines the Control ID to embed the SEI data coming from upstream plugins.
  549. *
  550. * This control sets the SEI payload size and SEI data pointer for encoder.
  551. *
  552. * @attention This control must be set after receiving V4L2_EVENT_RESOLUTION_CHANGE.
  553. *
  554. */
  555. #define V4L2_CID_MPEG_VIDEOENC_DS_SEI_DATA (V4L2_CID_MPEG_BASE+571)
  556. /** @} */
  557. /**
  558. * @defgroup V4L2Conv V4L2 Video Converter
  559. *
  560. * @brief NVIDIA V4L2 Video Converter Description and Extensions
  561. *
  562. * Use the video converter for color space conversion, scaling, and
  563. * conversion between hardware buffer memory (\c V4L2_MEMORY_MMAP/\c
  564. * V4L2_MEMORY_DMABUF), software buffer memory (\c V4L2_MEMORY_USERPTR), and
  565. * other operations such as cropping, flipping/rotating, and
  566. * temporal noise reduction (TNR).
  567. * The video converter device node is \c "/dev/nvhost-vic".
  568. *
  569. * ### Supported Pixelformats
  570. * PIXEL FORMAT | PIXEL FORMAT
  571. * :---------------------: | :--------------:
  572. * V4L2_PIX_FMT_YUV444M | V4L2_PIX_FMT_YVU422M
  573. * V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_YVU420M
  574. * V4L2_PIX_FMT_NV12M | V4L2_PIX_FMT_GREY
  575. * V4L2_PIX_FMT_YUYV | V4L2_PIX_FMT_YVYU
  576. * V4L2_PIX_FMT_UYVY | V4L2_PIX_FMT_VYUY
  577. * V4L2_PIX_FMT_ABGR32 | V4L2_PIX_FMT_XBGR32
  578. *
  579. * ### Supported Pixel Formats for TNR
  580. * PIXEL FORMAT | PIXEL FORMAT
  581. * :---------------------: | :--------------:
  582. * V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_NV12M
  583. * V4L2_PIX_FMT_UYVY | V4L2_PIX_FMT_YUYV
  584. *
  585. * ### Supported Memory Types
  586. * MEMORY | OUTPUT PLANE | CAPTURE PLANE
  587. * :------------------: | :----------: | :-----------:
  588. * V4L2_MEMORY_MMAP | Y | Y
  589. * V4L2_MEMORY_DMABUF | Y | Y
  590. * V4L2_MEMORY_USERPTR | Y | Y
  591. *
  592. * ### Supported Controls
  593. * - #V4L2_CID_VIDEO_CONVERT_OUTPUT_PLANE_LAYOUT
  594. * - #V4L2_CID_VIDEO_CONVERT_CAPTURE_PLANE_LAYOUT
  595. * - #V4L2_CID_VIDEO_CONVERT_FLIP_METHOD
  596. * - #V4L2_CID_VIDEO_CONVERT_INTERPOLATION_METHOD
  597. * - #V4L2_CID_VIDEO_CONVERT_TNR_ALGORITHM
  598. * - #V4L2_CID_VIDEO_CONVERT_YUV_RESCALE_METHOD
  599. *
  600. * ### Cropping
  601. * Video converter supports cropping using \c VIDIOC_S_SELECTION IOCTL with type
  602. * \c V4L2_BUF_TYPE_VIDEO_CAPTURE and target \c V4L2_SEL_TGT_CROP. This must
  603. * be set before requesting buffers on either plane.
  604. *
  605. * ### EOS Handling
  606. * The following sequence must be followed for sending EOS and recieving EOS
  607. * from the converter.
  608. * -# Send EOS to converter by queueing on the output plane a buffer with
  609. * bytesused = 0 for the 0th plane (`v4l2_buffer.m.planes[0].bytesused = 0`).
  610. * -# Dequeues buffers on the capture plane until it gets a buffer with bytesused = 0
  611. * for the 0th plane.
  612. *
  613. * @note Currently, V4L2 plugins do not support odd resolution.
  614. * @{
  615. * @ingroup ee_extensions_group
  616. */
  617. /**
  618. * Defines the Control ID to set converter output plane buffer layout.
  619. *
  620. * A value of type \c v4l2_nv_buffer_layout must be supplied with this control.
  621. *
  622. * @attention This control must be set before requesting buffers on the output plane.
  623. */
  624. #define V4L2_CID_VIDEO_CONVERT_OUTPUT_PLANE_LAYOUT (V4L2_CID_MPEG_BASE+523)
  625. /**
  626. * Defines the Control ID to set converter capture plane buffer layout.
  627. *
  628. * A value of type \c v4l2_nv_buffer_layout must be supplied with this control.
  629. *
  630. * @attention This control must be set before requesting buffers on the capture plane.
  631. */
  632. #define V4L2_CID_VIDEO_CONVERT_CAPTURE_PLANE_LAYOUT (V4L2_CID_MPEG_BASE+524)
  633. /**
  634. * Defines the Control ID to set the converter flip/rotation method.
  635. *
  636. * A value of type \c v4l2_flip_method must be supplied with this control.
  637. *
  638. * @attention This control must be set before requesting buffers on either plane.
  639. */
  640. #define V4L2_CID_VIDEO_CONVERT_FLIP_METHOD (V4L2_CID_MPEG_BASE+525)
  641. /**
  642. * Defines the Control ID to set the converter interpolation method.
  643. *
  644. * A value of type \c v4l2_interpolation_method must be supplied with this control.
  645. *
  646. * @attention This control must be set before requesting buffers on either plane.
  647. */
  648. #define V4L2_CID_VIDEO_CONVERT_INTERPOLATION_METHOD (V4L2_CID_MPEG_BASE+526)
  649. /**
  650. * Defines the Control ID to set the converter Temporal Noise Reduction (TNR) algorithm.
  651. *
  652. * A value of type \c v4l2_tnr_algorithm must be supplied with this control.
  653. *
  654. * @attention This control must be set before requesting buffers on either plane.
  655. * @attention TNR algorithms are not supported with YUV422 and YUV444 capture
  656. * plane formats.
  657. */
  658. #define V4L2_CID_VIDEO_CONVERT_TNR_ALGORITHM (V4L2_CID_MPEG_BASE+527)
  659. /** @} */
  660. /**
  661. * @defgroup V4L2Enc V4L2 Video Encoder
  662. *
  663. * @brief NVIDIA V4L2 Video Encoder Description and Extensions
  664. *
  665. * The video encoder device node is \c "/dev/nvhost-msenc".
  666. *
  667. * ### Supported Pixelformats
  668. * OUTPUT PLANE | CAPTURE PLANE | PLATFORM
  669. * :---------------------: | :-----------------: | :--------------------:
  670. * V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_H264 | T210, T186, T194, T234
  671. * V4L2_PIX_FMT_NV12M | |
  672. * V4L2_PIX_FMT_YUV444M | |
  673. * V4L2_PIX_FMT_NV24M | |
  674. * | |
  675. * V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_H265 | T210, T186, T194, T234
  676. * V4L2_PIX_FMT_NV12M | |
  677. * V4L2_PIX_FMT_YUV444M | |
  678. * V4L2_PIX_FMT_NV24M | |
  679. * V4L2_PIX_FMT_P010M | |
  680. * V4L2_PIX_FMT_NV24_10LE | |
  681. * | |
  682. * V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_VP8 | T210, T186
  683. * V4L2_PIX_FMT_NV12M | |
  684. * | |
  685. * V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_VP9 | T186, T194
  686. * V4L2_PIX_FMT_NV12M | |
  687. * | |
  688. * V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_AV1 | T234
  689. * V4L2_PIX_FMT_NV12M | |
  690. *
  691. * ### Supported Memory Types
  692. * MEMORY | OUTPUT PLANE | CAPTURE PLANE
  693. * :------------------: | :----------: | :-----------:
  694. * V4L2_MEMORY_MMAP | Y | Y
  695. * V4L2_MEMORY_DMABUF | Y | N
  696. * V4L2_MEMORY_USERPTR | N | N
  697. * \attention For the video encoder, it is necessary that the capture plane
  698. * format be set before the output plane format and only then request buffers on
  699. * any of the planes.
  700. *
  701. * ### Supported Controls
  702. * The following sections describe the supported controls.
  703. *
  704. * #### Controls From the Open Source V4L2-Controls Header
  705. * Control ID | Purpose | Runtime Configurable
  706. * -------------------------------- | -------------------- | :------------------:
  707. * V4L2_CID_MPEG_VIDEO_BITRATE | Bitrate | Y
  708. * V4L2_CID_MPEG_VIDEO_H264_PROFILE | H.264 Encode Profile | N
  709. * V4L2_CID_MPEG_VIDEO_BITRATE_MODE | Rate Control Mode | N
  710. * V4L2_CID_MPEG_VIDEO_GOP_SIZE | I-frame Interval | N
  711. * V4L2_CID_MPEG_VIDEO_H264_LEVEL | Encode Level | N
  712. * V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE | Force I-frame on one of queued output plane buffer | Y
  713. *
  714. * All non-runtime configurable options must be set after setting formats on
  715. * both the planes and before requesting buffers on either plane.
  716. *
  717. * The runtime configurable parameters can be called anytime after setting
  718. * formats on both the planes.
  719. *
  720. * #### NVIDIA-Specific Controls
  721. * - #V4L2_CID_MPEG_VIDEO_H265_PROFILE
  722. * - #V4L2_CID_MPEG_VIDEO_IDR_INTERVAL
  723. * - #V4L2_CID_MPEG_VIDEOENC_TEMPORAL_TRADEOFF_LEVEL
  724. * - #V4L2_CID_MPEG_VIDEOENC_SLICE_LENGTH_PARAM
  725. * - #V4L2_CID_MPEG_VIDEOENC_ROI_PARAMS
  726. * - #V4L2_CID_MPEG_VIDEOENC_VIRTUALBUFFER_SIZE
  727. * - #V4L2_CID_MPEG_VIDEOENC_NUM_REFERENCE_FRAMES
  728. * - #V4L2_CID_MPEG_VIDEOENC_SLICE_INTRAREFRESH_PARAM
  729. * - #V4L2_CID_MPEG_VIDEOENC_NUM_BFRAMES
  730. * - #V4L2_CID_MPEG_VIDEOENC_INSERT_SPS_PPS_AT_IDR
  731. * - #V4L2_CID_MPEG_VIDEOENC_METADATA
  732. * - #V4L2_CID_MPEG_VIDEOENC_METADATA_MV
  733. * - #V4L2_CID_MPEG_VIDEOENC_ENABLE_METADATA_MV
  734. * - #V4L2_CID_MPEG_VIDEOENC_QP_RANGE
  735. * - #V4L2_CID_MPEG_VIDEOENC_HW_PRESET_TYPE_PARAM
  736. * - #V4L2_CID_MPEG_VIDEOENC_INPUT_METADATA
  737. * - #V4L2_CID_MPEG_VIDEOENC_ENABLE_EXTERNAL_RPS_CONTROL
  738. * - #V4L2_CID_MPEG_VIDEOENC_ENABLE_EXTERNAL_RATE_CONTROL
  739. * - #V4L2_CID_MPEG_VIDEOENC_ENABLE_ROI_PARAM
  740. * - #V4L2_CID_MPEG_VIDEOENC_ENABLE_RECONCRC_PARAM
  741. * - #V4L2_CID_MPEG_VIDEOENC_INSERT_VUI
  742. * - #V4L2_CID_MPEG_VIDEOENC_INSERT_AUD
  743. * - #V4L2_CID_MPEG_VIDEOENC_EXTEDED_COLORFORMAT
  744. * - #V4L2_CID_MPEG_VIDEOENC_ENABLE_ALLIFRAME_ENCODE
  745. * - #V4L2_CID_MPEG_VIDEOENC_H265_LEVEL
  746. * - #V4L2_CID_MPEG_VIDEOENC_ENABLE_SLICE_LEVEL_ENCODE
  747. * - #V4L2_CID_MPEG_VIDEOENC_POC_TYPE
  748. * - #V4L2_CID_MPEG_VIDEOENC_H265_VUI_EXT_SAR_WIDTH
  749. * - #V4L2_CID_MPEG_VIDEOENC_H265_VUI_EXT_SAR_HEIGHT
  750. * - #V4L2_CID_MPEG_VIDEOENC_FORCE_INTRA_FRAME
  751. * - #V4L2_CID_MPEG_VIDEOENC_FORCE_IDR_FRAME
  752. * - #V4L2_CID_MPEG_VIDEOENC_AV1_HEADERS_WITH_FRAME
  753. * - #V4L2_CID_MPEG_VIDEOENC_AV1_TILE_CONFIGURATION
  754. * - #V4L2_CID_MPEG_VIDEOENC_AV1_ENABLE_SSIMRDO
  755. * - #V4L2_CID_MPEG_VIDEOENC_AV1_DISABLE_CDF_UPDATE
  756. * - #V4L2_CID_MPEG_VIDEOENC_PPE_INIT_PARAMS
  757. *
  758. * #### Setting Framerate
  759. * The encoder framerate can be set with \c VIDIOC_S_PARM IOCTL by setting the numerator
  760. * and denominator in `v4l2_streamparm.parm.output.timeperframe`.
  761. *
  762. * ### Supported Encoder Profiles
  763. * #### H.264
  764. * - V4L2_MPEG_VIDEO_H264_PROFILE_MAIN
  765. * - V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE
  766. * - V4L2_MPEG_VIDEO_H264_PROFILE_HIGH
  767. *
  768. * #### H.265
  769. * - V4L2_MPEG_VIDEO_H265_PROFILE_MAIN
  770. * - V4L2_MPEG_VIDEO_H265_PROFILE_MAIN10
  771. *
  772. * ### Encoder Output Metadata
  773. * The encoder supports reporting frame related metadata, including motion vectors
  774. * for that frame. See \c V4L2_CID_MPEG_VIDEOENC_METADATA,
  775. * \c V4L2_CID_MPEG_VIDEOENC_METADATA_MV and \c V4L2_CID_MPEG_VIDEOENC_ENABLE_METADATA_MV
  776. * for more information.
  777. *
  778. * ### EOS Handling
  779. * The following sequence must be followed for sending EOS and recieving EOS
  780. * from the encoder.
  781. * -# Send EOS to encoder by queueing on the output plane a buffer with
  782. * bytesused = 0 for the 0th plane (`v4l2_buffer.m.planes[0].bytesused = 0`).
  783. * -# Dequeues buffers on the capture plane until it gets a buffer with bytesused = 0
  784. * for the 0th plane.
  785. *
  786. * @note Currently, V4L2 plugins do not support odd resolution.
  787. * @{
  788. * @ingroup ee_extensions_group
  789. */
  790. /**
  791. * Defines the Control ID to configure encoder to drop frames while encoding.
  792. *
  793. * A value of type \c v4l2_enc_temporal_tradeoff_level_type must be supplied
  794. * with this control.
  795. *
  796. * @attention This control must be set after setting formats on both the planes
  797. * and before requesting buffers on either plane.
  798. */
  799. #define V4L2_CID_MPEG_VIDEOENC_TEMPORAL_TRADEOFF_LEVEL (V4L2_CID_MPEG_BASE+528)
  800. /**
  801. * Defines the Control ID to configure encoder slice length either in terms of MBs or bits.
  802. *
  803. * A pointer to a valid \c v4l2_enc_slice_length_param structure must be supplied
  804. * with this control.
  805. *
  806. * @attention This control must be set after setting formats on both the planes
  807. * and before requesting buffers on either plane.
  808. */
  809. #define V4L2_CID_MPEG_VIDEOENC_SLICE_LENGTH_PARAM (V4L2_CID_MPEG_BASE+529)
  810. /**
  811. * Defines the Control ID to configure encoder to encode particular region of frame in high
  812. * quality.
  813. *
  814. * A pointer to a valid \c v4l2_enc_frame_ROI_params structure must be supplied
  815. * with this control.
  816. *
  817. * @attention This control must be set after requesting buffers on both the
  818. * planes.
  819. */
  820. #define V4L2_CID_MPEG_VIDEOENC_ROI_PARAMS (V4L2_CID_MPEG_BASE+530)
  821. /**
  822. * Defines the Control ID to specify virtual buffer size in bits for encoder.
  823. *
  824. * A pointer to a valid \c v4l2_enc_virtual_buffer_size structure must be
  825. * supplied with this control.
  826. *
  827. * @attention This control must be set after setting formats on both the planes
  828. * and before requesting buffers on either plane.
  829. */
  830. #define V4L2_CID_MPEG_VIDEOENC_VIRTUALBUFFER_SIZE (V4L2_CID_MPEG_BASE+531)
  831. /**
  832. * Defines the Control ID to specify maximum number of reference frames that can be used.
  833. *
  834. * An integer value must be supplied with this control.
  835. *
  836. * @attention This control must be set after setting formats on both the planes
  837. * and before requesting buffers on either plane.
  838. */
  839. #define V4L2_CID_MPEG_VIDEOENC_NUM_REFERENCE_FRAMES (V4L2_CID_MPEG_BASE+532)
  840. /**
  841. * Defines the Control ID to specify the encoder slice intra refresh interval.
  842. *
  843. * A pointer to a valid \c v4l2_enc_slice_intrarefresh_param structure must be
  844. * supplied with this control.
  845. *
  846. * @attention This control must be set after setting formats on both the planes
  847. * and before requesting buffers on either plane.
  848. */
  849. #define V4L2_CID_MPEG_VIDEOENC_SLICE_INTRAREFRESH_PARAM (V4L2_CID_MPEG_BASE+533)
  850. /**
  851. * Defines the Control ID to set number of B frames to be encoded between two P frames.
  852. *
  853. * This works with H.264 encoder. This also works with H.265 encoder for Jetson Xavier and
  854. * Jetson Xavier NX platforms. An integer value must be supplied with this control.
  855. *
  856. * @attention This control must be set after setting formats on both the planes
  857. * and before requesting buffers on either plane.
  858. */
  859. #define V4L2_CID_MPEG_VIDEOENC_NUM_BFRAMES (V4L2_CID_MPEG_BASE+534)
  860. /**
  861. * Defines the Control ID to enable/disable inserting SPS and PPS explicitly at IDR interval.
  862. *
  863. * A boolean value must be supplied with this control.
  864. *
  865. * @attention This control must be set after setting formats on both the planes
  866. * and before requesting buffers on either plane.
  867. */
  868. #define V4L2_CID_MPEG_VIDEOENC_INSERT_SPS_PPS_AT_IDR (V4L2_CID_MPEG_BASE+535)
  869. /**
  870. * Defines the Control ID to get encoder output metadata.
  871. *
  872. * A pointer to valid #v4l2_ctrl_video_metadata structure must be supplied with
  873. * this control.
  874. *
  875. * @attention This control must be read after dequeueing a buffer successfully from
  876. * the capture plane. The values in the structure are valid until the buffer is queued
  877. * again.
  878. */
  879. #define V4L2_CID_MPEG_VIDEOENC_METADATA (V4L2_CID_MPEG_BASE+536)
  880. /**
  881. * Defines the Control ID to enable/disable encoder motion vector reporting.
  882. *
  883. * A boolean value must be supplied with this control.
  884. *
  885. * @attention This control must be set after setting formats on both the planes
  886. * and before requesting buffers on either plane.
  887. */
  888. #define V4L2_CID_MPEG_VIDEOENC_ENABLE_METADATA_MV (V4L2_CID_MPEG_BASE+537)
  889. /**
  890. * Defines the Control ID to get encoder output motion vector metadata.
  891. *
  892. * A pointer to valid \c v4l2_ctrl_videoenc_outputbuf_metadata_MV structure must
  893. * be supplied with this control.
  894. *
  895. * @attention This control must be read after dequeueing a buffer successfully from
  896. * the capture plane. The values in the structure are valid until the buffer is queued
  897. * again.
  898. */
  899. #define V4L2_CID_MPEG_VIDEOENC_METADATA_MV (V4L2_CID_MPEG_BASE+538)
  900. /**
  901. * Defines the Control ID to set QP range for I/P/B frames.
  902. *
  903. * A pointer to a valid \c v4l2_ctrl_video_qp_range structure must
  904. * be supplied with this control.
  905. *
  906. * @attention This control must be set after setting formats on both the planes
  907. * and before requesting buffers on either plane.
  908. */
  909. #define V4L2_CID_MPEG_VIDEOENC_QP_RANGE (V4L2_CID_MPEG_BASE+539)
  910. /**
  911. * Defines the Control ID to set encoder HW Preset type.
  912. *
  913. * A pointer to valid #v4l2_enc_hw_preset_type_param structure must
  914. * be supplied with this control.
  915. *
  916. * @attention This control must be set after setting formats on both the planes
  917. * and before requesting buffers on either plane.
  918. */
  919. #define V4L2_CID_MPEG_VIDEOENC_HW_PRESET_TYPE_PARAM (V4L2_CID_MPEG_BASE+540)
  920. /**
  921. * Defines the Control ID to provide input metadata for encoder buffer.
  922. *
  923. * A pointer to valid #v4l2_ctrl_videoenc_input_metadata structure must be
  924. * supplied with this control.
  925. *
  926. * @attention This control must be called before queueing a buffer on the output
  927. * plane. Use the bitwise OR of v4l2_enc_input_metadata_param in the
  928. * v4l2_ctrl_videoenc_input_metadata.metadata_flag to provide different input
  929. * metadata parameters in one s_ctrl call.
  930. */
  931. #define V4L2_CID_MPEG_VIDEOENC_INPUT_METADATA (V4L2_CID_MPEG_BASE+541)
  932. /**
  933. * Defines the Control ID to configure encoder for external RPS control.
  934. *
  935. * A pointer to a valid #v4l2_enc_enable_ext_rps_ctr structure must be supplied
  936. * with this control.
  937. *
  938. * @attention This control must be set after requesting buffers on both the
  939. * planes. The value for V4L2_CID_MPEG_VIDEOENC_NUM_REFERENCE_FRAMES, if being entered,
  940. * must be set after this control.
  941. */
  942. #define V4L2_CID_MPEG_VIDEOENC_ENABLE_EXTERNAL_RPS_CONTROL (V4L2_CID_MPEG_BASE+542)
  943. /**
  944. * Defines the Control ID to configure encoder for external rate control.
  945. *
  946. * A pointer to a valid #v4l2_enc_enable_ext_rate_ctr structure must be supplied
  947. * with this control.
  948. *
  949. * @attention This control must be set after requesting buffers on both the
  950. * planes.
  951. */
  952. #define V4L2_CID_MPEG_VIDEOENC_ENABLE_EXTERNAL_RATE_CONTROL (V4L2_CID_MPEG_BASE+543)
  953. /**
  954. * Defines the Control ID to configure ROI encoding for a session.
  955. *
  956. * A pointer to a valid #v4l2_enc_enable_roi_param structure must be supplied
  957. * with this control.
  958. *
  959. * @attention This control must be set after requesting buffers on both the
  960. * planes.
  961. */
  962. #define V4L2_CID_MPEG_VIDEOENC_ENABLE_ROI_PARAM (V4L2_CID_MPEG_BASE+544)
  963. /**
  964. * Defines the Control ID to configure Reconstructed CRC for a session.
  965. *
  966. * A pointer to a valid #v4l2_enc_enable_reconcrc_param structure must be supplied
  967. * with this control.
  968. *
  969. * @attention This control must be set after requesting buffers on both the
  970. * planes.
  971. */
  972. #define V4L2_CID_MPEG_VIDEOENC_ENABLE_RECONCRC_PARAM (V4L2_CID_MPEG_BASE+545)
  973. /**
  974. * Control ID to enable/disable inserting VUI in SPS.
  975. *
  976. * A boolean value should be supplied with this control.
  977. *
  978. * @attention This control should be set after setting formats on both the planes
  979. * and before requesting buffers on either plane.
  980. */
  981. #define V4L2_CID_MPEG_VIDEOENC_INSERT_VUI (V4L2_CID_MPEG_BASE+546)
  982. /**
  983. * Control ID to enable/disable inserting AUD(Access Unit Delimiter).
  984. *
  985. * A boolean value should be supplied with this control.
  986. *
  987. * @attention This control should be set after setting formats on both the planes
  988. * and before requesting buffers on either plane.
  989. */
  990. #define V4L2_CID_MPEG_VIDEOENC_INSERT_AUD (V4L2_CID_MPEG_BASE+547)
  991. /**
  992. * Control ID to enable/disable setting extended color format.
  993. *
  994. * A boolean value should be supplied with this control.
  995. *
  996. * @attention This control should be set after setting formats on both the planes
  997. * and before requesting buffers on either plane. Also this control should be
  998. * enabled/disabled only after V4L2_CID_MPEG_VIDEOENC_INSERT_VUI is set
  999. */
  1000. #define V4L2_CID_MPEG_VIDEOENC_EXTEDED_COLORFORMAT (V4L2_CID_MPEG_BASE+548)
  1001. /**
  1002. * Control ID to select which NVDEC IP to decode.
  1003. *
  1004. * @note This functionality is currently being deprecated and no longer
  1005. * functional.
  1006. *
  1007. * A v4l2_decode_instance_type should be supplied with this control.
  1008. *
  1009. * @attention This control should be set after setting formats on both the planes
  1010. * and before requesting buffers on either plane.
  1011. */
  1012. #define V4L2_CID_MPEG_VIDEO_DECODE_INSTANCE (V4L2_CID_MPEG_BASE+549)
  1013. /**
  1014. * Control ID to issue a pseudo POLL call on the fd opened in non blocking mode.
  1015. *
  1016. * A pointer to a valid #v4l2_ctrl_video_device_poll must be supplied with this control.
  1017. *
  1018. * @attention This should only be called when the Decoder or Encoder is opened with
  1019. * O_NONBLOCK flag.
  1020. */
  1021. #define V4L2_CID_MPEG_VIDEO_DEVICE_POLL (V4L2_CID_MPEG_BASE+550)
  1022. /**
  1023. * Control ID to set/clear the polling interrupt mode. Useful when a POLL issued from the
  1024. * application but wants the wait to be interrupted.
  1025. *
  1026. * A boolean value must be supplied with this control, True indicates polling interrupt shall be
  1027. * enabled and it shall stay enabled (i.e calls to POLL will return immediately) until a call to
  1028. * same control ID is made by passing a boolean 0 value.
  1029. *
  1030. * @attention This should only be called when the Decoder or Encoder is opened with
  1031. * O_NONBLOCK flag.
  1032. */
  1033. #define V4L2_CID_MPEG_SET_POLL_INTERRUPT (V4L2_CID_MPEG_BASE+551)
  1034. /**
  1035. * Control ID to enable/disable setting rate control two pass CBR.
  1036. *
  1037. * A boolean value should be supplied with this control.
  1038. *
  1039. * @attention This control should be set after setting formats on both the planes
  1040. * and before requesting buffers on either plane.
  1041. */
  1042. #define V4L2_CID_MPEG_VIDEOENC_TWO_PASS_CBR (V4L2_CID_MPEG_BASE+552)
  1043. /**
  1044. * Defines the Control ID to set the converter YUV Rescale method.
  1045. *
  1046. * A value of type \c v4l2_yuv_rescale_method must be supplied with this control.
  1047. *
  1048. * @attention This control must be set before requesting buffers on either plane.
  1049. */
  1050. #define V4L2_CID_VIDEO_CONVERT_YUV_RESCALE_METHOD (V4L2_CID_MPEG_BASE+553)
  1051. /**
  1052. * Control ID to enable maximum Performance.
  1053. *
  1054. * An integer value must be supplied with this control.
  1055. *
  1056. * @attention This control should be set after setting formats on both the planes
  1057. * and before requesting buffers on either plane.
  1058. */
  1059. #define V4L2_CID_MPEG_VIDEO_MAX_PERFORMANCE (V4L2_CID_MPEG_BASE+554)
  1060. /**
  1061. * Control ID to enable/disable setting for all i-Frame encoding.
  1062. *
  1063. * A boolean value should be supplied with this control.
  1064. *
  1065. * @attention This control should be set after setting formats on both the planes
  1066. * and before requesting buffers on either plane.
  1067. */
  1068. #define V4L2_CID_MPEG_VIDEOENC_ENABLE_ALLIFRAME_ENCODE (V4L2_CID_MPEG_BASE+555)
  1069. /**
  1070. * Defines the Control ID to set buf api to be used by decoder/encoder.
  1071. *
  1072. * Note: This Control ID is no longer supported.
  1073. */
  1074. #define V4L2_CID_MPEG_VIDEO_BUF_API_TYPE (V4L2_CID_MPEG_BASE+556)
  1075. /**
  1076. * Defines the Control ID to set cuda memory type to be used by decoder/encoder.
  1077. *
  1078. * This control can be used by the decoder to set the memory type for surfaces.
  1079. * A value of \c v4l2_cuda_mem_type needs to be set with this control.
  1080. *
  1081. * @attention This control must be set after setting formats on both the planes
  1082. * and before requesting buffers on either plane.
  1083. */
  1084. #define V4L2_CID_MPEG_VIDEO_CUDA_MEM_TYPE (V4L2_CID_MPEG_BASE+557)
  1085. /**
  1086. * Defines the Control ID to set GPU ID to be used by decoder/encoder.
  1087. *
  1088. * An integer value should be supplied with this control.
  1089. *
  1090. * @attention This control must be set after setting formats on both the planes
  1091. * and before requesting buffers on either plane.
  1092. */
  1093. #define V4L2_CID_MPEG_VIDEO_CUDA_GPU_ID (V4L2_CID_MPEG_BASE+558)
  1094. /**
  1095. * Defines the Control ID to set drop frames interval for decoder.
  1096. *
  1097. * An integer value should be supplied with this control. A value of "x"
  1098. * indicates every "x"th frame should be given out from the decoder, rest shall
  1099. * dropped after decoding.
  1100. *
  1101. * @attention This control must be set after setting formats on both the planes
  1102. * and before requesting buffers on either plane.
  1103. */
  1104. #define V4L2_CID_MPEG_VIDEODEC_DROP_FRAME_INTERVAL (V4L2_CID_MPEG_BASE+559)
  1105. /**
  1106. * Control ID to enable/disable setting for attaching VP8/9 headers.
  1107. * Only to be used for VP8/9 pixel format not for H264/5.
  1108. *
  1109. * A boolean value should be supplied with this control.
  1110. * If value is false headers will be disabled and true will enable the headers.
  1111. *
  1112. * @attention This control should be set after setting formats on both the planes
  1113. * and before requesting buffers on either plane.
  1114. */
  1115. #define V4L2_CID_MPEG_VIDEOENC_VPX_HEADERS_WITH_FRAME (V4L2_CID_MPEG_BASE+560)
  1116. /**
  1117. * Defines the control ID to set the H.265 encoder level.
  1118. *
  1119. * A v4l2_mpeg_video_h265_level must be passed.
  1120. */
  1121. #define V4L2_CID_MPEG_VIDEOENC_H265_LEVEL (V4L2_CID_MPEG_BASE+561)
  1122. /**
  1123. * Control ID to enable/disable slice level encode output.
  1124. *
  1125. * A boolean value should be supplied with this control.
  1126. *
  1127. * @attention This control should be set after setting formats on both the planes
  1128. * and before requesting buffers on either plane.
  1129. */
  1130. #define V4L2_CID_MPEG_VIDEOENC_ENABLE_SLICE_LEVEL_ENCODE (V4L2_CID_MPEG_BASE+562)
  1131. /**
  1132. * Defines the Control ID to set Picture Order Count property in frames.
  1133. *
  1134. * This works only with H.264 encoder. An integer value must be supplied with this
  1135. * control.
  1136. *
  1137. * @attention This control should be set after setting formats on both the planes
  1138. * and before requesting buffers on either plane.
  1139. */
  1140. #define V4L2_CID_MPEG_VIDEOENC_POC_TYPE (V4L2_CID_MPEG_BASE+563)
  1141. /**
  1142. * Defines the Control ID to set Sample Aspect Ratio width for H265 VUI encoding.
  1143. *
  1144. * An integer value must be supplied with this control.
  1145. * The VUI Sample Aspect Ratio indicator for H265 follows the standard enum defined for
  1146. * v4l2_mpeg_video_h264_vui_sar_idc.
  1147. *
  1148. * @attention This control should be set after setting formats on both the planes
  1149. * and before requesting buffers on either plane.
  1150. */
  1151. #define V4L2_CID_MPEG_VIDEOENC_H265_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+564)
  1152. /**
  1153. * Defines the Control ID to set Sample Aspect Ratio height for H265 VUI encoding.
  1154. *
  1155. * An integer value must be supplied with this control.
  1156. * The VUI Sample Aspect Ratio indicator for H265 follows the standard enum defined
  1157. * for v4l2_mpeg_video_h264_vui_sar_idc.
  1158. *
  1159. * @attention This control should be set after setting formats on both the planes
  1160. * and before requesting buffers on either plane.
  1161. */
  1162. #define V4L2_CID_MPEG_VIDEOENC_H265_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+565)
  1163. /**
  1164. * Defines the Control ID to force INTRA frame.
  1165. *
  1166. * This control can be used by encoder to force encoding an intra frame.
  1167. *
  1168. * @attention This control should be set after setting formats on both the planes
  1169. * and before requesting buffers on either plane.
  1170. */
  1171. #define V4L2_CID_MPEG_VIDEOENC_FORCE_INTRA_FRAME (V4L2_CID_MPEG_BASE+566)
  1172. /**
  1173. * Defines the Control ID to force IDR frame.
  1174. *
  1175. * This control can be used by encoder to force encoding an idr frame.
  1176. *
  1177. * @attention This control should be set after setting formats on both the planes
  1178. * and before requesting buffers on either plane.
  1179. */
  1180. #define V4L2_CID_MPEG_VIDEOENC_FORCE_IDR_FRAME (V4L2_CID_MPEG_BASE+567)
  1181. /**
  1182. * Defines the Control ID to set low latency to be used by decoder.
  1183. *
  1184. * This control can be used by decoder to set low latency for streams having
  1185. * I and IPPP frames.
  1186. *
  1187. * @attention This control must be set before requesting buffers on either plane.
  1188. */
  1189. #define V4L2_CID_MPEG_VIDEO_CUDA_LOW_LATENCY (V4L2_CID_MPEG_BASE+568)
  1190. /**
  1191. * Control ID to enable/disable setting for attaching IVF headers.
  1192. * Only to be used for AV1 codec.
  1193. *
  1194. * A boolean value should be supplied with this control.
  1195. * If value is false headers will be disabled and true will enable the headers.
  1196. *
  1197. * @attention This control should be set after setting formats on both the planes
  1198. * and before requesting buffers on either plane.
  1199. */
  1200. #define V4L2_CID_MPEG_VIDEOENC_AV1_HEADERS_WITH_FRAME (V4L2_CID_MPEG_BASE+569)
  1201. /**
  1202. * Defines the Control ID to configure AV1 tile for a session.
  1203. *
  1204. * A pointer to a valid #v4l2_enc_av1_tile_config structure must be supplied
  1205. * with this control.
  1206. *
  1207. * @attention This control should be set after setting formats on both the planes
  1208. * and before requesting buffers on either plane.
  1209. **/
  1210. #define V4L2_CID_MPEG_VIDEOENC_AV1_TILE_CONFIGURATION (V4L2_CID_MPEG_BASE+570)
  1211. /**
  1212. * Defines the Control ID to enable variance based SSIM RDO for AV1.
  1213. *
  1214. * A boolean value should be supplied with this control.
  1215. * If value is false SSIM RDO is disabled else true when enabled.
  1216. *
  1217. * @attention This control should be set after setting formats on both the planes
  1218. * and before requesting buffers on either plane.
  1219. **/
  1220. #define V4L2_CID_MPEG_VIDEOENC_AV1_ENABLE_SSIMRDO (V4L2_CID_MPEG_BASE+571)
  1221. /**
  1222. * Defines the Control ID to enable CDF update for AV1.
  1223. *
  1224. * A boolean value should be supplied with this control.
  1225. * If value is true the CDF update in the symbol decoding process is disabled.
  1226. *
  1227. * @attention This control should be set after setting formats on both the planes
  1228. * and before requesting buffers on either plane.
  1229. **/
  1230. #define V4L2_CID_MPEG_VIDEOENC_AV1_DISABLE_CDF_UPDATE (V4L2_CID_MPEG_BASE+572)
  1231. /**
  1232. * Defines the Control ID to set total frames to encode.
  1233. *
  1234. * An integer value should be supplied with this control. A value of "x"
  1235. * indicates the number of frames that are given to encoder for encoding.
  1236. *
  1237. * @attention This control should be set after setting formats on both the planes
  1238. * and before requesting buffers on either plane.
  1239. **/
  1240. #define V4L2_CID_MPEG_VIDEOENC_FRAMES_TO_ENCODE (V4L2_CID_MPEG_BASE+573)
  1241. /**
  1242. * Defines the Control ID to configure initial QP parameters for a encoder session.
  1243. *
  1244. * A pointer to a valid #v4l2_ctrl_video_init_qp structure must be supplied
  1245. * with this control.
  1246. *
  1247. **/
  1248. #define V4L2_CID_MPEG_VIDEOENC_INIT_FRAME_QP (V4L2_CID_MPEG_BASE+574)
  1249. /**
  1250. * Defines the Control ID to enable lossless H.264/H.265 encoding.
  1251. *
  1252. * An boolean value must be supplied with this control. Default is 0.
  1253. * Lossless encoding is supported only for YUV444 8/10-bit format.
  1254. * @note This control must be set in case of H.264 YUV444 encoding as
  1255. * it does not support lossy encoding.
  1256. *
  1257. * @attention This control should be set after setting formats on both the planes
  1258. * and before requesting buffers on either plane.
  1259. */
  1260. #define V4L2_CID_MPEG_VIDEOENC_ENABLE_LOSSLESS (V4L2_CID_MPEG_BASE+575)
  1261. /**
  1262. * Defines the Control ID to set chroma_factor_idc for H.265 encoding.
  1263. *
  1264. * An integer value must be supplied with this control. Default is 1, and
  1265. * 3 for YUV444 8/10-bit format.
  1266. *
  1267. * @attention This control should be set after setting formats on both the planes
  1268. * and before requesting buffers on either plane.
  1269. */
  1270. #define V4L2_CID_MPEG_VIDEOENC_H265_CHROMA_FACTOR_IDC (V4L2_CID_MPEG_BASE+576)
  1271. /**
  1272. * Defines the Control ID to configure preprocessing enhancement for a session.
  1273. *
  1274. * A pointer to a valid #v4l2_enc_ppe_init_params structure must be supplied
  1275. * with this control.
  1276. *
  1277. * @attention This control must be set after requesting buffers on both the
  1278. * planes.
  1279. */
  1280. #define V4L2_CID_MPEG_VIDEOENC_PPE_INIT_PARAMS (V4L2_CID_MPEG_BASE+577)
  1281. /**
  1282. * Defines Control ID to configure PRESET id for CUVID Encoder
  1283. *
  1284. * An integer value between 1 to 7 should be supplied with this control.
  1285. *
  1286. * Check PRESET Guide for more details at
  1287. * https://docs.nvidia.com/video-technologies/video-codec-sdk/nvenc-preset-migration-guide/index.html
  1288. *
  1289. * @attention This control must be set after setting formats on both the planes
  1290. * and before requesting buffers on either plane.
  1291. */
  1292. #define V4L2_CID_MPEG_VIDEOENC_CUDA_PRESET_ID (V4L2_CID_MPEG_BASE+578)
  1293. /**
  1294. * Defines Control ID to configure TUNING INFO id for CUVID Encoder
  1295. *
  1296. * An integer value between 1 to 4 should be supplied with this control.
  1297. *
  1298. * Check PRESET Guide for more details at
  1299. * https://docs.nvidia.com/video-technologies/video-codec-sdk/nvenc-preset-migration-guide/index.html
  1300. *
  1301. * @attention This control must be set after setting formats on both the planes
  1302. * and before requesting buffers on either plane.
  1303. */
  1304. #define V4L2_CID_MPEG_VIDEOENC_CUDA_TUNING_INFO (V4L2_CID_MPEG_BASE+579)
  1305. /** Defines Control ID to configure CONSTQP VALUE for CUVID Encoder
  1306. *
  1307. * An integer value between 0 to 51 should be supplied with this control.
  1308. *
  1309. * @attention This control must be set after setting formats on both the planes
  1310. * and before requesting buffers on either plane.
  1311. */
  1312. #define V4L2_CID_MPEG_VIDEOENC_CUDA_CONSTQP (V4L2_CID_MPEG_BASE+580)
  1313. /** Defines Control ID to configure FPS VALUE for CUVID Encoder
  1314. *
  1315. * A positive integer value should be supplied with this control.
  1316. *
  1317. * @attention This control is runtime configurable and can be called anytime after setting
  1318. * formats on both the planes.
  1319. */
  1320. #define V4L2_CID_MPEG_VIDEOENC_RECONFIG_FPS (V4L2_CID_MPEG_BASE+581)
  1321. /** @} */
  1322. /**
  1323. * @defgroup V4L2Argus V4L2 Video Camera
  1324. *
  1325. * @brief NVIDIA V4L2 Camera Description and Extensions
  1326. *
  1327. * The camera device node is \c "/dev/video%d".
  1328. *
  1329. * ### Supported Pixelformats
  1330. * CAPTURE PLANE
  1331. * :---------------------
  1332. * V4L2_PIX_FMT_NV12M
  1333. * -
  1334. *
  1335. * ### Supported Memory Types
  1336. * MEMORY | CAPTURE PLANE
  1337. * :------------------: | :-----------:
  1338. * V4L2_MEMORY_MMAP | Y
  1339. * V4L2_MEMORY_DMABUF | Y
  1340. * V4L2_MEMORY_USERPTR | N
  1341. * \attention For the camera, it is necessary that the capture plane
  1342. * format be set and only then request buffers.
  1343. *
  1344. * ### Supported Controls
  1345. * The following sections describe the supported controls.
  1346. *
  1347. * #### Controls From the Open Source V4L2-Controls Header
  1348. * Control ID | Purpose | Runtime Configurable
  1349. * -------------------------------- | -------------------- | :------------------:
  1350. * - #V4L2_CID_3A_LOCK | AWB/AE Lock | Y
  1351. *
  1352. * All non-runtime configurable options must be set after setting format on
  1353. * the capture planes and before requesting buffers.
  1354. *
  1355. *
  1356. * ### NVIDIA-Specific Controls
  1357. * - #V4L2_CID_ARGUS_AUTO_WHITE_BALANCE_MODE
  1358. * - #V4L2_CID_ARGUS_SENSOR_MODE
  1359. * - #V4L2_CID_ARGUS_DENOISE_STRENGTH
  1360. * - #V4L2_CID_ARGUS_DENOISE_MODE
  1361. * - #V4L2_CID_ARGUS_EE_STRENGTH
  1362. * - #V4L2_CID_ARGUS_EE_MODE
  1363. * - #V4L2_CID_ARGUS_AE_ANTIBANDING_MODE
  1364. * - #V4L2_CID_ARGUS_ISP_DIGITAL_GAIN_RANGE
  1365. * - #V4L2_CID_ARGUS_COLOR_SATURATION
  1366. * - #V4L2_CID_ARGUS_GAIN_RANGE
  1367. * - #V4L2_CID_ARGUS_EXPOSURE_TIME_RANGE
  1368. * - #V4L2_CID_ARGUS_METADATA
  1369. *
  1370. * ### Setting Framerate
  1371. * The camera framerate can be set with \c VIDIOC_S_PARM IOCTL by setting the numerator
  1372. * and denominator in `v4l2_streamparm.parm.output.timeperframe`.
  1373. * Selection of camera mode can override this setting. If the camera mode is to be
  1374. * selected along with the specified framerate, then camera mode must be selected before
  1375. * setting the framerate.
  1376. *
  1377. * ### Camera Capture Metadata
  1378. * The camera can be queried to report frame related metadata. See \c V4L2_CID_ARGUS_METADATA
  1379. * for more information.
  1380. *
  1381. * ### EOS Handling
  1382. * Camera outputs all the queued empty buffers with data and TIME_OUT if no more empty buffers
  1383. * are queued. If error is encountered, am empty buffer is queued to the output with
  1384. * V4L2_BUF_FLAG_LAST flag.
  1385. * @{
  1386. * @ingroup ee_extensions_group
  1387. */
  1388. /**
  1389. * Defines the Control ID to set auto white balance mode for camera.
  1390. *
  1391. * A value of type \c v4l2_argus_ac_awb_mode must be supplied
  1392. * with this control.
  1393. *
  1394. * @attention This control should be set after setting format
  1395. * on the capture plane.
  1396. */
  1397. #define V4L2_CID_ARGUS_AUTO_WHITE_BALANCE_MODE (V4L2_CID_CAMERA_CLASS_BASE+20)
  1398. /**
  1399. * Defines the Control ID to set sensor mode for camera.
  1400. *
  1401. * A non-negative integer value must be supplied with this control.
  1402. *
  1403. * @attention This control should be set after setting format
  1404. * and before requesting buffers on the capture plane.
  1405. */
  1406. #define V4L2_CID_ARGUS_SENSOR_MODE (V4L2_CID_CAMERA_CLASS_BASE+32)
  1407. /**
  1408. * Defines the Control ID to set denoise strength for camera.
  1409. *
  1410. * A pointer to a valid structure \c v4l2_argus_denoise_strength must be
  1411. * supplied with this control.
  1412. *
  1413. * @attention This control should be set after setting format
  1414. * on the capture plane.
  1415. */
  1416. #define V4L2_CID_ARGUS_DENOISE_STRENGTH (V4L2_CID_CAMERA_CLASS_BASE+33)
  1417. /**
  1418. * Defines the Control ID to set denoise mode for camera.
  1419. *
  1420. * A value of type \c v4l2_argus_denoise_mode must be
  1421. * supplied with this control.
  1422. *
  1423. * @attention This control should be set after setting format
  1424. * on the capture plane.
  1425. */
  1426. #define V4L2_CID_ARGUS_DENOISE_MODE (V4L2_CID_CAMERA_CLASS_BASE+34)
  1427. /**
  1428. * Defines the Control ID to set edge enhancement strength for camera.
  1429. *
  1430. * A pointer to a valid structure \c v4l2_argus_edge_enhance_strength
  1431. * must be supplied with this control.
  1432. *
  1433. * @attention This control should be set after setting format
  1434. * on the capture plane.
  1435. */
  1436. #define V4L2_CID_ARGUS_EE_STRENGTH (V4L2_CID_CAMERA_CLASS_BASE+35)
  1437. /**
  1438. * Defines the Control ID to set edge enhancement mode for camera.
  1439. *
  1440. * A value of type \c v4l2_argus_edge_enhance_mode
  1441. * must be supplied with this control.
  1442. *
  1443. * @attention This control should be set after setting format
  1444. * on the capture plane.
  1445. */
  1446. #define V4L2_CID_ARGUS_EE_MODE (V4L2_CID_CAMERA_CLASS_BASE+36)
  1447. /**
  1448. * Defines the Control ID to set Auto Exposure antibanding mode for camera.
  1449. *
  1450. * A value of type \c v4l2_argus_ac_ae_antibanding_mode must be supplied
  1451. * with this control.
  1452. *
  1453. * @attention This control should be set after setting format
  1454. * on the capture plane.
  1455. */
  1456. #define V4L2_CID_ARGUS_AE_ANTIBANDING_MODE (V4L2_CID_CAMERA_CLASS_BASE+37)
  1457. /**
  1458. * Defines the Control ID to set edge enhancement settings for camera.
  1459. *
  1460. * A pointer to a valid structure \c v4l2_argus_exposure_compensation
  1461. * must be supplied with this control.
  1462. *
  1463. * @attention This control should be set after setting format
  1464. * on the capture plane.
  1465. */
  1466. #define V4L2_CID_ARGUS_EXPOSURE_COMPENSATION (V4L2_CID_CAMERA_CLASS_BASE+38)
  1467. /**
  1468. * Defines the Control ID to set edge enhancement settings for camera.
  1469. *
  1470. * A pointer to a valid structure \c v4l2_argus_ispdigital_gainrange
  1471. * must be supplied with this control.
  1472. *
  1473. * @attention This control should be set after setting format
  1474. * on the capture plane.
  1475. */
  1476. #define V4L2_CID_ARGUS_ISP_DIGITAL_GAIN_RANGE (V4L2_CID_CAMERA_CLASS_BASE+39)
  1477. /**
  1478. * Defines the Control ID to set sensor mode for camera.
  1479. *
  1480. * A pointer to a valid structure \c v4l2_argus_color_saturation
  1481. * must be supplied with this control.
  1482. * The flag `EnableSaturation` must be set to true to enable setting
  1483. * the specified color saturation
  1484. *
  1485. * @attention This control should be set after setting format
  1486. * and before requesting buffers on the capture plane.
  1487. */
  1488. #define V4L2_CID_ARGUS_COLOR_SATURATION (V4L2_CID_CAMERA_CLASS_BASE+40)
  1489. /**
  1490. * Defines the Control ID to set edge enhancement settings for camera.
  1491. *
  1492. * A pointer to a valid structure \c v4l2_argus_gainrange
  1493. * must be supplied with this control.
  1494. *
  1495. * @attention This control should be set after setting format
  1496. * on the capture plane.
  1497. */
  1498. #define V4L2_CID_ARGUS_GAIN_RANGE (V4L2_CID_CAMERA_CLASS_BASE+41)
  1499. /**
  1500. * Defines the Control ID to set edge enhancement settings for camera.
  1501. *
  1502. * A pointer to a valid structure \c v4l2_argus_exposure_timerange
  1503. * must be supplied with this control.
  1504. *
  1505. * @attention This control should be set after setting format
  1506. * on the capture plane.
  1507. */
  1508. #define V4L2_CID_ARGUS_EXPOSURE_TIME_RANGE (V4L2_CID_CAMERA_CLASS_BASE+42)
  1509. /**
  1510. * Defines the Control ID to get the camera argus output metadata.
  1511. *
  1512. * A pointer to a valid structure \c v4l2_argus_ctrl_metadata must be supplied
  1513. * with this control.
  1514. *
  1515. * @attention This control must be read after dequeueing a buffer successfully from
  1516. * the capture plane. The values in the structure are valid until the buffer is queued
  1517. * again.
  1518. */
  1519. #define V4L2_CID_ARGUS_METADATA (V4L2_CID_CAMERA_CLASS_BASE+43)
  1520. /** @} */
  1521. /** @addtogroup V4L2Dec */
  1522. /** @{ */
  1523. /**
  1524. * Enum v4l2_skip_frames_type, possible methods for decoder skip frames. */
  1525. enum v4l2_skip_frames_type {
  1526. /** Do not skip any frame. */
  1527. V4L2_SKIP_FRAMES_TYPE_NONE = 0,
  1528. /** Skip all non-reference frames. */
  1529. V4L2_SKIP_FRAMES_TYPE_NONREF = 1,
  1530. /** Skip all frames except IDR */
  1531. V4L2_SKIP_FRAMES_TYPE_DECODE_IDR_ONLY = 2,
  1532. };
  1533. /**
  1534. * Enum v4l2_cuda_mem_type, possible methods for cuda memory tpye. */
  1535. enum v4l2_cuda_mem_type {
  1536. /** Memory type device. */
  1537. V4L2_CUDA_MEM_TYPE_DEVICE = 0,
  1538. /** Memory type host. */
  1539. V4L2_CUDA_MEM_TYPE_PINNED = 1,
  1540. /** Memory type unified. */
  1541. V4L2_CUDA_MEM_TYPE_UNIFIED = 2,
  1542. };
  1543. /**
  1544. * Enum v4l2_videodec_input_error_type, possible error types for input stream. */
  1545. enum v4l2_videodec_input_error_type {
  1546. /** no error. */
  1547. V4L2_DEC_ERROR_NONE = 0x0,
  1548. /** sps error. */
  1549. V4L2_DEC_ERROR_SPS = 0x1,
  1550. /** pps error. */
  1551. V4L2_DEC_ERROR_PPS = 0x2,
  1552. /** slice header error. */
  1553. V4L2_DEC_ERROR_SLICE_HDR = 0x4,
  1554. /** missing reference frame error. */
  1555. V4L2_DEC_ERROR_MISSING_REF_FRAME = 0x8,
  1556. /** VPS error. */
  1557. V4L2_DEC_ERROR_VPS = 0x10,
  1558. };
  1559. /**
  1560. * Holds the decoder error status metadata for the frame.
  1561. */
  1562. typedef struct v4l2_ctrl_videodec_statusmetadata_
  1563. {
  1564. /** Error types:
  1565. * bit 0: Fatal
  1566. * bit 1: MB level syntax
  1567. * bit 2: Missing Slice(s)
  1568. * bit 3: PrevFrameLostFlag */
  1569. __u32 DecodeError;
  1570. /** Number of macro blocks decoded without error. */
  1571. __u32 DecodedMBs;
  1572. /** Number of macro blocks where error was concealed. */
  1573. __u32 ConcealedMBs;
  1574. /** POC of the reference frame used for concealment. */
  1575. __u32 nConcealedFromPOC;
  1576. /** Time required to decode the frame, in microseconds. */
  1577. __u32 FrameDecodeTime;
  1578. }v4l2_ctrl_videodec_statusmetadata;
  1579. /**
  1580. * Holds the the frame specific metadata for a reference frame.
  1581. */
  1582. typedef struct v4l2_ctrl_videodec_refframe_metadata_
  1583. {
  1584. /** Boolean value indicating if the frame is present in DPB. */
  1585. __u32 bPresent;
  1586. /** Boolean value indicating if the frame is an IDR. */
  1587. __u32 bIdrFrame;
  1588. /** Boolean value indicating if the frame is a long term reference frame. */
  1589. __u32 bLTRefFrame;
  1590. /** Boolean value indicating if it is a predicted frame. */
  1591. __u32 bPredicted;
  1592. /** Picture order count of the frame. */
  1593. __u32 nPictureOrderCnt;
  1594. /** Frame number. Resets to zero for an IDR frame. */
  1595. __u32 nFrameNum;
  1596. /** Long Term Frame Index of the frame. */
  1597. __u32 nLTRFrameIdx;
  1598. } v4l2_ctrl_videodec_refframe_metadata;
  1599. /**
  1600. * Holds the the frame specific metadata for the current frame.
  1601. */
  1602. typedef struct v4l2_ctrl_videodec_currentframe_metadata_
  1603. {
  1604. /** Boolean value indicating if the current frame is a reference frame. */
  1605. __u32 bRefFrame;
  1606. /** Boolean value indicating if the current frame is an IDR. */
  1607. __u32 bIdrFrame;
  1608. /** Boolean value indicating if the current frame is a long term reference frame. */
  1609. __u32 bLTRefFrame;
  1610. /** Picture order count of the current frame. */
  1611. __u32 nPictureOrderCnt;
  1612. /** Frame number. Resets to zero for an IDR frame. */
  1613. __u32 nFrameNum;
  1614. /** Long Term Frame Index of the current frame. */
  1615. __u32 nLTRFrameIdx;
  1616. } v4l2_ctrl_videodec_currentframe_metadata;
  1617. /**
  1618. * Holds the decoder DPB info metadata.
  1619. */
  1620. typedef struct v4l2_ctrl_videodec_dpbinfometadata_
  1621. {
  1622. /** Metadata for the current decoded frame. */
  1623. v4l2_ctrl_videodec_currentframe_metadata currentFrame;
  1624. /** Number of active frames present in the DPB. */
  1625. __u32 nActiveRefFrames;
  1626. /** An array of metadatas for the active frames in the DPB. Only
  1627. * nActiveRefFrames elements in the array are valid. */
  1628. v4l2_ctrl_videodec_refframe_metadata RPSList[16];
  1629. } v4l2_ctrl_videodec_dpbinfometadata;
  1630. /**
  1631. * Holds H.264 specific decoder metadata for the frame.
  1632. */
  1633. typedef struct v4l2_ctrl_h264dec_bufmetadata_
  1634. {
  1635. /** Holds the number of bits in the frame. */
  1636. __u32 nFrameNumBits;
  1637. /** Type of frame:
  1638. * 0 = B
  1639. * 1 = P
  1640. * 2 = I */
  1641. __u32 FrameType;
  1642. /** Holds the current DPB information of the decoder. */
  1643. v4l2_ctrl_videodec_dpbinfometadata dpbInfo;
  1644. }v4l2_ctrl_h264dec_bufmetadata;
  1645. /**
  1646. * Holds H.265 specific decoder metadata for the frame.
  1647. */
  1648. typedef struct v4l2_ctrl_hevcdec_bufmetadata_
  1649. {
  1650. /** Holds the number of bits in the frame. */
  1651. __u32 nPocLsbBits;
  1652. /** Type of frame:
  1653. * 0 = B
  1654. * 1 = P
  1655. * 2 = I */
  1656. __u32 FrameType;
  1657. /** Holds the current DPB information of the decoder. */
  1658. v4l2_ctrl_videodec_dpbinfometadata dpbInfo;
  1659. }v4l2_ctrl_hevcdec_bufmetadata;
  1660. /**
  1661. * Holds the video decoder input header error metadata for a frame.
  1662. */
  1663. typedef struct v4l2_ctrl_videodec_inputbuf_metadata_
  1664. {
  1665. /** Bits represent types of error as defined
  1666. * with v4l2_videodec_input_error_type. */
  1667. __u32 nBitStreamError;
  1668. } v4l2_ctrl_videodec_inputbuf_metadata;
  1669. /**
  1670. * Holds the video decoder output metadata for a frame.
  1671. */
  1672. typedef struct v4l2_ctrl_videodec_outputbuf_metadata_
  1673. {
  1674. /** Color primaries. */
  1675. __u8 ucColorPrimaries;
  1676. /** Transfer characteristics. */
  1677. __u8 ucTransferCharacteristics;
  1678. /** Matrix coefficients. */
  1679. __u8 ucMatrixCoefficients;
  1680. /** Boolean value indicating if \c FrameDecStats has valid contents. */
  1681. __u32 bValidFrameStatus;
  1682. /** Frame decode statistics. */
  1683. v4l2_ctrl_videodec_statusmetadata FrameDecStats;
  1684. /** Codec specific metadata for the frame. */
  1685. union {
  1686. /** H.264 specific metadata. */
  1687. v4l2_ctrl_h264dec_bufmetadata H264DecParams;
  1688. /** H.265 specific metadata. */
  1689. v4l2_ctrl_hevcdec_bufmetadata HEVCDecParams;
  1690. }CodecParams;
  1691. } v4l2_ctrl_videodec_outputbuf_metadata;
  1692. /** @} */
  1693. /** @addtogroup V4L2Enc */
  1694. /** @{ */
  1695. /**
  1696. * Specifies the types of encoder temporal tradeoff levels
  1697. */
  1698. enum v4l2_enc_temporal_tradeoff_level_type {
  1699. /** Do not drop any buffers. */
  1700. V4L2_ENC_TEMPORAL_TRADEOFF_LEVEL_DROPNONE = 0,
  1701. /** Drop 1 in every 5 buffers. */
  1702. V4L2_ENC_TEMPORAL_TRADEOFF_LEVEL_DROP1IN5,
  1703. /** Drop 1 in every 3 buffers. */
  1704. V4L2_ENC_TEMPORAL_TRADEOFF_LEVEL_DROP1IN3,
  1705. /** Drop 1 in every 2 buffers. */
  1706. V4L2_ENC_TEMPORAL_TRADEOFF_LEVEL_DROP1IN2,
  1707. /** Drop 2 in every 3 buffers. */
  1708. V4L2_ENC_TEMPORAL_TRADEOFF_LEVEL_DROP2IN3,
  1709. };
  1710. /**
  1711. * Specifies the encoder HW Preset type.
  1712. */
  1713. enum v4l2_enc_hw_preset_type {
  1714. /** Encoder HWPreset DISABLED. */
  1715. V4L2_ENC_HW_PRESET_DISABLE = 0,
  1716. /** Encoder HWPreset with per frame encode time UltraFast. */
  1717. V4L2_ENC_HW_PRESET_ULTRAFAST = 1,
  1718. /** Encoder HWPreset with per frame encode time Fast. */
  1719. V4L2_ENC_HW_PRESET_FAST,
  1720. /** Encoder HWPreset with per frame encode time Medium. */
  1721. V4L2_ENC_HW_PRESET_MEDIUM,
  1722. /** Encoder HWPreset with per frame encode time Slow. */
  1723. V4L2_ENC_HW_PRESET_SLOW,
  1724. };
  1725. /**
  1726. * Specifies the encoder HW Preset type.
  1727. */
  1728. enum v4l2_enc_hw_tuning_info_type {
  1729. /** Encoder Tuning Info Undefined */
  1730. V4L2_ENC_TUNING_INFO_UNDEFINED = 0,
  1731. /** Encoder Tuning Info High Quality */
  1732. V4L2_ENC_TUNING_INFO_HIGH_QUALITY = 1,
  1733. /** Encoder Tuning Info Low Latency */
  1734. V4L2_ENC_TUNING_INFO_LOW_LATENCY,
  1735. /** Encoder Tuning Info Ultra Low Latency */
  1736. V4L2_ENC_TUNING_INFO_ULTRA_LOW_LATENCY,
  1737. /** Encoder Tuning Info Lossless */
  1738. V4L2_ENC_TUNING_INFO_LOSSLESS,
  1739. };
  1740. /**
  1741. * Holds encoder HW Preset type parameters
  1742. * to be used with #V4L2_CID_MPEG_VIDEOENC_HW_PRESET_TYPE_PARAM IOCTL.
  1743. */
  1744. typedef struct v4l2_enc_hw_preset_type_param_
  1745. {
  1746. /** Type in which the encoder hw preset is specified, one of type #v4l2_enc_hw_preset_type. */
  1747. enum v4l2_enc_hw_preset_type hw_preset_type;
  1748. /** Boolean value indicating if encoder set to max clock. */
  1749. __u8 set_max_enc_clock;
  1750. }v4l2_enc_hw_preset_type_param;
  1751. /**
  1752. * Enum specifying the type of slice length.
  1753. */
  1754. enum v4l2_enc_slice_length_type {
  1755. /** Slice size is specified in terms of number of bytes. */
  1756. V4L2_ENC_SLICE_LENGTH_TYPE_BITS = 0,
  1757. /** Slice size is specified in terms of number of macroblocks. */
  1758. V4L2_ENC_SLICE_LENGTH_TYPE_MBLK,
  1759. };
  1760. /**
  1761. * Specifies the input buffer metadata flag.
  1762. */
  1763. enum v4l2_enc_input_metadata_param {
  1764. /** Input metadata structure contains ROI parameters. */
  1765. V4L2_ENC_INPUT_ROI_PARAM_FLAG = 1,
  1766. /** Input metadata structure contains GDR parameters. */
  1767. V4L2_ENC_INPUT_GDR_PARAM_FLAG = 1 << 1,
  1768. /** Input metadata structure contains External RPS parameters. */
  1769. V4L2_ENC_INPUT_RPS_PARAM_FLAG = 1 << 2,
  1770. /** Input metadata structure contains External RC parameters. */
  1771. V4L2_ENC_INPUT_RC_PARAM_FLAG = 1 << 3,
  1772. /** Input metadata structure contains ReconCRC parameters. */
  1773. V4L2_ENC_INPUT_RECONCRC_PARAM_FLAG = 1 << 4,
  1774. };
  1775. /**
  1776. * Defines the possible levels for H.265 encoder.
  1777. */
  1778. enum v4l2_mpeg_video_h265_level {
  1779. V4L2_MPEG_VIDEO_H265_LEVEL_1_0_MAIN_TIER = 0,
  1780. V4L2_MPEG_VIDEO_H265_LEVEL_1_0_HIGH_TIER,
  1781. V4L2_MPEG_VIDEO_H265_LEVEL_2_0_MAIN_TIER,
  1782. V4L2_MPEG_VIDEO_H265_LEVEL_2_0_HIGH_TIER,
  1783. V4L2_MPEG_VIDEO_H265_LEVEL_2_1_MAIN_TIER,
  1784. V4L2_MPEG_VIDEO_H265_LEVEL_2_1_HIGH_TIER,
  1785. V4L2_MPEG_VIDEO_H265_LEVEL_3_0_MAIN_TIER,
  1786. V4L2_MPEG_VIDEO_H265_LEVEL_3_0_HIGH_TIER,
  1787. V4L2_MPEG_VIDEO_H265_LEVEL_3_1_MAIN_TIER,
  1788. V4L2_MPEG_VIDEO_H265_LEVEL_3_1_HIGH_TIER,
  1789. V4L2_MPEG_VIDEO_H265_LEVEL_4_0_MAIN_TIER,
  1790. V4L2_MPEG_VIDEO_H265_LEVEL_4_0_HIGH_TIER,
  1791. V4L2_MPEG_VIDEO_H265_LEVEL_4_1_MAIN_TIER,
  1792. V4L2_MPEG_VIDEO_H265_LEVEL_4_1_HIGH_TIER,
  1793. V4L2_MPEG_VIDEO_H265_LEVEL_5_0_MAIN_TIER,
  1794. V4L2_MPEG_VIDEO_H265_LEVEL_5_0_HIGH_TIER,
  1795. V4L2_MPEG_VIDEO_H265_LEVEL_5_1_MAIN_TIER,
  1796. V4L2_MPEG_VIDEO_H265_LEVEL_5_1_HIGH_TIER,
  1797. V4L2_MPEG_VIDEO_H265_LEVEL_5_2_MAIN_TIER,
  1798. V4L2_MPEG_VIDEO_H265_LEVEL_5_2_HIGH_TIER,
  1799. V4L2_MPEG_VIDEO_H265_LEVEL_6_0_MAIN_TIER,
  1800. V4L2_MPEG_VIDEO_H265_LEVEL_6_0_HIGH_TIER,
  1801. V4L2_MPEG_VIDEO_H265_LEVEL_6_1_MAIN_TIER,
  1802. V4L2_MPEG_VIDEO_H265_LEVEL_6_1_HIGH_TIER,
  1803. V4L2_MPEG_VIDEO_H265_LEVEL_6_2_MAIN_TIER,
  1804. V4L2_MPEG_VIDEO_H265_LEVEL_6_2_HIGH_TIER,
  1805. };
  1806. #define V4L2_MPEG_VIDEO_BITRATE_MODE_CONSTQP 0x2
  1807. /**
  1808. * Holds encoder slice length parameters, to be used with
  1809. * \c V4L2_CID_MPEG_VIDEOENC_SLICE_LENGTH_PARAM IOCTL.
  1810. */
  1811. typedef struct v4l2_enc_slice_length_param_
  1812. {
  1813. /** Type in which the slice length is specified, one of type \c v4l2_enc_slice_length_type. */
  1814. enum v4l2_enc_slice_length_type slice_length_type;
  1815. /** Size of the slice in either number of bytes or number of macro blocks. */
  1816. __u32 slice_length;
  1817. }v4l2_enc_slice_length_param;
  1818. /**
  1819. * Holds encoder virtual buffer size parameters, to be used with
  1820. * \c V4L2_CID_MPEG_VIDEOENC_VIRTUALBUFFER_SIZE IOCTL.
  1821. */
  1822. typedef struct v4l2_enc_virtual_buffer_size_
  1823. {
  1824. /** Size of the virtual buffer, in bits. */
  1825. __u32 size;
  1826. }v4l2_enc_virtual_buffer_size;
  1827. /**
  1828. * Holds encoder number of reference frame parameters, to be used with
  1829. * \c V4L2_CID_MPEG_VIDEOENC_NUM_REFERENCE_FRAMES IOCTL.
  1830. *
  1831. * This is not supported for H.265.
  1832. */
  1833. typedef struct v4l2_enc_num_ref_frames_
  1834. {
  1835. /** Number of reference frames. */
  1836. __u32 frames;
  1837. }v4l2_enc_num_ref_frames;
  1838. /**
  1839. * Holds encoder slice intrareferesh parameters, to be used with
  1840. * \c V4L2_CID_MPEG_VIDEOENC_SLICE_INTRAREFRESH_PARAM IOCTL.
  1841. */
  1842. typedef struct v4l2_enc_slice_intrarefresh_param_
  1843. {
  1844. /** Slice intrarefresh interval, in number of slices. */
  1845. __u32 interval;
  1846. }v4l2_enc_slice_intrarefresh_param;
  1847. /**
  1848. * Defines the maximum number of ROI regions supported by the encoder.
  1849. */
  1850. #define V4L2_MAX_ROI_REGIONS 8
  1851. /**
  1852. * Holds the encoder quality parameters for a single ROI region.
  1853. */
  1854. typedef struct v4l2_enc_ROI_param_
  1855. {
  1856. /** Region of interest rectangle. */
  1857. struct v4l2_rect ROIRect;
  1858. /** QP delta for the region. */
  1859. __s32 QPdelta;
  1860. } v4l2_enc_ROI_param;
  1861. /**
  1862. * Holds the encoder frame ROI parameters
  1863. * to be used with #V4L2_CID_MPEG_VIDEOENC_ROI_PARAMS IOCTL.
  1864. */
  1865. typedef struct v4l2_enc_frame_ROI_params_
  1866. {
  1867. /** Number of regions. */
  1868. __u32 num_ROI_regions;
  1869. /** Array of indiviudal ROI parameters. */
  1870. v4l2_enc_ROI_param ROI_params[V4L2_MAX_ROI_REGIONS];
  1871. /** Config store integer to which this control is to be applied.
  1872. * This must be same as the value of config store of \c v4l2_buffer to which
  1873. * the ROI params is applied. */
  1874. __u32 config_store;
  1875. }v4l2_enc_frame_ROI_params;
  1876. /**
  1877. * Defines the available features for preprocessing enhancement (PPE) module
  1878. */
  1879. enum v4l2_ppe_feature {
  1880. /** Default value for no feature enabled */
  1881. V4L2_PPE_FEATURE_NONE = 0,
  1882. /** Temporal Adaptive Quantization (TAQ) */
  1883. V4L2_PPE_FEATURE_TAQ = (1 << 0),
  1884. };
  1885. /**
  1886. * Holds the preprocessing enhancement initialization parameters
  1887. * to be used with #V4L2_CID_MPEG_VIDEOENC_PPE_INIT_PARAMS IOCTL.
  1888. */
  1889. typedef struct v4l2_enc_ppe_init_params_
  1890. {
  1891. /** Boolean value indicating if PPE module should be enabled */
  1892. __u8 enable_ppe;
  1893. /** Bit flags to enable/disable each individual feature */
  1894. __u32 feature_flags;
  1895. /** Boolean value indicating if profiler should be enabled */
  1896. __u8 enable_profiler;
  1897. /** The max number of milliseconds that Nvmedia should wait for each frame processing */
  1898. __s32 wait_time_ms;
  1899. /** Maximum strength of QP delta map for TAQ */
  1900. __u8 taq_max_qp_delta;
  1901. /** Boolean value indicating if TAQ should be applied for B-frames */
  1902. __u8 taq_b_frame_mode;
  1903. }v4l2_enc_ppe_init_params;
  1904. /**
  1905. * Holds the motion vector parameters for a single block.
  1906. * For H.264, nvenc provides one motion vector per 16x16 block(Macroblock).
  1907. * For H.265, nvenc provides one motion vector per 32x32 block(Coded Tree Block).
  1908. */
  1909. typedef struct MVInfo_ {
  1910. /** Number of pixels the macro block moved in horizontal direction. */
  1911. __s32 mv_x : 16;
  1912. /** Number of pixels the macro block moved in vertical direction. */
  1913. __s32 mv_y : 14;
  1914. /** Temporal hints used by hardware for Motion Estimation. */
  1915. __u32 weight : 2;
  1916. } MVInfo;
  1917. /**
  1918. * Holds the motion vector parameters for one complete frame.
  1919. */
  1920. typedef struct v4l2_ctrl_videoenc_outputbuf_metadata_MV_ {
  1921. /** Size of the pMVInfo buffer, in bytes. */
  1922. __u32 bufSize;
  1923. /** Pointer to the buffer containing the motion vectors. */
  1924. MVInfo *pMVInfo;
  1925. } v4l2_ctrl_videoenc_outputbuf_metadata_MV;
  1926. /**
  1927. * Maximum number of reference frames supported by the encoder.
  1928. */
  1929. #define V4L2_MAX_REF_FRAMES 8
  1930. /**
  1931. * Holds the RPS List parameters of encoded frame.
  1932. */
  1933. typedef struct v4l2_enc_frame_full_prop_
  1934. {
  1935. /** Unique frame ID. */
  1936. __u32 nFrameId;
  1937. /** Boolean value indicating if current frame is an IDR. */
  1938. __u8 bIdrFrame;
  1939. /** Boolean value indicating if set Long Term Ref Flag. */
  1940. __u8 bLTRefFrame;
  1941. /** Picture Order Count. */
  1942. __u32 nPictureOrderCnt;
  1943. /** FrameNum. */
  1944. __u32 nFrameNum;
  1945. /** LongTermFrameIdx of a picture. */
  1946. __u32 nLTRFrameIdx;
  1947. } v4l2_enc_frame_full_prop;
  1948. /**
  1949. * Holds the encoder output metadata for a frame, to be used with
  1950. * \c V4L2_CID_MPEG_VIDEOENC_METADATA IOCTL.
  1951. */
  1952. typedef struct v4l2_ctrl_videoenc_outputbuf_metadata_
  1953. {
  1954. /** Boolean value indicating if current frame is a key frame. */
  1955. __u8 KeyFrame;
  1956. /** Boolean value indicating end of frame in case of multi slice encoding. */
  1957. __u8 EndofFrame;
  1958. /** Average QP value of the frame. */
  1959. __u16 AvgQP;
  1960. /** Boolean value indicating if current frame is a golden or alternate frame. */
  1961. __u8 bIsGoldenOrAlternateFrame;
  1962. /** CRC for Reconstructed frame. */
  1963. __u8 bValidReconCRC;
  1964. /** Recon Y-frame CRC */
  1965. __u32 ReconFrame_Y_CRC;
  1966. /** Recon U-frame CRC */
  1967. __u32 ReconFrame_U_CRC;
  1968. /** Recon V-frame CRC */
  1969. __u32 ReconFrame_V_CRC;
  1970. /** Number of bits needed to encode the frame. */
  1971. __u32 EncodedFrameBits;
  1972. /** Minumum QP value in the frame. */
  1973. __u32 FrameMinQP;
  1974. /** Maximum QP value in the frame. */
  1975. __u32 FrameMaxQP;
  1976. /** RPS Feedback. */
  1977. __u32 bRPSFeedback_status;
  1978. /** Reference frame ID used for Motion Estimation of current frame,
  1979. ignored for IDR */
  1980. __u32 nCurrentRefFrameId;
  1981. /** Number of active reference frames. */
  1982. __u32 nActiveRefFrames;
  1983. /** RPS List including most recent frame if it is reference frame. */
  1984. v4l2_enc_frame_full_prop RPSList[V4L2_MAX_REF_FRAMES];
  1985. } v4l2_ctrl_videoenc_outputbuf_metadata;
  1986. /**
  1987. * Holds the metadata parameters for video encoder and decoder.
  1988. *
  1989. * The metadata is valid for the buffer with index \c buffer_index after the
  1990. * buffer is dequeued until it is queued again.
  1991. */
  1992. typedef struct v4l2_ctrl_video_metadata_
  1993. {
  1994. /** A pointer to #v4l2_ctrl_videodec_inputbuf_metadata structure.
  1995. * This must be a valid pointer when used with #V4L2_CID_MPEG_VIDEODEC_INPUT_METADATA
  1996. * IOCTL. */
  1997. v4l2_ctrl_videodec_inputbuf_metadata *VideoDecHeaderErrorMetadata;
  1998. /** A pointer to #v4l2_ctrl_videodec_outputbuf_metadata structure.
  1999. * This must be a valid pointer when used with #V4L2_CID_MPEG_VIDEODEC_METADATA
  2000. * IOCTL. */
  2001. v4l2_ctrl_videodec_outputbuf_metadata *VideoDecMetadata;
  2002. /** A pointer to #v4l2_ctrl_videoenc_outputbuf_metadata structure.
  2003. * This must be a valid pointer when used with #V4L2_CID_MPEG_VIDEOENC_METADATA
  2004. * IOCTL. */
  2005. v4l2_ctrl_videoenc_outputbuf_metadata *VideoEncMetadata;
  2006. /** A pointer to #v4l2_ctrl_videoenc_outputbuf_metadata_MV structure.
  2007. * This must be a valid pointer when used with #V4L2_CID_MPEG_VIDEOENC_METADATA_MV
  2008. * IOCTL. */
  2009. v4l2_ctrl_videoenc_outputbuf_metadata_MV *VideoEncMetadataMV;
  2010. /** Index of the buffer whose metadata is required. */
  2011. __u32 buffer_index;
  2012. } v4l2_ctrl_video_metadata;
  2013. /**
  2014. * Holds the encoder GDR parameters
  2015. * to be used with #V4L2_CID_MPEG_VIDEOENC_INPUT_METADATA IOCTL.
  2016. */
  2017. typedef struct v4l2_enc_gdr_params_
  2018. {
  2019. /** Parameter for GDR (Intra Refresh) for specified number of frames. */
  2020. __u32 nGDRFrames;
  2021. } v4l2_enc_gdr_params;
  2022. /**
  2023. * Holds the params to configure encoder for external rps control
  2024. * to be used with #V4L2_CID_MPEG_VIDEOENC_ENABLE_EXTERNAL_RPS_CONTROL IOCTL.
  2025. */
  2026. typedef struct v4l2_enc_enable_ext_rps_ctrl_
  2027. {
  2028. /** Boolean value indicating if enabled External RPS control. */
  2029. __u8 bEnableExternalRPS;
  2030. /** Boolean value indicating if allowed gap in frame number. */
  2031. __u8 bGapsInFrameNumAllowed;
  2032. /* TODO : Check for field details. */
  2033. __u32 nH264FrameNumBits;
  2034. /* TODO : Check for field details. */
  2035. __u32 nH265PocLsbBits;
  2036. }v4l2_enc_enable_ext_rps_ctr;
  2037. /**
  2038. * Holds the encoder frame property.
  2039. */
  2040. typedef struct _v4l2_enc_frame_prop
  2041. {
  2042. /** unique Id. */
  2043. __u32 nFrameId;
  2044. /** Long Term Ref Flag. */
  2045. __u8 bLTRefFrame;
  2046. } v4l2_enc_frame_prop;
  2047. /**
  2048. * Holds the encoder frame external rps control parameters
  2049. * to be used with #V4L2_CID_MPEG_VIDEOENC_INPUT_METADATA IOCTL.
  2050. */
  2051. typedef struct v4l2_enc_frame_ext_rps_ctrl_params_
  2052. {
  2053. /** unique Id of current frame. */
  2054. __u32 nFrameId;
  2055. /** Boolean value indicating if current frame referenced or non-referenced. */
  2056. __u8 bRefFrame;
  2057. /** Boolean value indicating if current frame long Term Ref Flag. */
  2058. __u8 bLTRefFrame;
  2059. /** Max Number of reference frames to use for inter-motion search. */
  2060. __u32 nMaxRefFrames;
  2061. /** # of valid entries in RPS, 0 means IDR. */
  2062. __u32 nActiveRefFrames;;
  2063. /** frame id of reference frame to be used for motion search, ignored for IDR. */
  2064. __u32 nCurrentRefFrameId;
  2065. /** Array of RPS */
  2066. v4l2_enc_frame_prop RPSList[V4L2_MAX_REF_FRAMES];
  2067. }v4l2_enc_frame_ext_rps_ctrl_params;
  2068. /**
  2069. * Holds the params to configure encoder for external rate control mode
  2070. * to be used with #V4L2_CID_MPEG_VIDEOENC_ENABLE_EXTERNAL_RATE_CONTROL IOCTL.
  2071. */
  2072. typedef struct v4l2_enc_enable_ext_rate_ctrl_
  2073. {
  2074. /** Boolean value indicating if enabled External Picture RC. */
  2075. __u8 bEnableExternalPictureRC;
  2076. /** Max QP per session when external picture RC enabled. */
  2077. __u32 nsessionMaxQP;
  2078. }v4l2_enc_enable_ext_rate_ctr;
  2079. /**
  2080. * Holds the encoder frame external rate control parameters
  2081. * to be used with #V4L2_CID_MPEG_VIDEOENC_INPUT_METADATA ioctl.
  2082. */
  2083. typedef struct v4l2_enc_frame_ext_rate_ctrl_params_
  2084. {
  2085. /** Target frame bits. */
  2086. __u32 nTargetFrameBits;
  2087. /** Frame start QP. */
  2088. __u32 nFrameQP;
  2089. /** Frame min QP. */
  2090. __u32 nFrameMinQp;
  2091. /** Frame max QP. */
  2092. __u32 nFrameMaxQp;
  2093. /** Frame min QP deviation. */
  2094. __u32 nMaxQPDeviation;
  2095. }v4l2_enc_frame_ext_rate_ctrl_params;
  2096. /**
  2097. * Holds the params to configure encoder for ROI parameters encoding
  2098. *
  2099. * Must be used with #V4L2_CID_MPEG_VIDEOENC_ENABLE_ROI_PARAM IOCTL.
  2100. */
  2101. typedef struct v4l2_enc_enable_roi_param_
  2102. {
  2103. /** Boolean value to indicating ROI param encoding. */
  2104. __u8 bEnableROI;
  2105. }v4l2_enc_enable_roi_param;
  2106. /**
  2107. * Holds the params to configure encoder for Reconstructed CRC encoding
  2108. *
  2109. * Must be used with #V4L2_CID_MPEG_VIDEOENC_ENABLE_RECONCRC_PARAM IOCTL.
  2110. */
  2111. typedef struct v4l2_enc_enable_reconcrc_param_
  2112. {
  2113. /** Boolean value to indicating Reconstructed CRC encoding. */
  2114. __u8 bEnableReconCRC;
  2115. }v4l2_enc_enable_reconcrc_param;
  2116. /**
  2117. * Holds the encoder frame Reconstructed CRC parameters.
  2118. *
  2119. * Must be used with #V4L2_CID_MPEG_VIDEOENC_INPUT_METADATA IOCTL.
  2120. */
  2121. typedef struct v4l2_enc_frame_ReconCRC_params_
  2122. {
  2123. /** Rectangle to specify the co-ordinates of the input frame
  2124. * used to calculate reconstructed picture CRC. */
  2125. struct v4l2_rect ReconCRCRect;
  2126. }v4l2_enc_frame_ReconCRC_params;
  2127. /**
  2128. * Holds the encoder frame input metadata parameters.
  2129. *
  2130. * Must be used with #V4L2_CID_MPEG_VIDEOENC_INPUT_METADATA IOCTL.
  2131. */
  2132. typedef struct v4l2_ctrl_videoenc_input_metadata_
  2133. {
  2134. /** Flag to indicate which inputbuffer metadata is valid. */
  2135. __u32 flag;
  2136. /** Pointer to the ROI params structure when ROI param is in metadata_flag. */
  2137. v4l2_enc_frame_ROI_params *VideoEncROIParams;
  2138. /** Pointer to the Reconstructed CRC parameter structure when ReconCRC param is in
  2139. * metadata flag. */
  2140. v4l2_enc_frame_ReconCRC_params *VideoReconCRCParams;
  2141. /** Pointer to the GDR params structure when GDR param is in metadata_flag. */
  2142. v4l2_enc_gdr_params *VideoEncGDRParams;
  2143. /** Pointer to the External RPL control parameter structure when RPS param is in
  2144. * metadata flag. */
  2145. v4l2_enc_frame_ext_rps_ctrl_params *VideoEncRPSParams;
  2146. /** Pointer to the External Rate control parameter structure when RC param is in
  2147. * metadata flag. */
  2148. v4l2_enc_frame_ext_rate_ctrl_params *VideoEncExtRCParams;
  2149. /** Config store integer to which these parameters are to be applied.
  2150. * This must be same as the value of config store of queued v4l2_buffer
  2151. * for which these parameters are valid. */
  2152. __u32 config_store;
  2153. } v4l2_ctrl_videoenc_input_metadata;
  2154. /**
  2155. * Setting Qp values in #v4l2_ctrl_video_qp_range to QP_RETAIN_VAL
  2156. * retains default or previously set QP values.
  2157. */
  2158. #define QP_RETAIN_VAL -1
  2159. /**
  2160. * Holds the encoder frame min/max QP parameters.
  2161. *
  2162. * Must be used with #V4L2_CID_MPEG_VIDEOENC_QP_RANGE IOCTL.
  2163. */
  2164. typedef struct _v4l2_ctrl_video_qp_range
  2165. {
  2166. /** Minimum QP value for I frame. */
  2167. __u32 MinQpI;
  2168. /** Maximum QP value for I frame. */
  2169. __u32 MaxQpI;
  2170. /** Minimum QP value for P frame. */
  2171. __u32 MinQpP;
  2172. /** Maximum QP value for P frame. */
  2173. __u32 MaxQpP;
  2174. /** Minimum QP value for B frame. */
  2175. __u32 MinQpB;
  2176. /** Maximum QP value for B frame. */
  2177. __u32 MaxQpB;
  2178. } v4l2_ctrl_video_qp_range;
  2179. typedef struct _v4l2_ctrl_video_constqp
  2180. {
  2181. __u32 constQpI;
  2182. __u32 constQpP;
  2183. __u32 constQpB;
  2184. } v4l2_ctrl_video_constqp;
  2185. typedef struct _v4l2_ctrl_video_framerate
  2186. {
  2187. __u32 fps_n;
  2188. __u32 fps_d;
  2189. } v4l2_ctrl_video_framerate;
  2190. /**
  2191. * Holds the encoder init QP parameters.
  2192. *
  2193. * Must be used with #V4L2_CID_MPEG_VIDEOENC_INIT_FRAME_QP IOCTL.
  2194. */
  2195. typedef struct _v4l2_ctrl_video_init_qp
  2196. {
  2197. /** Initial QP value for I frame. */
  2198. __u32 IInitQP;
  2199. /** Initial QP value for P frame. */
  2200. __u32 PInitQP;
  2201. /** Initial QP value for B frame. */
  2202. __u32 BInitQP;
  2203. } v4l2_ctrl_video_init_qp;
  2204. /**
  2205. * Holds the params to configure tiles for AV1 encoding
  2206. *
  2207. * Must be used with #V4L2_CID_MPEG_VIDEOENC_AV1_TILE_CONFIGURATION IOCTL.
  2208. */
  2209. typedef struct v4l2_enc_av1_tile_config_
  2210. {
  2211. /** Boolean value to enable multi-tile */
  2212. __u8 bEnableTile;
  2213. /** Log2 Tile Rows */
  2214. __u32 nLog2RowTiles;
  2215. /** Log2 Tile Columns */
  2216. __u32 nLog2ColTiles;
  2217. }v4l2_enc_av1_tile_config;
  2218. /** @} */
  2219. /** @addtogroup V4L2Argus */
  2220. /** @{ */
  2221. /**
  2222. * Enum specifying types of denoise modes.
  2223. */
  2224. enum v4l2_argus_denoise_mode {
  2225. V4L2_ARGUS_DENOISE_MODE_UNKNOWN = 0,
  2226. V4L2_ARGUS_DENOISE_MODE_OFF = 1,
  2227. V4L2_ARGUS_DENOISE_MODE_FAST = 2,
  2228. V4L2_ARGUS_DENOISE_MODE_HIGH_QUALITY = 3,
  2229. };
  2230. /**
  2231. * Enum specifying types of edge enhancement modes.
  2232. */
  2233. enum v4l2_argus_edge_enhance_mode {
  2234. V4L2_ARGUS_EDGE_ENHANCE_MODE_UNKNOWN = 0,
  2235. V4L2_ARGUS_EDGE_ENHANCE_MODE_OFF = 1,
  2236. V4L2_ARGUS_EDGE_ENHANCE_MODE_FAST = 2,
  2237. V4L2_ARGUS_EDGE_ENHANCE_MODE_HIGH_QUALITY = 3,
  2238. };
  2239. /**
  2240. * Enum specifying types of AE antibanding modes.
  2241. */
  2242. enum v4l2_argus_ac_ae_antibanding_mode {
  2243. V4L2_ARGUS_AE_ANTIBANDING_MODE_UNKNOWN = 0,
  2244. V4L2_ARGUS_AE_ANTIBANDING_MODE_OFF = 1,
  2245. V4L2_ARGUS_AE_ANTIBANDING_MODE_AUTO = 2,
  2246. V4L2_ARGUS_AE_ANTIBANDING_MODE_50HZ = 3,
  2247. V4L2_ARGUS_AE_ANTIBANDING_MODE_60HZ = 4,
  2248. };
  2249. /**
  2250. * Enum specifying types of AC AWB modes.
  2251. */
  2252. enum v4l2_argus_ac_awb_mode {
  2253. V4L2_ARGUS_AWB_MODE_OFF = 1,
  2254. V4L2_ARGUS_AWB_MODE_AUTO = 2,
  2255. V4L2_ARGUS_AWB_MODE_INCANDESCENT = 3,
  2256. V4L2_ARGUS_AWB_MODE_FLUORESCENT = 4,
  2257. V4L2_ARGUS_AWB_MODE_WARM_FLUORESCENT = 5,
  2258. V4L2_ARGUS_AWB_MODE_DAYLIGHT = 6,
  2259. V4L2_ARGUS_AWB_MODE_CLOUDY_DAYLIGHT = 7,
  2260. V4L2_ARGUS_AWB_MODE_TWILIGHT = 8,
  2261. V4L2_ARGUS_AWB_MODE_SHADE = 9,
  2262. V4L2_ARGUS_AWB_MODE_MANUAL = 10,
  2263. };
  2264. /**
  2265. * Enum specifying types of AE states.
  2266. */
  2267. enum v4l2_argus_ae_state {
  2268. V4L2_ARGUS_AeState_Unknown = 0,
  2269. V4L2_ARGUS_AE_STATE_INACTIVE = 1,
  2270. V4L2_ARGUS_AE_STATE_SEARCHING = 2,
  2271. V4L2_ARGUS_AE_STATE_CONVERGED = 3,
  2272. V4L2_ARGUS_AE_STATE_FLASH_REQUIRED = 4,
  2273. V4L2_ARGUS_AE_STATE_TIMEOUT = 5,
  2274. };
  2275. /**
  2276. * Enum specifying types of AWB states.
  2277. */
  2278. enum v4l2_argus_awb_state {
  2279. V4L2_ARGUS_AwbState_Unknown = 0,
  2280. V4L2_ARGUS_AWB_STATE_INACTIVE = 1,
  2281. V4L2_ARGUS_AWB_STATE_SEARCHING = 2,
  2282. V4L2_ARGUS_AWB_STATE_CONVERGED = 3,
  2283. V4L2_ARGUS_AWB_STATE_LOCKED = 4,
  2284. };
  2285. /**
  2286. * Holds the strength value for denoise operation.
  2287. *
  2288. * Must be used with #V4L2_CID_ARGUS_DENOISE_STRENGTH ioctl.
  2289. */
  2290. typedef struct _v4l2_argus_denoise_strength
  2291. {
  2292. /** Denoise Strength. Range: {-1.0f, 1.0f} **/
  2293. float DenoiseStrength;
  2294. }v4l2_argus_denoise_strength;
  2295. /**
  2296. * Holds the strength value for edge enhancement operation.
  2297. *
  2298. * Must be used with #V4L2_CID_ARGUS_EE_STRENGTH ioctl.
  2299. */
  2300. typedef struct _v4l2_argus_edge_enhance_strength
  2301. {
  2302. /** Edge Enhance Strength. Range: {-1.0f, 1.0f} **/
  2303. float EdgeEnhanceStrength;
  2304. }v4l2_argus_edge_enhance_strength;
  2305. /**
  2306. * Holds the value for exposure compensation.
  2307. *
  2308. * Must be used with #V4L2_CID_ARGUS_EXPOSURE_COMPENSATION ioctl.
  2309. */
  2310. typedef struct _v4l2_argus_exposure_compensation
  2311. {
  2312. /** Exposure Compensation. Range: {-2.0f, 2.0f} **/
  2313. float ExposureCompensation;
  2314. }v4l2_argus_exposure_compensation;
  2315. /**
  2316. * Holds the value for Isp Digital gain range.
  2317. *
  2318. * Must be used with #V4L2_CID_ARGUS_ISP_DIGITAL_GAIN_RANGE ioctl.
  2319. */
  2320. typedef struct _v4l2_argus_ispdigital_gainrange
  2321. {
  2322. /** Range: {1, 256} **/
  2323. /** Digital Gain Range start limit **/
  2324. float MinISPDigitalGainRange;
  2325. /** Digital Gain Range end limit **/
  2326. float MaxISPDigitalGainRange;
  2327. }v4l2_argus_ispdigital_gainrange;
  2328. /**
  2329. * Holds the value for absolute color saturation.
  2330. *
  2331. * Must be used with #V4L2_CID_ARGUS_COLOR_SATURATION ioctl.
  2332. */
  2333. typedef struct _v4l2_argus_color_saturation
  2334. {
  2335. /** Boolean value to indicate enable of user-specified absolute color saturation **/
  2336. __u8 EnableSaturation;
  2337. /** Specified absolute color saturation **/
  2338. float ColorSaturation;
  2339. }v4l2_argus_color_saturation;
  2340. /**
  2341. * Holds the value for gain range.
  2342. *
  2343. * Must be used with #V4L2_CID_ARGUS_GAIN_RANGE ioctl.
  2344. */
  2345. typedef struct _v4l2_argus_gainrange
  2346. {
  2347. /** Analog Gain Range start limit **/
  2348. float MinGainRange;
  2349. /** Analog Gain Range end limit **/
  2350. float MaxGainRange;
  2351. }v4l2_argus_gainrange;
  2352. /**
  2353. * Holds the value for exposure range.
  2354. *
  2355. * Must be used with #V4L2_CID_ARGUS_EXPOSURE_TIME_RANGE ioctl.
  2356. */
  2357. typedef struct _v4l2_argus_exposure_timerange
  2358. {
  2359. /** Exposure Time Range start limit **/
  2360. __u64 MinExposureTimeRange;
  2361. /** Exposure Time Range end limit **/
  2362. __u64 MaxExposureTimeRange;
  2363. }v4l2_argus_exposure_timerange;
  2364. /**
  2365. * Holds the value for camera output metadata.
  2366. *
  2367. * Must be used with #V4L2_CID_ARGUS_METADATA ioctl.
  2368. */
  2369. typedef struct _v4l2_argus_ctrl_metadata
  2370. {
  2371. /** Boolean value to indicate if AE was locked for this capture **/
  2372. __u8 AeLocked;
  2373. /** Boolean value to indicate if metadata has valid contents **/
  2374. __u8 ValidFrameStatus;
  2375. /** Index of the buffer captured **/
  2376. __u32 BufferIndex;
  2377. /** Focuser Position used for capture**/
  2378. __u32 FocuserPosition;
  2379. /** CCT value calculated by AWB **/
  2380. __u32 AwbCCT;
  2381. /** ISO value used for capture **/
  2382. __u32 SensorSensitivity;
  2383. /** Time (nanoseconds) taken to integrate the capture **/
  2384. __u64 FrameDuration;
  2385. /** Frame readout time for the capture **/
  2386. __u64 FrameReadoutTime;
  2387. /** Sensor Exposure time value for the capture **/
  2388. __u64 SensorExposureTime;
  2389. /** ISP Digital gain value for the capture **/
  2390. float IspDigitalGain;
  2391. /** Estimated scene brightness for the capture **/
  2392. float SceneLux;
  2393. /** Sensor analog gain for the capture **/
  2394. float SensorAnalogGain;
  2395. /** AE state ran for capture **/
  2396. enum v4l2_argus_ae_state AEState;
  2397. /** AWB state ran for capture **/
  2398. enum v4l2_argus_awb_state AWBState;
  2399. }v4l2_argus_ctrl_metadata;
  2400. /** @} */
  2401. /** @addtogroup V4L2Conv */
  2402. /** @{ */
  2403. /**
  2404. * Enum specifying types of buffer layouts.
  2405. */
  2406. enum v4l2_nv_buffer_layout {
  2407. V4L2_NV_BUFFER_LAYOUT_PITCH = 0, /**< Pitch Linear Layout. */
  2408. V4L2_NV_BUFFER_LAYOUT_BLOCKLINEAR = 1, /**< Block Linear Layout. */
  2409. };
  2410. /**
  2411. * Specifies the types of rotation/flip algorithms.
  2412. */
  2413. enum v4l2_flip_method {
  2414. V4L2_FLIP_METHOD_IDENTITY = 0, /**< Identity (no rotation). */
  2415. V4L2_FLIP_METHOD_90L = 1, /**< Rotate counter-clockwise 90 degrees. */
  2416. V4L2_FLIP_METHOD_180 = 2, /**< Rotate 180 degrees. */
  2417. V4L2_FLIP_METHOD_90R = 3, /**< Rotate clockwise 90 degrees. */
  2418. V4L2_FLIP_METHOD_HORIZ = 4, /**< Flip horizontally. */
  2419. V4L2_FLIP_METHOD_INVTRANS = 5, /**< Flip across upper right/lower left diagonal. */
  2420. V4L2_FLIP_METHOD_VERT = 6, /**< Flip vertically. */
  2421. V4L2_FLIP_METHOD_TRANS = 7, /**< Flip across upper left/lower right diagonal. */
  2422. };
  2423. /**
  2424. * Specifies the types of interpolation methods.
  2425. */
  2426. enum v4l2_interpolation_method {
  2427. V4L2_INTERPOLATION_NEAREST = 1, /**< Nearest interpolation method */
  2428. V4L2_INTERPOLATION_BILINEAR = 2, /**< Bi-Linear interpolation method */
  2429. V4L2_INTERPOLATION_5_TAP = 3, /**< 5-Tap interpolation method */
  2430. V4L2_INTERPOLATION_10_TAP = 4, /**< 10-Tap interpolation method */
  2431. V4L2_INTERPOLATION_SMART = 5, /**< Smart interpolation method */
  2432. V4L2_INTERPOLATION_NICEST = 6, /**< Nicest interpolation method */
  2433. };
  2434. /**
  2435. * Specifies the types of TNR algorithms.
  2436. */
  2437. enum v4l2_tnr_algorithm {
  2438. V4L2_TNR_ALGO_ORIGINAL = 0, /**< Default TNR algorithm. */
  2439. V4L2_TNR_ALGO_OUTDOOR_LOW_LIGHT = 1, /**< Outdoor Low Light TNR algorithm. */
  2440. V4L2_TNR_ALGO_OUTDOOR_MEDIUM_LIGHT = 2, /**< Outdoor Medium Light TNR algorithm. */
  2441. V4L2_TNR_ALGO_OUTDOOR_HIGH_LIGHT = 3, /**< Outdoor High Light TNR algorithm. */
  2442. V4L2_TNR_ALGO_INDOOR_LOW_LIGHT = 4, /**< Indoor Low Light TNR algorithm. */
  2443. V4L2_TNR_ALGO_INDOOR_MEDIUM_LIGHT = 5, /**< Indoor Medium Light TNR algorithm. */
  2444. V4L2_TNR_ALGO_INDOOR_HIGH_LIGHT = 6, /**< Indoor High Light TNR algorithm. */
  2445. };
  2446. /**
  2447. * Specifies the types of YUV rescale methods.
  2448. */
  2449. enum v4l2_yuv_rescale_method {
  2450. /**< Disable */
  2451. V4L2_YUV_RESCALE_NONE = 0,
  2452. /**< Standard(limited range [16 235]) to extension(full range [0 255]) */
  2453. V4L2_YUV_RESCALE_STD_TO_EXT = 1,
  2454. /**< Extension(full range [0 255] to standard(limited range [16 235]) */
  2455. V4L2_YUV_RESCALE_EXT_TO_STD = 2,
  2456. };
  2457. typedef struct v4l2_ctrl_video_displaydata_
  2458. {
  2459. __u32 masteringdisplaydatapresent;
  2460. }v4l2_ctrl_video_displaydata;
  2461. /**
  2462. * HDR Metadata.
  2463. */
  2464. typedef struct _v4l2_ctrl_video_hdrmasteringdisplaydata
  2465. {
  2466. // idx 0 : G, 1 : B, 2 : R
  2467. __u16 display_primaries_x[3]; // normalized x chromaticity cordinate. It shall be in the range of 0 to 50000
  2468. __u16 display_primaries_y[3]; // normalized y chromaticity cordinate. It shall be in the range of 0 to 50000
  2469. __u16 white_point_x; // normalized x chromaticity cordinate of white point of mastering display
  2470. __u16 white_point_y; // normalized y chromaticity cordinate of white point of mastering display
  2471. __u32 max_display_parameter_luminance; // nominal maximum display luminance in units of 0.0001 candelas per square metre
  2472. __u32 min_display_parameter_luminance; // nominal minimum display luminance in units of 0.0001 candelas per square metre
  2473. } v4l2_ctrl_video_hdrmasteringdisplaydata;
  2474. /**
  2475. * Poll device
  2476. */
  2477. typedef struct _v4l2_ctrl_video_device_poll
  2478. {
  2479. __u16 req_events; // Requested events, a bitmask of POLLIN, POLLOUT, POLLERR, POLLPRI.
  2480. __u16 resp_events; // Returned events a similar bitmask of above events.
  2481. } v4l2_ctrl_video_device_poll;
  2482. /** @} */
  2483. #endif /*__V4L2_NV_EXTENSIONS_H__*/