STRUCT V4L2_CTRL_HEVC_SLICE_PARAMS(9)
β¨ NAME β¨
struct v4l2_ctrl_hevc_slice_params β HEVC slice parameters π
Bestie, this is the little struct that holds everything the kernel needs to know about one HEVC slice. It's giving "backstage pass to the decoder" energy, and tbh it ate. π
πΈ SYNOPSIS πΈ
struct v4l2_ctrl_hevc_slice_params {
__u32 bit_size;
__u32 data_byte_offset;
__u32 num_entry_point_offsets;
__u8 nal_unit_type;
__u8 nuh_temporal_id_plus1;
__u8 slice_type;
__u8 colour_plane_id;
__s32 slice_pic_order_cnt;
__u8 num_ref_idx_l0_active_minus1;
__u8 num_ref_idx_l1_active_minus1;
__u8 collocated_ref_idx;
__u8 five_minus_max_num_merge_cand;
__s8 slice_qp_delta;
__s8 slice_cb_qp_offset;
__s8 slice_cr_qp_offset;
__s8 slice_act_y_qp_offset;
__s8 slice_act_cb_qp_offset;
__s8 slice_act_cr_qp_offset;
__s8 slice_beta_offset_div2;
__s8 slice_tc_offset_div2;
__u8 pic_struct;
__u8 reserved0[3];
__u32 slice_segment_addr;
__u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
__u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX];
__u16 short_term_ref_pic_set_size;
__u16 long_term_ref_pic_set_size;
struct v4l2_hevc_pred_weight_table pred_weight_table;
__u8 reserved1[2];
__u64 flags;
};
Like, look at her. Gorgeous. Every field accounted for, no notes. π
π¦ Members π¦
Ok so let's go field by field, because bestie you will be asked about these:
bit_sizeβ the size, in bits, of the current slice data. That's it. That's the field. β¨data_byte_offsetβ how far, in bytes, you gotta hop to find the video data for the current slice.num_entry_point_offsetsβ says how many entry point offset syntax elements are chilling in the slice header.nal_unit_typeβ the coding type of the slice, i.e. is she a B, a P, or an I? main character choices only.nuh_temporal_id_plus1β minus 1, this specifies a temporal identifier for the NAL unit. (Yes, "minus 1" is literally in the name, it's not a typo, don't come for me.)slice_typeβ peepV4L2_HEVC_SLICE_TYPE_{}for the deets.colour_plane_idβ which colour plane is associated with the current slice. (Spelled with a u, she's fancy.)slice_pic_order_cntβ the picture order count. Keeping things in order, as one does. πnum_ref_idx_l0_active_minus1β this value plus 1 gives the maximum reference index for reference picture list 0 that may be used to decode the slice.num_ref_idx_l1_active_minus1β same vibe as above, but for reference picture list 1. This value plus 1 = the max reference index for list 1 that may be used to decode the slice.collocated_ref_idxβ the reference index of the collocated picture used for temporal motion vector prediction. Say that five times fast, I dare you. πfive_minus_max_num_merge_candβ the maximum number of merging motion vector prediction candidates supported in the slice, subtracted from 5. Math girlie.slice_qp_deltaβ the initial value of QpY that gets used for the coding blocks in the slice.slice_cb_qp_offsetβ a difference to be added to the value ofpps_cb_qp_offset.slice_cr_qp_offsetβ a difference to be added to the value ofpps_cr_qp_offset.slice_act_y_qp_offsetβ screen content extension parameters. Very niche, very demure.slice_act_cb_qp_offsetβ screen content extension parameters. Same energy.slice_act_cr_qp_offsetβ screen content extension parameters. Third time's the charm. πslice_beta_offset_div2β specifies the deblocking parameter offsets for beta, divided by 2.slice_tc_offset_div2β specifies the deblocking parameter offsets for tC, divided by 2.pic_structβ tells you whether a picture should be displayed as a frame, or as one or more fields.reserved0β padding field. Should be zeroed by applications. Don't be chaotic, zero it. πslice_segment_addrβ the address of the first coding tree block in the slice segment.ref_idx_l0β the list of L0 reference elements, as indices in the DPB.ref_idx_l1β the list of L1 reference elements, as indices in the DPB.short_term_ref_pic_set_sizeβ the size of the short-term reference pictures set included in the SPS.long_term_ref_pic_set_sizeβ the size of the long-term reference pictures set include in the SPS. (That's the original wording's grammar, not mine β leaving it exactly as it lives. π«Ά)pred_weight_tableβ the prediction weight coefficients for inter-picture prediction.reserved1β padding field. Should be zeroed by applications. Same rules, bestie. βflagsβ checkV4L2_HEVC_SLICE_PARAMS_FLAG_{}for what's up in there.
π Description π
So this control is a dynamically sized 1-dimensional array, and β important β the V4L2_CTRL_FLAG_DYNAMIC_ARRAY flag must be set when you use it. No flag, no slay. Flat out required. π₯
Not me being dramatic about it, but like β the flag isn't optional. It's giving "you WILL set this flag". Periodt. π
π SEE ALSO π
Kernel file ./include/uapi/linux/v4l2-controls.h, plus literally the entire extended universe of V4L2 controls down here (yes, all of them, I would never do you dirty by trimming the list):
enum v4l2_mpeg_video_av1_profile(9)enum v4l2_mpeg_video_av1_level(9)enum v4l2_stateless_h264_decode_mode(9)enum v4l2_stateless_h264_start_code(9)struct v4l2_ctrl_h264_sps(9)struct v4l2_ctrl_h264_pps(9)struct v4l2_ctrl_h264_scaling_matrix(9)struct v4l2_ctrl_h264_pred_weights(9)struct v4l2_h264_reference(9)struct v4l2_ctrl_h264_slice_params(9)struct v4l2_h264_dpb_entry(9)struct v4l2_ctrl_h264_decode_params(9)struct v4l2_ctrl_fwht_params(9)struct v4l2_vp8_segment(9)struct v4l2_vp8_loop_filter(9)struct v4l2_vp8_quantization(9)struct v4l2_vp8_entropy(9)struct v4l2_vp8_entropy_coder_state(9)struct v4l2_ctrl_vp8_frame(9)struct v4l2_ctrl_mpeg2_sequence(9)struct v4l2_ctrl_mpeg2_picture(9)struct v4l2_ctrl_mpeg2_quantisation(9)struct v4l2_ctrl_hevc_sps(9)struct v4l2_ctrl_hevc_pps(9)struct v4l2_hevc_dpb_entry(9)struct v4l2_hevc_pred_weight_table(9)struct v4l2_ctrl_hevc_decode_params(9)struct v4l2_ctrl_hevc_scaling_matrix(9)struct v4l2_vp9_loop_filter(9)struct v4l2_vp9_quantization(9)struct v4l2_vp9_segmentation(9)struct v4l2_ctrl_vp9_frame(9)struct v4l2_vp9_mv_probs(9)struct v4l2_ctrl_vp9_compressed_hdr(9)struct v4l2_ctrl_av1_sequence(9)struct v4l2_ctrl_av1_tile_group_entry(9)enum v4l2_av1_warp_model(9)enum v4l2_av1_reference_frame(9)struct v4l2_av1_global_motion(9)enum v4l2_av1_frame_restoration_type(9)struct v4l2_av1_loop_restoration(9)struct v4l2_av1_cdef(9)enum v4l2_av1_segment_feature(9)struct v4l2_av1_segmentation(9)struct v4l2_av1_loop_filter(9)struct v4l2_av1_quantization(9)struct v4l2_av1_tile_info(9)enum v4l2_av1_frame_type(9)enum v4l2_av1_interpolation_filter(9)enum v4l2_av1_tx_mode(9)struct v4l2_ctrl_av1_frame(9)struct v4l2_ctrl_av1_film_grain(9)
Ok that's the whole page, you're officially educated. π Go forth and decode responsibly.
This little gem lives under ./include/uapi/linux, and this version is dated October 2026 β so if you're reading it later than that, no cap, go check for a newer one. Love u, bye! π«Άβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms