frontends/va: Fix parsing packed headers without emulation bytes
Don't try to handle emulation bytes and only parse first NAL unit if the packed header has no emulation bytes. This fixes parsing packed headers from gstreamer. Reviewed-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25565>
This commit is contained in:
@@ -742,6 +742,8 @@ handleVAEncPackedHeaderParameterBufferType(vlVaContext *context, vlVaBuffer *buf
|
||||
VAStatus status = VA_STATUS_SUCCESS;
|
||||
VAEncPackedHeaderParameterBuffer *param = buf->data;
|
||||
|
||||
context->packed_header_emulation_bytes = param->has_emulation_bytes;
|
||||
|
||||
switch (u_reduce_video_profile(context->templat.profile)) {
|
||||
case PIPE_VIDEO_FORMAT_MPEG4_AVC:
|
||||
if (param->type == VAEncPackedHeaderSequence)
|
||||
|
||||
@@ -486,7 +486,7 @@ vlVaHandleVAEncPackedHeaderDataBufferTypeH264(vlVaContext *context, vlVaBuffer *
|
||||
unsigned nal_unit_type = vl_vlc_get_uimsbf(&vlc, 5);
|
||||
|
||||
struct vl_rbsp rbsp;
|
||||
vl_rbsp_init(&rbsp, &vlc, ~0, true);
|
||||
vl_rbsp_init(&rbsp, &vlc, ~0, context->packed_header_emulation_bytes);
|
||||
|
||||
switch(nal_unit_type) {
|
||||
case H264_NAL_SPS:
|
||||
@@ -496,6 +496,9 @@ vlVaHandleVAEncPackedHeaderDataBufferTypeH264(vlVaContext *context, vlVaBuffer *
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!context->packed_header_emulation_bytes)
|
||||
break;
|
||||
}
|
||||
|
||||
return VA_STATUS_SUCCESS;
|
||||
|
||||
@@ -465,7 +465,7 @@ vlVaHandleVAEncPackedHeaderDataBufferTypeHEVC(vlVaContext *context, vlVaBuffer *
|
||||
vl_vlc_eatbits(&vlc, 3);
|
||||
|
||||
struct vl_rbsp rbsp;
|
||||
vl_rbsp_init(&rbsp, &vlc, ~0, true);
|
||||
vl_rbsp_init(&rbsp, &vlc, ~0, context->packed_header_emulation_bytes);
|
||||
|
||||
switch(nal_unit_type) {
|
||||
case HEVC_NAL_SPS:
|
||||
@@ -476,6 +476,9 @@ vlVaHandleVAEncPackedHeaderDataBufferTypeHEVC(vlVaContext *context, vlVaBuffer *
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!context->packed_header_emulation_bytes)
|
||||
break;
|
||||
}
|
||||
|
||||
return VA_STATUS_SUCCESS;
|
||||
|
||||
@@ -373,6 +373,7 @@ typedef struct {
|
||||
bool needs_begin_frame;
|
||||
void *blit_cs;
|
||||
int packed_header_type;
|
||||
bool packed_header_emulation_bytes;
|
||||
struct set *surfaces;
|
||||
} vlVaContext;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user