mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
frontends/va: Parse H264 SPS for max_num_reorder_frames
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25565>
This commit is contained in:
parent
b653669fc5
commit
9e82c5d864
2 changed files with 49 additions and 0 deletions
|
|
@ -325,9 +325,28 @@ vlVaHandleVAEncMiscParameterTypeFrameRateH264(vlVaContext *context, VAEncMiscPar
|
|||
return VA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void parseEncHrdParamsH264(struct vl_rbsp *rbsp)
|
||||
{
|
||||
unsigned i, cpb_cnt_minus1;
|
||||
|
||||
cpb_cnt_minus1 = vl_rbsp_ue(rbsp);
|
||||
vl_rbsp_u(rbsp, 4); /* bit_rate_scale */
|
||||
vl_rbsp_u(rbsp, 4); /* cpb_size_scale */
|
||||
for (i = 0; i <= cpb_cnt_minus1; ++i) {
|
||||
vl_rbsp_ue(rbsp); /* bit_rate_value_minus1[i] */
|
||||
vl_rbsp_ue(rbsp); /* cpb_size_value_minus1[i] */
|
||||
vl_rbsp_u(rbsp, 1); /* cbr_flag[i] */
|
||||
}
|
||||
vl_rbsp_u(rbsp, 5); /* initial_cpb_removal_delay_length_minus1 */
|
||||
vl_rbsp_u(rbsp, 5); /* cpb_removal_delay_length_minus1 */
|
||||
vl_rbsp_u(rbsp, 5); /* dpb_output_delay_length_minus1 */
|
||||
vl_rbsp_u(rbsp, 5); /* time_offset_length */
|
||||
}
|
||||
|
||||
static void parseEncSpsParamsH264(vlVaContext *context, struct vl_rbsp *rbsp)
|
||||
{
|
||||
unsigned i, profile_idc, num_ref_frames_in_pic_order_cnt_cycle;
|
||||
unsigned nal_hrd_parameters_present_flag, vcl_hrd_parameters_present_flag;
|
||||
|
||||
profile_idc = vl_rbsp_u(rbsp, 8);
|
||||
|
||||
|
|
@ -412,6 +431,35 @@ static void parseEncSpsParamsH264(vlVaContext *context, struct vl_rbsp *rbsp)
|
|||
context->desc.h264enc.seq.chroma_sample_loc_type_top_field = vl_rbsp_ue(rbsp);
|
||||
context->desc.h264enc.seq.chroma_sample_loc_type_bottom_field = vl_rbsp_ue(rbsp);
|
||||
}
|
||||
|
||||
if (vl_rbsp_u(rbsp, 1)) { /* timing_info_present_flag */
|
||||
vl_rbsp_u(rbsp, 32); /* num_units_in_tick */
|
||||
vl_rbsp_u(rbsp, 32); /* time_scale */
|
||||
vl_rbsp_u(rbsp, 1); /* fixed_frame_rate_flag */
|
||||
}
|
||||
|
||||
nal_hrd_parameters_present_flag = vl_rbsp_u(rbsp, 1);
|
||||
if (nal_hrd_parameters_present_flag)
|
||||
parseEncHrdParamsH264(rbsp);
|
||||
|
||||
vcl_hrd_parameters_present_flag = vl_rbsp_u(rbsp, 1);
|
||||
if (vcl_hrd_parameters_present_flag)
|
||||
parseEncHrdParamsH264(rbsp);
|
||||
|
||||
if (nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag)
|
||||
vl_rbsp_u(rbsp, 1); /* low_delay_hrd_flag */
|
||||
|
||||
vl_rbsp_u(rbsp, 1); /* pic_struct_present_flag */
|
||||
|
||||
if (vl_rbsp_u(rbsp, 1)) { /* bitstream_restriction_flag */
|
||||
vl_rbsp_u(rbsp, 1); /* motion_vectors_over_pic_boundaries_flag */
|
||||
vl_rbsp_ue(rbsp); /* max_bytes_per_pic_denom */
|
||||
vl_rbsp_ue(rbsp); /* max_bits_per_mb_denom */
|
||||
vl_rbsp_ue(rbsp); /* log2_max_mv_length_horizontal */
|
||||
vl_rbsp_ue(rbsp); /* log2_max_mv_length_vertical */
|
||||
context->desc.h264enc.seq.max_num_reorder_frames = vl_rbsp_ue(rbsp);
|
||||
vl_rbsp_ue(rbsp); /* max_dec_frame_buffering */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -528,6 +528,7 @@ struct pipe_h264_enc_seq_param
|
|||
uint32_t matrix_coefficients;
|
||||
uint32_t chroma_sample_loc_type_top_field;
|
||||
uint32_t chroma_sample_loc_type_bottom_field;
|
||||
uint32_t max_num_reorder_frames;
|
||||
};
|
||||
|
||||
struct pipe_h264_enc_picture_desc
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue