From c56fc312a8aeddec700c1acbf312eac2d8233296 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Thu, 29 Aug 2024 19:03:49 +0200 Subject: [PATCH] frontends/va: Parse H264 prefix for temporal_id Reviewed-By: Sil Vilerino Reviewed-by: Ruijing Dong Part-of: --- src/gallium/frontends/va/picture_h264_enc.c | 16 ++++++++++++++++ src/gallium/include/pipe/p_video_state.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/gallium/frontends/va/picture_h264_enc.c b/src/gallium/frontends/va/picture_h264_enc.c index a7249322cb4..0fd4ce24740 100644 --- a/src/gallium/frontends/va/picture_h264_enc.c +++ b/src/gallium/frontends/va/picture_h264_enc.c @@ -716,6 +716,19 @@ static void parseEncPpsParamsH264(vlVaContext *context, struct vl_rbsp *rbsp) } } +static void parseEncPrefixH264(vlVaContext *context, struct vl_rbsp *rbsp) +{ + if (!vl_rbsp_u(rbsp, 1)) /* svc_extension_flag */ + return; + + vl_rbsp_u(rbsp, 1); /* idr_flag */ + vl_rbsp_u(rbsp, 6); /* priority_id */ + vl_rbsp_u(rbsp, 1); /* no_inter_layer_pred_flag */ + vl_rbsp_u(rbsp, 3); /* dependency_id */ + vl_rbsp_u(rbsp, 4); /* quality_id */ + context->desc.h264enc.pic_ctrl.temporal_id = vl_rbsp_u(rbsp, 3); +} + VAStatus vlVaHandleVAEncPackedHeaderDataBufferTypeH264(vlVaContext *context, vlVaBuffer *buf) { @@ -774,6 +787,9 @@ vlVaHandleVAEncPackedHeaderDataBufferTypeH264(vlVaContext *context, vlVaBuffer * case PIPE_H264_NAL_PPS: parseEncPpsParamsH264(context, &rbsp); break; + case PIPE_H264_NAL_PREFIX: + parseEncPrefixH264(context, &rbsp); + break; default: break; } diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index 30b90a05e99..26fef7f1cc2 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -136,6 +136,7 @@ enum pipe_h264_nal_unit_type PIPE_H264_NAL_SPS = 7, PIPE_H264_NAL_PPS = 8, PIPE_H264_NAL_AUD = 9, + PIPE_H264_NAL_PREFIX = 14, }; enum pipe_h264_slice_type