v4l2_nv_extensions.h 90 KB

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