00001 /* 00002 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions 00006 * are met: 00007 * 1. Redistributions of source code must retain the above copyright 00008 * notice, this list of conditions and the following disclaimer. 00009 * 2. Redistributions in binary form must reproduce the above copyright 00010 * notice, this list of conditions and the following disclaimer in 00011 * the documentation and/or other materials provided with the 00012 * distribution. 00013 * 3. The names of its contributors may not be used to endorse or promote 00014 * products derived from this software without specific prior written 00015 * permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00018 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00019 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00020 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00021 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00022 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00023 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00024 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00025 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00026 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00027 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 /* This file contains amendments to the V4L2 headers made after the 00031 * supported kernel version and NVIDIA extensions. 00032 */ 00033 00034 #ifndef __V4L2_NV_EXTENSIONS_H__ 00035 #define __V4L2_NV_EXTENSIONS_H__ 00036 00037 /** 00038 * @file 00039 * <b>NVIDIA V4L2 API Extensions</b> 00040 * 00041 * @b Description: This file declares the NVIDIA V4L2 Extensions, 00042 * controls and structures. 00043 */ 00044 00045 /** 00046 * V4L2 pixel format for H265 00047 */ 00048 #define V4L2_PIX_FMT_H265 v4l2_fourcc('H', '2', '6', '5') 00049 00050 /** @cond UNUSED */ 00051 00052 #define V4L2_PIX_FMT_YUV444M v4l2_fourcc('Y', 'M', '4', '4') 00053 #define V4L2_PIX_FMT_YUV422M v4l2_fourcc('4', '2', '2', 'M') 00054 #define V4L2_PIX_FMT_YUV422RM v4l2_fourcc('4', '2', 'R', 'M') 00055 00056 #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */ 00057 #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') /* VP8 parsed frames */ 00058 00059 #define V4L2_CTRL_FLAG_CAN_STORE 0x0200 00060 00061 /** @endcond */ 00062 00063 /** 00064 * V4L2 event type for decoder resolution event change 00065 */ 00066 #define V4L2_EVENT_RESOLUTION_CHANGE 5 00067 00068 /** @cond UNUSED */ 00069 00070 /*---------------Below are changes from the v4l2-controls.h----------------------*/ 00071 00072 #define V4L2_CID_MPEG_VIDEO_H264_SPS (V4L2_CID_MPEG_BASE+383) 00073 #define V4L2_CID_MPEG_VIDEO_H264_PPS (V4L2_CID_MPEG_BASE+384) 00074 #define V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX (V4L2_CID_MPEG_BASE+385) 00075 #define V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAM (V4L2_CID_MPEG_BASE+386) 00076 #define V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAM (V4L2_CID_MPEG_BASE+387) 00077 00078 #define V4L2_CID_MPEG_VIDEO_VP8_FRAME_HDR (V4L2_CID_MPEG_BASE+512) 00079 00080 /** @endcond */ 00081 00082 /** 00083 * Control ID to set the H.265 encoder profile. 00084 * 00085 * One of #v4l2_mpeg_video_h265_profile should be passed. 00086 */ 00087 #define V4L2_CID_MPEG_VIDEO_H265_PROFILE (V4L2_CID_MPEG_BASE+513) 00088 00089 /** 00090 * Enum containing the possible profiles for H.265 encoder. 00091 */ 00092 enum v4l2_mpeg_video_h265_profile { 00093 /** H.265 Main profile */ 00094 V4L2_MPEG_VIDEO_H265_PROFILE_MAIN = 0, 00095 /** H.265 Main10 profile */ 00096 V4L2_MPEG_VIDEO_H265_PROFILE_MAIN10 = 1, 00097 /** H.265 MainStillPicture profile */ 00098 V4L2_MPEG_VIDEO_H265_PROFILE_MAINSTILLPICTURE = 2, 00099 }; 00100 00101 /** 00102 * Control ID to set the encoder IDR frame interval. 00103 * Should be used with VIDIOC_S_EXT_CTRLS ioctl. 00104 */ 00105 #define V4L2_CID_MPEG_VIDEO_IDR_INTERVAL (V4L2_CID_MPEG_BASE+514) 00106 00107 /** @cond UNUSED */ 00108 00109 /* Complex controls */ 00110 00111 #define V4L2_H264_SPS_CONSTRAINT_SET0_FLAG 0x01 00112 #define V4L2_H264_SPS_CONSTRAINT_SET1_FLAG 0x02 00113 #define V4L2_H264_SPS_CONSTRAINT_SET2_FLAG 0x04 00114 #define V4L2_H264_SPS_CONSTRAINT_SET3_FLAG 0x08 00115 #define V4L2_H264_SPS_CONSTRAINT_SET4_FLAG 0x10 00116 #define V4L2_H264_SPS_CONSTRAINT_SET5_FLAG 0x20 00117 00118 #define V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE 0x01 00119 #define V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS 0x02 00120 #define V4L2_H264_SPS_FLAG_DELTA_PIC_ORDER_ALWAYS_ZERO 0x04 00121 #define V4L2_H264_SPS_FLAG_GAPS_IN_FRAME_NUM_VALUE_ALLOWED 0x08 00122 #define V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY 0x10 00123 #define V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD 0x20 00124 #define V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE 0x40 00125 struct v4l2_ctrl_h264_sps { 00126 __u8 profile_idc; 00127 __u8 constraint_set_flags; 00128 __u8 level_idc; 00129 __u8 seq_parameter_set_id; 00130 __u8 chroma_format_idc; 00131 __u8 bit_depth_luma_minus8; 00132 __u8 bit_depth_chroma_minus8; 00133 __u8 log2_max_frame_num_minus4; 00134 __u8 pic_order_cnt_type; 00135 __u8 log2_max_pic_order_cnt_lsb_minus4; 00136 __s32 offset_for_non_ref_pic; 00137 __s32 offset_for_top_to_bottom_field; 00138 __u8 num_ref_frames_in_pic_order_cnt_cycle; 00139 __s32 offset_for_ref_frame[255]; 00140 __u8 max_num_ref_frames; 00141 __u16 pic_width_in_mbs_minus1; 00142 __u16 pic_height_in_map_units_minus1; 00143 __u8 flags; 00144 }; 00145 00146 #define V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE 0x0001 00147 #define V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT 0x0002 00148 #define V4L2_H264_PPS_FLAG_WEIGHTED_PRED 0x0004 00149 #define V4L2_H264_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT 0x0008 00150 #define V4L2_H264_PPS_FLAG_CONSTRAINED_INTRA_PRED 0x0010 00151 #define V4L2_H264_PPS_FLAG_REDUNDANT_PIC_CNT_PRESENT 0x0020 00152 #define V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE 0x0040 00153 #define V4L2_H264_PPS_FLAG_PIC_SCALING_MATRIX_PRESENT 0x0080 00154 struct v4l2_ctrl_h264_pps { 00155 __u8 pic_parameter_set_id; 00156 __u8 seq_parameter_set_id; 00157 __u8 num_slice_groups_minus1; 00158 __u8 num_ref_idx_l0_default_active_minus1; 00159 __u8 num_ref_idx_l1_default_active_minus1; 00160 __u8 weighted_bipred_idc; 00161 __s8 pic_init_qp_minus26; 00162 __s8 pic_init_qs_minus26; 00163 __s8 chroma_qp_index_offset; 00164 __s8 second_chroma_qp_index_offset; 00165 __u8 flags; 00166 }; 00167 00168 struct v4l2_ctrl_h264_scaling_matrix { 00169 __u8 scaling_list_4x4[6][16]; 00170 __u8 scaling_list_8x8[6][64]; 00171 }; 00172 00173 struct v4l2_h264_weight_factors { 00174 __s8 luma_weight[32]; 00175 __s8 luma_offset[32]; 00176 __s8 chroma_weight[32][2]; 00177 __s8 chroma_offset[32][2]; 00178 }; 00179 00180 struct v4l2_h264_pred_weight_table { 00181 __u8 luma_log2_weight_denom; 00182 __u8 chroma_log2_weight_denom; 00183 struct v4l2_h264_weight_factors weight_factors[2]; 00184 }; 00185 00186 #define V4L2_SLICE_FLAG_FIELD_PIC 0x01 00187 #define V4L2_SLICE_FLAG_BOTTOM_FIELD 0x02 00188 #define V4L2_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x04 00189 #define V4L2_SLICE_FLAG_SP_FOR_SWITCH 0x08 00190 struct v4l2_ctrl_h264_slice_param { 00191 /* Size in bytes, including header */ 00192 __u32 size; 00193 /* Offset in bits to slice_data() from the beginning of this slice. */ 00194 __u32 header_bit_size; 00195 00196 __u16 first_mb_in_slice; 00197 __u8 slice_type; 00198 __u8 pic_parameter_set_id; 00199 __u8 colour_plane_id; 00200 __u16 frame_num; 00201 __u16 idr_pic_id; 00202 __u16 pic_order_cnt_lsb; 00203 __s32 delta_pic_order_cnt_bottom; 00204 __s32 delta_pic_order_cnt0; 00205 __s32 delta_pic_order_cnt1; 00206 __u8 redundant_pic_cnt; 00207 00208 struct v4l2_h264_pred_weight_table pred_weight_table; 00209 /* Size in bits of dec_ref_pic_marking() syntax element. */ 00210 __u32 dec_ref_pic_marking_bit_size; 00211 /* Size in bits of pic order count syntax. */ 00212 __u32 pic_order_cnt_bit_size; 00213 00214 __u8 cabac_init_idc; 00215 __s8 slice_qp_delta; 00216 __s8 slice_qs_delta; 00217 __u8 disable_deblocking_filter_idc; 00218 __s8 slice_alpha_c0_offset_div2; 00219 __s8 slice_beta_offset_div2; 00220 __u32 slice_group_change_cycle; 00221 00222 __u8 num_ref_idx_l0_active_minus1; 00223 __u8 num_ref_idx_l1_active_minus1; 00224 /* Entries on each list are indices 00225 * into v4l2_ctrl_h264_decode_param.dpb[]. */ 00226 __u8 ref_pic_list0[32]; 00227 __u8 ref_pic_list1[32]; 00228 00229 __u8 flags; 00230 }; 00231 00232 /* If not set, this entry is unused for reference. */ 00233 #define V4L2_H264_DPB_ENTRY_FLAG_ACTIVE 0x01 00234 #define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM 0x02 00235 struct v4l2_h264_dpb_entry { 00236 __u32 buf_index; /* v4l2_buffer index */ 00237 __u16 frame_num; 00238 __u16 pic_num; 00239 /* Note that field is indicated by v4l2_buffer.field */ 00240 __s32 top_field_order_cnt; 00241 __s32 bottom_field_order_cnt; 00242 __u8 flags; /* V4L2_H264_DPB_ENTRY_FLAG_* */ 00243 }; 00244 00245 struct v4l2_ctrl_h264_decode_param { 00246 __u32 num_slices; 00247 __u8 idr_pic_flag; 00248 __u8 nal_ref_idc; 00249 __s32 top_field_order_cnt; 00250 __s32 bottom_field_order_cnt; 00251 __u8 ref_pic_list_p0[32]; 00252 __u8 ref_pic_list_b0[32]; 00253 __u8 ref_pic_list_b1[32]; 00254 struct v4l2_h264_dpb_entry dpb[16]; 00255 }; 00256 00257 #define V4L2_VP8_SEGMNT_HDR_FLAG_ENABLED 0x01 00258 #define V4L2_VP8_SEGMNT_HDR_FLAG_UPDATE_MAP 0x02 00259 #define V4L2_VP8_SEGMNT_HDR_FLAG_UPDATE_FEATURE_DATA 0x04 00260 struct v4l2_vp8_sgmnt_hdr { 00261 __u8 segment_feature_mode; 00262 00263 __s8 quant_update[4]; 00264 __s8 lf_update[4]; 00265 __u8 segment_probs[3]; 00266 00267 __u8 flags; 00268 }; 00269 00270 #define V4L2_VP8_LF_HDR_ADJ_ENABLE 0x01 00271 #define V4L2_VP8_LF_HDR_DELTA_UPDATE 0x02 00272 struct v4l2_vp8_loopfilter_hdr { 00273 __u8 type; 00274 __u8 level; 00275 __u8 sharpness_level; 00276 __s8 ref_frm_delta_magnitude[4]; 00277 __s8 mb_mode_delta_magnitude[4]; 00278 00279 __u8 flags; 00280 }; 00281 00282 struct v4l2_vp8_quantization_hdr { 00283 __u8 y_ac_qi; 00284 __s8 y_dc_delta; 00285 __s8 y2_dc_delta; 00286 __s8 y2_ac_delta; 00287 __s8 uv_dc_delta; 00288 __s8 uv_ac_delta; 00289 __u16 dequant_factors[4][3][2]; 00290 }; 00291 00292 struct v4l2_vp8_entropy_hdr { 00293 __u8 coeff_probs[4][8][3][11]; 00294 __u8 y_mode_probs[4]; 00295 __u8 uv_mode_probs[3]; 00296 __u8 mv_probs[2][19]; 00297 }; 00298 00299 #define V4L2_VP8_FRAME_HDR_FLAG_EXPERIMENTAL 0x01 00300 #define V4L2_VP8_FRAME_HDR_FLAG_SHOW_FRAME 0x02 00301 #define V4L2_VP8_FRAME_HDR_FLAG_MB_NO_SKIP_COEFF 0x04 00302 struct v4l2_ctrl_vp8_frame_hdr { 00303 /* 0: keyframe, 1: not a keyframe */ 00304 __u8 key_frame; 00305 __u8 version; 00306 00307 /* Populated also if not a key frame */ 00308 __u16 width; 00309 __u8 horizontal_scale; 00310 __u16 height; 00311 __u8 vertical_scale; 00312 00313 struct v4l2_vp8_sgmnt_hdr sgmnt_hdr; 00314 struct v4l2_vp8_loopfilter_hdr lf_hdr; 00315 struct v4l2_vp8_quantization_hdr quant_hdr; 00316 struct v4l2_vp8_entropy_hdr entropy_hdr; 00317 00318 __u8 sign_bias_golden; 00319 __u8 sign_bias_alternate; 00320 00321 __u8 prob_skip_false; 00322 __u8 prob_intra; 00323 __u8 prob_last; 00324 __u8 prob_gf; 00325 00326 __u32 first_part_size; 00327 __u32 first_part_offset; 00328 /* 00329 * Offset in bits of MB data in first partition, 00330 * i.e. bit offset starting from first_part_offset. 00331 */ 00332 __u32 macroblock_bit_offset; 00333 00334 __u8 num_dct_parts; 00335 __u32 dct_part_sizes[8]; 00336 00337 __u8 bool_dec_range; 00338 __u8 bool_dec_value; 00339 __u8 bool_dec_count; 00340 00341 /* v4l2_buffer indices of reference frames */ 00342 __u32 last_frame; 00343 __u32 golden_frame; 00344 __u32 alt_frame; 00345 00346 __u8 flags; 00347 }; 00348 00349 /** @endcond */ 00350 00351 /*---------------Add below NVIDIA specific extensions ----------------------*/ 00352 00353 /** 00354 * @defgroup V4L2Dec V4L2 Video Decoder 00355 * 00356 * @brief NVIDIA Tegra V4L2 Video Decoder Description and Extensions 00357 * 00358 * The video decoder device node is \b "/dev/nvhost-nvdec". 00359 * 00360 * ### Supported pixelformats: 00361 * OUTPUT PLANE | CAPTURE PLANE 00362 * :----------------: | :----------------: 00363 * V4L2_PIX_FMT_H264 | V4L2_PIX_FMT_NV12M 00364 * V4L2_PIX_FMT_H265 | V4L2_PIX_FMT_NV12M 00365 * 00366 * ### Supported memory types: 00367 * MEMORY | OUTPUT PLANE | CAPTURE PLANE 00368 * :------------------: | :----------: | :-----------: 00369 * V4L2_MEMORY_MMAP | Y | Y 00370 * V4L2_MEMORY_DMABUF | N | N 00371 * V4L2_MEMORY_USERPTR | N | N 00372 * 00373 * ### Supported controls: 00374 * - #V4L2_CID_MPEG_VIDEO_DISABLE_COMPLETE_FRAME_INPUT 00375 * - #V4L2_CID_MPEG_VIDEO_DISABLE_DPB 00376 * - #V4L2_CID_MPEG_VIDEO_ERROR_REPORTING 00377 * - #V4L2_CID_MPEG_VIDEO_SKIP_FRAMES 00378 * - V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (Get the minimum buffers to be allocated on capture plane. 00379 * Read only. Valid after #V4L2_EVENT_RESOLUTION_CHANGE) 00380 * - #V4L2_CID_MPEG_VIDEODEC_METADATA 00381 * 00382 * ### Supported events: 00383 * Event | Purpose 00384 * ----------------------------- | :----------------------------: 00385 * #V4L2_EVENT_RESOLUTION_CHANGE | Resolution of the stream has changed. 00386 * 00387 * 00388 * ### Handling resolution change events: 00389 * When the decoder generates a V4L2_EVENT_RESOLUTION_CHANGE event, the 00390 * application should call STREAMOFF on the capture plane, tell decoder to 00391 * deallocate the current buffers by calling REQBUF with \a count zero, get 00392 * the new capture plane format, and then proceed with setting up the buffers 00393 * for the capture plane. 00394 * 00395 * In case of decoder, the buffer format might differ from the Display resolution. 00396 * The application should use \b VIDIOC_G_CROP to get the display resolution. 00397 * 00398 * ### EOS Handling: 00399 * Following sequence should be followed for sending EOS and recieving EOS 00400 * from the decoder. 00401 * -# Send EOS to decoder by queueing on the output plane a buffer with 00402 * bytesused = 0 for the 0th plane (`v4l2_buffer.m.planes[0].bytesused = 0`). 00403 * -# Dequeue buffers on the output plane, till it gets a buffer with bytesused = 0 00404 * for the 0th plane (`v4l2_buffer.m.planes[0].bytesused == 0`) 00405 * -# Dequeue buffers on the capture plane, till it gets a buffer with bytesused = 0 00406 * for the 0th plane. 00407 * 00408 * ### Decoder output frame metadata: 00409 * Decoder supports reporting frame related metadata including error reports and 00410 * DPB info. See #V4L2_CID_MPEG_VIDEO_ERROR_REPORTING, #V4L2_CID_MPEG_VIDEODEC_METADATA 00411 * and #v4l2_ctrl_video_metadata for more information. 00412 */ 00413 /** @{ */ 00414 00415 /** 00416 * Control ID to indicate to the decoder that the input buffers will not contain 00417 * complete buffers. 00418 * 00419 * @note This control should be set in case of frames containing multiple slices 00420 * when the input buffers do not contain all the slices of the frame. 00421 * 00422 * A boolean value should be supplied with this control. 00423 * 00424 * @attention This control should be set before setting formats on either plane. 00425 */ 00426 #define V4L2_CID_MPEG_VIDEO_DISABLE_COMPLETE_FRAME_INPUT (V4L2_CID_MPEG_BASE+515) 00427 00428 /** 00429 * Control ID to disable decoder DPB management. 00430 * 00431 * @note This will only work for streams having a single reference frame. 00432 * 00433 * A boolean value should be supplied with this control. 00434 * 00435 * @attention This control should be set after setting formats on both the planes 00436 * and before requesting buffers on either plane. 00437 */ 00438 #define V4L2_CID_MPEG_VIDEO_DISABLE_DPB (V4L2_CID_MPEG_BASE+516) 00439 00440 /** 00441 * Control ID to enable decoder error and metadata reporting. 00442 * 00443 * A boolean value should be supplied with this control. 00444 * 00445 * @attention This control should be set after setting formats on both the planes 00446 * and before requesting buffers on either plane. 00447 */ 00448 #define V4L2_CID_MPEG_VIDEO_ERROR_REPORTING (V4L2_CID_MPEG_BASE+517) 00449 00450 /** 00451 * Control ID to set the skip frames property of the decoder. 00452 * 00453 * Decoder can be configured to skip certain types of frames. One of 00454 * #v4l2_skip_frames_type should be passed. 00455 * 00456 * @attention This control should be set after setting formats on both the planes 00457 * and before requesting buffers on either plane. 00458 * This control ID is supported only for H264. 00459 */ 00460 #define V4L2_CID_MPEG_VIDEO_SKIP_FRAMES (V4L2_CID_MPEG_BASE+518) 00461 00462 /** 00463 * Control ID to get the decoder output metadata. 00464 * 00465 * @note Metadata reporting should be enabled using 00466 * #V4L2_CID_MPEG_VIDEO_ERROR_REPORTING ioctl for this. 00467 * 00468 * A pointer to a valid #v4l2_ctrl_video_metadata structure should be supplied 00469 * with this control. 00470 * 00471 * @attention This control should be read after dequeueing a buffer successfully from 00472 * the capture plane. The values in the structure are valid till the buffer is queued 00473 * again. 00474 */ 00475 #define V4L2_CID_MPEG_VIDEODEC_METADATA (V4L2_CID_MPEG_BASE+519) 00476 00477 /** @} */ 00478 00479 /** 00480 * @defgroup V4L2Conv V4L2 Video Converter 00481 * 00482 * @brief NVIDIA Tegra V4L2 Video Converter Description and Extensions 00483 * 00484 * Video converter can be used for color space conversion, scaling and 00485 * conversion between hardware buffer memory (V4L2_MEMORY_MMAP/ 00486 * V4L2_MEMORY_DMABUF) and software buffer memory (V4L2_MEMORY_USERPTR) and 00487 * other operations such as cropping, flipping/rotating and 00488 * temporal noise reduction (TNR). 00489 * The video converter device node is \b "/dev/nvhost-vic". 00490 * 00491 * ### Supported pixelformats: 00492 * PIXEL FORMAT | PIXEL FORMAT 00493 * :---------------------: | :--------------: 00494 * V4L2_PIX_FMT_YUV444M | V4L2_PIX_FMT_YVU422M 00495 * V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_YVU420M 00496 * V4L2_PIX_FMT_NV12M | V4L2_PIX_FMT_GREY 00497 * V4L2_PIX_FMT_YUYV | V4L2_PIX_FMT_YVYU 00498 * V4L2_PIX_FMT_UYVY | V4L2_PIX_FMT_VYUY 00499 * V4L2_PIX_FMT_ABGR32 | V4L2_PIX_FMT_XBGR32 00500 * 00501 * ### Supported pixelformats for TNR: 00502 * PIXEL FORMAT | PIXEL FORMAT 00503 * :---------------------: | :--------------: 00504 * V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_NV12M 00505 * V4L2_PIX_FMT_UYVY | V4L2_PIX_FMT_YUYV 00506 * 00507 * ### Supported memory types: 00508 * MEMORY | OUTPUT PLANE | CAPTURE PLANE 00509 * :------------------: | :----------: | :-----------: 00510 * V4L2_MEMORY_MMAP | Y | Y 00511 * V4L2_MEMORY_DMABUF | Y | Y 00512 * V4L2_MEMORY_USERPTR | Y | Y 00513 * 00514 * ### Supported controls: 00515 * - #V4L2_CID_VIDEO_CONVERT_OUTPUT_PLANE_LAYOUT 00516 * - #V4L2_CID_VIDEO_CONVERT_CAPTURE_PLANE_LAYOUT 00517 * - #V4L2_CID_VIDEO_CONVERT_FLIP_METHOD 00518 * - #V4L2_CID_VIDEO_CONVERT_INTERPOLATION_METHOD 00519 * - #V4L2_CID_VIDEO_CONVERT_TNR_ALGORITHM 00520 * 00521 * ### Cropping: 00522 * Video converter supports cropping using VIDIOC_S_SELECTION ioctl with type 00523 * @a V4L2_BUF_TYPE_VIDEO_CAPTURE and target @a V4L2_SEL_TGT_CROP. This should 00524 * be set before requesting buffers on either plane. 00525 * 00526 * ### EOS Handling: 00527 * Following sequence should be followed for sending EOS and recieving EOS 00528 * from the converter. 00529 * -# Send EOS to converter by queueing on the output plane a buffer with 00530 * bytesused = 0 for the 0th plane (`v4l2_buffer.m.planes[0].bytesused = 0`). 00531 * -# Dequeue buffers on the capture plane, till it gets a buffer with bytesused = 0 00532 * for the 0th plane. 00533 */ 00534 /** @{ */ 00535 00536 /** 00537 * Control ID to set converter output plane buffer layout. 00538 * 00539 * A value of type #v4l2_nv_buffer_layout should be supplied with this control. 00540 * 00541 * @attention This control should be set before requesting buffers on the output plane. 00542 */ 00543 #define V4L2_CID_VIDEO_CONVERT_OUTPUT_PLANE_LAYOUT (V4L2_CID_MPEG_BASE+520) 00544 00545 /** 00546 * Control ID to set converter capture plane buffer layout. 00547 * 00548 * A value of type #v4l2_nv_buffer_layout should be supplied with this control. 00549 * 00550 * @attention This control should be set before requesting buffers on the capture plane. 00551 */ 00552 #define V4L2_CID_VIDEO_CONVERT_CAPTURE_PLANE_LAYOUT (V4L2_CID_MPEG_BASE+521) 00553 00554 /** 00555 * Control ID to set the converter flip/rotation method. 00556 * 00557 * A value of type #v4l2_flip_method should be supplied with this control. 00558 * 00559 * @attention This control should be set before requesting buffers on either plane. 00560 */ 00561 #define V4L2_CID_VIDEO_CONVERT_FLIP_METHOD (V4L2_CID_MPEG_BASE+522) 00562 00563 /** 00564 * Control ID to set the converter interpolation method. 00565 * 00566 * A value of type #v4l2_interpolation_method should be supplied with this control. 00567 * 00568 * @attention This control should be set before requesting buffers on either plane. 00569 */ 00570 #define V4L2_CID_VIDEO_CONVERT_INTERPOLATION_METHOD (V4L2_CID_MPEG_BASE+523) 00571 00572 /** 00573 * Control ID to set the converter Temporal Noise Reduction (TNR) Algorithm. 00574 * 00575 * A value of type #v4l2_tnr_algorithm should be supplied with this control. 00576 * 00577 * @attention This control should be set before requesting buffers on either plane. 00578 * @attention TNR algorithms are not supported with YUV422 and YUV444 capture 00579 * plane formats. 00580 */ 00581 #define V4L2_CID_VIDEO_CONVERT_TNR_ALGORITHM (V4L2_CID_MPEG_BASE+524) 00582 /** @} */ 00583 00584 /** 00585 * @defgroup V4L2Enc V4L2 Video Encoder 00586 * 00587 * @brief NVIDIA Tegra V4L2 Video Encoder Description and Extensions 00588 * 00589 * The video encoder device node is \b "/dev/nvhost-msenc". 00590 * 00591 * ### Supported pixelformats: 00592 00593 * OUTPUT PLANE | CAPTURE PLANE 00594 * :---------------------: | :-------------- 00595 * V4L2_PIX_FMT_YUV420M | V4L2_PIX_FMT_H264 00596 * - | V4L2_PIX_FMT_H265 00597 * 00598 * ### Supported memory types: 00599 00600 * MEMORY | OUTPUT PLANE | CAPTURE PLANE 00601 * :------------------: | :----------: | :-----------: 00602 * V4L2_MEMORY_MMAP | Y | Y 00603 * V4L2_MEMORY_DMABUF | Y | N 00604 * V4L2_MEMORY_USERPTR | N | N 00605 * \attention For the video encoder, it is necessary that the capture plane 00606 * format be set before the output plane format and only then request buffers on 00607 * any of the planes. 00608 * 00609 * ### Supported controls: 00610 00611 * #### Controls from the open souce v4l2-controls header: 00612 * Control Id | Purpose | Runtime Configurable 00613 * -------------------------------- | -------------------- | :------------------: 00614 * V4L2_CID_MPEG_VIDEO_BITRATE | Bitrate | Y 00615 * V4L2_CID_MPEG_VIDEO_H264_PROFILE | H.264 Encode Profile | N 00616 * V4L2_CID_MPEG_VIDEO_BITRATE_MODE | Rate Control Mode | N 00617 * V4L2_CID_MPEG_VIDEO_GOP_SIZE | I-frame Interval | N 00618 * V4L2_CID_MPEG_VIDEO_H264_LEVEL | Encode Level | N 00619 * V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE | Force I-frame on one of queued output plane buffer | Y 00620 * 00621 * All non-runtime configurable options should be set after setting formats on 00622 * both the planes and before requesting buffers on either plane. 00623 * 00624 * The runtime configurable parameters can be called anytime after setting 00625 * formats on both the planes. 00626 * 00627 * #### NVidia specific controls: 00628 * - #V4L2_CID_MPEG_VIDEO_H265_PROFILE 00629 * - #V4L2_CID_MPEG_VIDEO_IDR_INTERVAL 00630 * - #V4L2_CID_MPEG_VIDEOENC_TEMPORAL_TRADEOFF_LEVEL 00631 * - #V4L2_CID_MPEG_VIDEOENC_SLICE_LENGTH_PARAM 00632 * - #V4L2_CID_MPEG_VIDEOENC_ROI_PARAMS 00633 * - #V4L2_CID_MPEG_VIDEOENC_VIRTUALBUFFER_SIZE 00634 * - #V4L2_CID_MPEG_VIDEOENC_NUM_REFERENCE_FRAMES 00635 * - #V4L2_CID_MPEG_VIDEOENC_SLICE_INTRAREFRESH_PARAM 00636 * - #V4L2_CID_MPEG_VIDEOENC_NUM_BFRAMES 00637 * - #V4L2_CID_MPEG_VIDEOENC_INSERT_SPS_PPS_AT_IDR 00638 * - #V4L2_CID_MPEG_VIDEOENC_METADATA 00639 * - #V4L2_CID_MPEG_VIDEOENC_METADATA_MV 00640 * - #V4L2_CID_MPEG_VIDEOENC_ENABLE_METADATA_MV 00641 * - #V4L2_CID_MPEG_VIDEOENC_QP_RANGE 00642 * 00643 * #### Setting Framerate: 00644 * Encoder framerate can be set with VIDIOC_S_PARM ioctl by setting the numerator 00645 * and denominator in `v4l2_streamparm.parm.output.timeperframe`. 00646 * 00647 * ### Supported Encoder Profiles: 00648 * #### H.264 00649 * - V4L2_MPEG_VIDEO_H264_PROFILE_MAIN 00650 * - V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE 00651 * - V4L2_MPEG_VIDEO_H264_PROFILE_HIGH 00652 * 00653 * #### H.265 00654 * - V4L2_MPEG_VIDEO_H265_PROFILE_MAIN 00655 * 00656 * ### Encoder output metadata: 00657 * Encoder supports reporting frame related metadata including motion vectors 00658 * for that frame. See #V4L2_CID_MPEG_VIDEOENC_METADATA, 00659 * #V4L2_CID_MPEG_VIDEOENC_METADATA_MV and #V4L2_CID_MPEG_VIDEOENC_ENABLE_METADATA_MV 00660 * for more information. 00661 * 00662 * ### EOS Handling: 00663 * Following sequence should be followed for sending EOS and recieving EOS 00664 * from the encoder. 00665 * -# Send EOS to encoder by queueing on the output plane a buffer with 00666 * bytesused = 0 for the 0th plane (`v4l2_buffer.m.planes[0].bytesused = 0`). 00667 * -# Dequeue buffers on the capture plane, till it gets a buffer with bytesused = 0 00668 * for the 0th plane. 00669 */ 00670 /** @{ */ 00671 00672 /** 00673 * Control ID to configure encoder to drop frames while encoding. 00674 * 00675 * A value of type #v4l2_enc_temporal_tradeoff_level_type should be supplied 00676 * with this control. 00677 * 00678 * @attention This control should be set after setting formats on both the planes 00679 * and before requesting buffers on either plane. 00680 */ 00681 #define V4L2_CID_MPEG_VIDEOENC_TEMPORAL_TRADEOFF_LEVEL (V4L2_CID_MPEG_BASE+525) 00682 00683 /** 00684 * Control ID to configure encoder slice length either in terms of MBs or bits. 00685 * 00686 * A pointer to a valid #v4l2_enc_slice_length_param structure should be supplied 00687 * with this control. 00688 * 00689 * @attention This control should be set after setting formats on both the planes 00690 * and before requesting buffers on either plane. 00691 */ 00692 #define V4L2_CID_MPEG_VIDEOENC_SLICE_LENGTH_PARAM (V4L2_CID_MPEG_BASE+526) 00693 00694 /** 00695 * Control ID to configure encoder to encode particular region of frame in high 00696 * quality. 00697 * 00698 * A pointer to a valid #v4l2_enc_frame_ROI_params structure should be supplied 00699 * with this control. 00700 * 00701 * @attention This control should be set after requesting buffers on both the 00702 * planes. 00703 */ 00704 #define V4L2_CID_MPEG_VIDEOENC_ROI_PARAMS (V4L2_CID_MPEG_BASE+527) 00705 00706 /** 00707 * Control ID to specify virtual buffer size in bits for encoder. 00708 * 00709 * A pointer to a valid #v4l2_enc_virtual_buffer_size structure should be 00710 * supplied with this control. 00711 * 00712 * @attention This control should be set after setting formats on both the planes 00713 * and before requesting buffers on either plane. 00714 */ 00715 #define V4L2_CID_MPEG_VIDEOENC_VIRTUALBUFFER_SIZE (V4L2_CID_MPEG_BASE+528) 00716 00717 /** 00718 * Control ID to specify maximum number of reference frames that can be used. 00719 * 00720 * An integer value should be supplied with this control. 00721 * 00722 * @attention This control should be set after setting formats on both the planes 00723 * and before requesting buffers on either plane. 00724 */ 00725 #define V4L2_CID_MPEG_VIDEOENC_NUM_REFERENCE_FRAMES (V4L2_CID_MPEG_BASE+529) 00726 00727 /** 00728 * Control ID to specify the encoder slice intra refresh interval. 00729 * 00730 * A pointer to a valid #v4l2_enc_slice_intrarefresh_param structure should be 00731 * supplied with this control. 00732 * 00733 * @attention This control should be set after setting formats on both the planes 00734 * and before requesting buffers on either plane. 00735 */ 00736 #define V4L2_CID_MPEG_VIDEOENC_SLICE_INTRAREFRESH_PARAM (V4L2_CID_MPEG_BASE+530) 00737 00738 /** 00739 * Control ID to set number of B frames to be encoded between two P frames. 00740 * 00741 * Works only with H.264 encoder. An integer value should be supplied with this 00742 * control. 00743 * 00744 * @attention This control should be set after setting formats on both the planes 00745 * and before requesting buffers on either plane. 00746 */ 00747 #define V4L2_CID_MPEG_VIDEOENC_NUM_BFRAMES (V4L2_CID_MPEG_BASE+531) 00748 00749 /** 00750 * Control ID to enable/disable inserting SPS and PPS explicitly at IDR interval. 00751 * 00752 * A boolean value should be supplied with this control. 00753 * 00754 * @attention This control should be set after setting formats on both the planes 00755 * and before requesting buffers on either plane. 00756 */ 00757 #define V4L2_CID_MPEG_VIDEOENC_INSERT_SPS_PPS_AT_IDR (V4L2_CID_MPEG_BASE+532) 00758 00759 /** 00760 * Control ID to get encoder output metadata. 00761 * 00762 * A pointer to valid #v4l2_ctrl_video_metadata structure should be supplied with 00763 * this control. 00764 * 00765 * @attention This control should be read after dequeueing a buffer successfully from 00766 * the capture plane. The values in the structure are valid till the buffer is queued 00767 * again. 00768 */ 00769 #define V4L2_CID_MPEG_VIDEOENC_METADATA (V4L2_CID_MPEG_BASE+533) 00770 00771 /** 00772 * Control ID to enable/disable encoder Motion Vector reporting. 00773 * 00774 * A boolean value should be supplied with this control. 00775 * 00776 * @attention This control should be set after setting formats on both the planes 00777 * and before requesting buffers on either plane. 00778 */ 00779 #define V4L2_CID_MPEG_VIDEOENC_ENABLE_METADATA_MV (V4L2_CID_MPEG_BASE+534) 00780 00781 /** 00782 * Control ID to get encoder output motion vector metadata. 00783 * 00784 * A pointer to valid #v4l2_ctrl_videoenc_outputbuf_metadata_MV structure should 00785 * be supplied with this control. 00786 * 00787 * @attention This control should be read after dequeueing a buffer successfully from 00788 * the capture plane. The values in the structure are valid till the buffer is queued 00789 * again. 00790 */ 00791 #define V4L2_CID_MPEG_VIDEOENC_METADATA_MV (V4L2_CID_MPEG_BASE+535) 00792 00793 /** 00794 * Control ID to set QP range for I/P/B frames 00795 * 00796 * A pointer to valid #v4l2_ctrl_video_qp_range structure should 00797 * be supplied with this control. 00798 * 00799 * @attention This control should be set after setting formats on both the planes 00800 * and before requesting buffers on either plane. 00801 */ 00802 #define V4L2_CID_MPEG_VIDEOENC_QP_RANGE (V4L2_CID_MPEG_BASE+536) 00803 /** @} */ 00804 00805 /** @addtogroup V4L2Dec */ 00806 /** @{ */ 00807 /** 00808 * Enum v4l2_skip_frames_type, possible methods for decoder skip frames. */ 00809 enum v4l2_skip_frames_type { 00810 /** Do not skip any frame */ 00811 V4L2_SKIP_FRAMES_TYPE_NONE = 0, 00812 /** Skip all non-reference frames */ 00813 V4L2_SKIP_FRAMES_TYPE_NONREF = 1, 00814 /** Skip all frames except IDR */ 00815 V4L2_SKIP_FRAMES_TYPE_DECODE_IDR_ONLY = 2, 00816 }; 00817 00818 /** 00819 * Holds the decoder error status metadata for the frame. 00820 */ 00821 typedef struct v4l2_ctrl_videodec_statusmetadata_ 00822 { 00823 /** Error types: 00824 * bit 0: Fatal 00825 * bit 1: MB level syntax 00826 * bit 2: Missing Slice(s) 00827 * bit 3: PrevFrameLostFlag */ 00828 __u32 DecodeError; 00829 /** Number of Macro blocks decoded without error */ 00830 __u32 DecodedMBs; 00831 /** Number of Macro blocks where error was concealed */ 00832 __u32 ConcealedMBs; 00833 /** POC of the reference frame used for concealment */ 00834 __u32 nConcealedFromPOC; 00835 /** Time required to decode the frame, in microseconds */ 00836 __u32 FrameDecodeTime; 00837 }v4l2_ctrl_videodec_statusmetadata; 00838 00839 /** 00840 * Holds the the frame specific metadata for a reference frame. 00841 */ 00842 typedef struct v4l2_ctrl_videodec_refframe_metadata_ 00843 { 00844 /** Boolean value indicating if the frame is present in DPB */ 00845 __u32 bPresent; 00846 /** Boolean value indicating if the frame is an IDR */ 00847 __u32 bIdrFrame; 00848 /** Boolean value indicating if the frame is a long term reference frame */ 00849 __u32 bLTRefFrame; 00850 /** Boolean value indicating if it is a predicted frame */ 00851 __u32 bPredicted; 00852 /** Picture order count of the frame */ 00853 __u32 nPictureOrderCnt; 00854 /** Frame number. Resets to zero for an IDR frame */ 00855 __u32 nFrameNum; 00856 /** Long Term Frame Index of the frame */ 00857 __u32 nLTRFrameIdx; 00858 } v4l2_ctrl_videodec_refframe_metadata; 00859 00860 /** 00861 * Holds the the frame specific metadata for the current frame. 00862 */ 00863 typedef struct v4l2_ctrl_videodec_currentframe_metadata_ 00864 { 00865 /** Boolean value indicating if the current frame is a reference frame */ 00866 __u32 bRefFrame; 00867 /** Boolean value indicating if the current frame is an IDR */ 00868 __u32 bIdrFrame; 00869 /** Boolean value indicating if the current frame is a long term reference frame */ 00870 __u32 bLTRefFrame; 00871 /** Picture order count of the current frame */ 00872 __u32 nPictureOrderCnt; 00873 /** Frame number. Resets to zero for an IDR frame */ 00874 __u32 nFrameNum; 00875 /** Long Term Frame Index of the current frame */ 00876 __u32 nLTRFrameIdx; 00877 } v4l2_ctrl_videodec_currentframe_metadata; 00878 00879 /** 00880 * Holds the decoder DPB info metadata. 00881 */ 00882 typedef struct v4l2_ctrl_videodec_dpbinfometadata_ 00883 { 00884 /** Metadata for the current decoded frame */ 00885 v4l2_ctrl_videodec_currentframe_metadata currentFrame; 00886 /** Number of active frames present in the DPB */ 00887 __u32 nActiveRefFrames; 00888 /** An array of metadatas for the active frames in the DPB. Only @a 00889 * nActiveRefFrames elements in the array are valid */ 00890 v4l2_ctrl_videodec_refframe_metadata RPSList[16]; 00891 } v4l2_ctrl_videodec_dpbinfometadata; 00892 00893 /** 00894 * Holds H.264 specific decoder metadata for the frame. 00895 */ 00896 typedef struct v4l2_ctrl_h264dec_bufmetadata_ 00897 { 00898 /** Number of bits in the frame */ 00899 __u32 nFrameNumBits; 00900 /** Type of frame: 00901 * 0 = B 00902 * 1 = P 00903 * 2 = I */ 00904 __u32 FrameType; 00905 /** Current DPB info of the decoder */ 00906 v4l2_ctrl_videodec_dpbinfometadata dpbInfo; 00907 }v4l2_ctrl_h264dec_bufmetadata; 00908 00909 /** 00910 * Holds H.265 specific decoder metadata for the frame. 00911 */ 00912 typedef struct v4l2_ctrl_hevcdec_bufmetadata_ 00913 { 00914 /** Number of bits in the frame */ 00915 __u32 nPocLsbBits; 00916 /** Type of frame: 00917 * 0 = B 00918 * 1 = P 00919 * 2 = I */ 00920 __u32 FrameType; 00921 /** Current DPB info of the decoder */ 00922 v4l2_ctrl_videodec_dpbinfometadata dpbInfo; 00923 }v4l2_ctrl_hevcdec_bufmetadata; 00924 00925 /** 00926 * Holds the video decoder output metadata for a frame. 00927 */ 00928 typedef struct v4l2_ctrl_videodec_outputbuf_metadata_ 00929 { 00930 /** Color primaries */ 00931 __u8 ucColorPrimaries; 00932 /** Transfer Characteristics */ 00933 __u8 ucTransferCharacteristics; 00934 /** Matrix Coefficients */ 00935 __u8 ucMatrixCoefficients; 00936 /** Boolean value indicating if @a FrameDecStats has valid contents */ 00937 __u32 bValidFrameStatus; 00938 /** Frame decode statistics */ 00939 v4l2_ctrl_videodec_statusmetadata FrameDecStats; 00940 /** Codec specific metadata for the frame */ 00941 union { 00942 /** H.264 specific metadata */ 00943 v4l2_ctrl_h264dec_bufmetadata H264DecParams; 00944 /** H.265 specific metadata */ 00945 v4l2_ctrl_hevcdec_bufmetadata HEVCDecParams; 00946 }CodecParams; 00947 } v4l2_ctrl_videodec_outputbuf_metadata; 00948 /** @} */ 00949 00950 /** @addtogroup V4L2Enc */ 00951 /** @{ */ 00952 00953 /** 00954 * Enum specifying the types of encoder temporal tradeoff levels 00955 */ 00956 enum v4l2_enc_temporal_tradeoff_level_type { 00957 /** Do not drop any buffers */ 00958 V4L2_ENC_TEMPORAL_TRADEOFF_LEVEL_DROPNONE = 0, 00959 /** Drop 1 in every 5 buffers */ 00960 V4L2_ENC_TEMPORAL_TRADEOFF_LEVEL_DROP1IN5, 00961 /** Drop 1 in every 3 buffers */ 00962 V4L2_ENC_TEMPORAL_TRADEOFF_LEVEL_DROP1IN3, 00963 /** Drop 1 in every 2 buffers */ 00964 V4L2_ENC_TEMPORAL_TRADEOFF_LEVEL_DROP1IN2, 00965 /** Drop 2 in every 3 buffers */ 00966 V4L2_ENC_TEMPORAL_TRADEOFF_LEVEL_DROP2IN3, 00967 }; 00968 00969 /** 00970 * Enum specifying the type of slice length. 00971 */ 00972 enum v4l2_enc_slice_length_type { 00973 /** Slice size is specified in terms of number of bytes */ 00974 V4L2_ENC_SLICE_LENGTH_TYPE_BITS = 0, 00975 /** Slice size is specified in terms of number of macroblocks */ 00976 V4L2_ENC_SLICE_LENGTH_TYPE_MBLK, 00977 }; 00978 00979 /** 00980 * Holds encoder slice length parameters. 00981 * 00982 * To be used with #V4L2_CID_MPEG_VIDEOENC_SLICE_LENGTH_PARAM ioctl. 00983 */ 00984 typedef struct v4l2_enc_slice_length_param_ 00985 { 00986 /** Type in which the slice length is specified, one of type #v4l2_enc_slice_length_type. */ 00987 enum v4l2_enc_slice_length_type slice_length_type; 00988 /** Size of the slice in either number of bytes or number of macro blocks */ 00989 __u32 slice_length; 00990 }v4l2_enc_slice_length_param; 00991 00992 /** 00993 * Holds encoder virtual buffer size parameters. 00994 * 00995 * To be used with #V4L2_CID_MPEG_VIDEOENC_VIRTUALBUFFER_SIZE ioctl. 00996 */ 00997 typedef struct v4l2_enc_virtual_buffer_size_ 00998 { 00999 /** Size of the virtual buffer, in bits */ 01000 __u32 size; 01001 }v4l2_enc_virtual_buffer_size; 01002 01003 /** 01004 * Holds encoder number of reference frame parameters. 01005 * 01006 * To be used with #V4L2_CID_MPEG_VIDEOENC_NUM_REFERENCE_FRAMES ioctl. 01007 * 01008 * This is not supported for H265 01009 */ 01010 typedef struct v4l2_enc_num_ref_frames_ 01011 { 01012 /** Number of reference frames */ 01013 __u32 frames; 01014 }v4l2_enc_num_ref_frames; 01015 01016 /** 01017 * Holds encoder slice intrareferesh parameters. 01018 * 01019 * To be used with #V4L2_CID_MPEG_VIDEOENC_SLICE_INTRAREFRESH_PARAM ioctl. 01020 */ 01021 typedef struct v4l2_enc_slice_intrarefresh_param_ 01022 { 01023 /** Slice intrarefresh interval, in number of slices */ 01024 __u32 interval; 01025 }v4l2_enc_slice_intrarefresh_param; 01026 01027 /** 01028 * Maximum number of ROI regions supported by the encoder. 01029 */ 01030 #define V4L2_MAX_ROI_REGIONS 8 01031 01032 /** 01033 * Holds the encoder quality parameters for a single ROI region. 01034 */ 01035 typedef struct v4l2_enc_ROI_param_ 01036 { 01037 /** Region of interest rectangle */ 01038 struct v4l2_rect ROIRect; 01039 /** QP delta for the region */ 01040 __s32 QPdelta; 01041 } v4l2_enc_ROI_param; 01042 01043 /** 01044 * Holds the encoder frame ROI parameters. 01045 * 01046 * Should be used with #V4L2_CID_MPEG_VIDEOENC_ROI_PARAMS ioctl. 01047 */ 01048 typedef struct v4l2_enc_frame_ROI_params_ 01049 { 01050 /** Number of regions */ 01051 __u32 num_ROI_regions; 01052 /** Array of indiviudal ROI parameters */ 01053 v4l2_enc_ROI_param ROI_params[V4L2_MAX_ROI_REGIONS]; 01054 /** Config store integer to which this control is to be applied. 01055 * This should be same as the value of config store of v4l2_buffer to which 01056 * the ROI params should be applied. */ 01057 __u32 config_store; 01058 }v4l2_enc_frame_ROI_params; 01059 01060 /** 01061 * Holds the motion vector parameters for a single macro block. 01062 */ 01063 typedef struct MVInfo_ { 01064 /** Number of pixels the macro block has moved in horizontal direction */ 01065 __s32 mv_x : 16; 01066 /** Number of pixels the macro block has moved in vertical direction */ 01067 __s32 mv_y : 14; 01068 /** Temporal hints used by hardware for Motion Estimation */ 01069 __u32 weight : 2; 01070 } MVInfo; 01071 01072 /** 01073 * Holds the motion vector parameters for one complete frame. 01074 */ 01075 typedef struct v4l2_ctrl_videoenc_outputbuf_metadata_MV_ { 01076 /** Size of the pMVInfo buffer, in bytes */ 01077 __u32 bufSize; 01078 /** Pointer to the buffer containing the motion vectors */ 01079 MVInfo *pMVInfo; 01080 } v4l2_ctrl_videoenc_outputbuf_metadata_MV; 01081 01082 /** 01083 * Holds the encoder output metadata for a frame. 01084 * 01085 * To be used with #V4L2_CID_MPEG_VIDEOENC_METADATA ioctl. 01086 */ 01087 typedef struct v4l2_ctrl_videoenc_outputbuf_metadata_ 01088 { 01089 /** Boolean value indicating if current frame is a key frame */ 01090 __u8 KeyFrame; 01091 /** Boolean value indicating end of frame in case of multi slice encoding */ 01092 __u8 EndofFrame; 01093 /** Average QP value of the frame */ 01094 __u16 AvgQP; 01095 /** Boolean value indicating if current frame is a golden or alternate frame */ 01096 __u8 bIsGoldenOrAlternateFrame; 01097 /** Number of bits needed to encode the frame */ 01098 __u32 EncodedFrameBits; 01099 /** Minumum QP value in the frame */ 01100 __u32 FrameMinQP; 01101 /** Maximum QP value in the frame */ 01102 __u32 FrameMaxQP; 01103 /** Reference frame id used for Motion Estimation of current frame, 01104 ignored for IDR */ 01105 __u32 nCurrentRefFrameId; 01106 /** Number of active reference frames */ 01107 __u32 nActiveRefFrames; 01108 } v4l2_ctrl_videoenc_outputbuf_metadata; 01109 01110 /** 01111 * Holds the metadata parameters for video encoder and decoder. 01112 * 01113 * The metadata is valid for the buffer with index @a buffer_index after the 01114 * buffer is dequeued till it is queued again. 01115 */ 01116 typedef struct _v4l2_ctrl_video_metadata 01117 { 01118 /** A pointer to #v4l2_ctrl_videodec_outputbuf_metadata structure. 01119 * Should be a valid pointer when used with #V4L2_CID_MPEG_VIDEODEC_METADATA 01120 * ioctl. */ 01121 v4l2_ctrl_videodec_outputbuf_metadata *VideoDecMetadata; 01122 /** A pointer to #v4l2_ctrl_videoenc_outputbuf_metadata structure. 01123 * Should be a valid pointer when used with #V4L2_CID_MPEG_VIDEOENC_METADATA 01124 * ioctl. */ 01125 v4l2_ctrl_videoenc_outputbuf_metadata *VideoEncMetadata; 01126 /** A pointer to #v4l2_ctrl_videoenc_outputbuf_metadata_MV structure. 01127 * Should be a valid pointer when used with #V4L2_CID_MPEG_VIDEOENC_METADATA_MV 01128 * ioctl. */ 01129 v4l2_ctrl_videoenc_outputbuf_metadata_MV *VideoEncMetadataMV; 01130 /** Index of the buffer whose metadata is required. */ 01131 __u32 buffer_index; 01132 } v4l2_ctrl_video_metadata; 01133 01134 /** 01135 * Setting Qp values in #v4l2_ctrl_video_qp_range to QP_RETAIN_VAL 01136 * will retain default or previously set QP values. 01137 */ 01138 #define QP_RETAIN_VAL -1 01139 01140 /** 01141 * Holds the encoder frame min/max QP parameters. 01142 * 01143 * Should be used with #V4L2_CID_MPEG_VIDEOENC_QP_RANGE ioctl. 01144 */ 01145 typedef struct _v4l2_ctrl_video_qp_range 01146 { 01147 /** Minimum QP value for I frame */ 01148 __u32 MinQpI; 01149 /** Maximum QP value for I frame */ 01150 __u32 MaxQpI; 01151 /** Minimum QP value for P frame */ 01152 __u32 MinQpP; 01153 /** Maximum QP value for P frame */ 01154 __u32 MaxQpP; 01155 /** Minimum QP value for B frame */ 01156 __u32 MinQpB; 01157 /** Maximum QP value for B frame */ 01158 __u32 MaxQpB; 01159 } v4l2_ctrl_video_qp_range; 01160 /** @} */ 01161 01162 /** @addtogroup V4L2Conv */ 01163 /** @{ */ 01164 01165 /** 01166 * Enum specifying types of buffer layouts. 01167 */ 01168 enum v4l2_nv_buffer_layout { 01169 V4L2_NV_BUFFER_LAYOUT_PITCH = 0, /**< Pitch Linear Layout */ 01170 V4L2_NV_BUFFER_LAYOUT_BLOCKLINEAR = 1, /**< Block Linear Layout */ 01171 }; 01172 01173 /** 01174 * Enum specifying types of rotation/flip algorithms. 01175 */ 01176 enum v4l2_flip_method { 01177 V4L2_FLIP_METHOD_IDENTITY = 0, /**< Identity (no rotation) */ 01178 V4L2_FLIP_METHOD_90L = 1, /**< Rotate counter-clockwise 90 degrees */ 01179 V4L2_FLIP_METHOD_180 = 2, /**< Rotate 180 degrees */ 01180 V4L2_FLIP_METHOD_90R = 3, /**< Rotate clockwise 90 degrees */ 01181 V4L2_FLIP_METHOD_HORIZ = 4, /**< Flip horizontally */ 01182 V4L2_FLIP_METHOD_INVTRANS = 5, /**< Flip across upper right/lower left diagonal */ 01183 V4L2_FLIP_METHOD_VERT = 6, /**< Flip vertically */ 01184 V4L2_FLIP_METHOD_TRANS = 7, /**< Flip across upper left/lower right diagonal */ 01185 }; 01186 01187 /** 01188 * Enum specifying types of interpolation methods. 01189 */ 01190 enum v4l2_interpolation_method { 01191 V4L2_INTERPOLATION_NEAREST = 1, /**< Nearest interpolation method */ 01192 V4L2_INTERPOLATION_LINEAR = 2, /**< Linear interpolation method */ 01193 V4L2_INTERPOLATION_SMART = 3, /**< Smart interpolation method */ 01194 V4L2_INTERPOLATION_BILINEAR = 4, /**< Bi-Linear interpolation method */ 01195 }; 01196 01197 /** 01198 * Enum specifying types of TNR algorithms. 01199 */ 01200 enum v4l2_tnr_algorithm { 01201 V4L2_TNR_ALGO_ORIGINAL = 0, /**< Default TNR Algorithm */ 01202 V4L2_TNR_ALGO_OUTDOOR_LOW_LIGHT = 1, /**< Outdoor Low Light TNR Algorithm */ 01203 V4L2_TNR_ALGO_OUTDOOR_MEDIUM_LIGHT = 2, /**< Outdoor Medium Light TNR Algorithm */ 01204 V4L2_TNR_ALGO_OUTDOOR_HIGH_LIGHT = 3, /**< Outdoor High Light TNR Algorithm */ 01205 V4L2_TNR_ALGO_INDOOR_LOW_LIGHT = 4, /**< Indoor Low Light TNR Algorithm */ 01206 V4L2_TNR_ALGO_INDOOR_MEDIUM_LIGHT = 5, /**< Indoor Medium Light TNR Algorithm */ 01207 V4L2_TNR_ALGO_INDOOR_HIGH_LIGHT = 6, /**< Indoor High Light TNR Algorithm */ 01208 }; 01209 /** @} */ 01210 #endif /*__V4L2_NV_EXTENSIONS_H__*/