frontends/va: Fix parsing VP9 frame header

Fix parsing intra only frames with profile 0. Change type to
signed int and initialize default values for ref_deltas and
mode_deltas.

Cc: mesa-stable
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37808>
This commit is contained in:
David Rosca 2025-10-10 09:26:31 +02:00 committed by Marge Bot
parent fc2ee4d407
commit 6531f060dd
2 changed files with 16 additions and 5 deletions

View file

@ -230,7 +230,7 @@ void vlVaDecoderVP9BitstreamHeader(vlVaContext *context, vlVaBuffer *buf)
{
struct vl_vlc vlc;
unsigned profile;
bool frame_type, show_frame, error_resilient_mode;
bool frame_type, show_frame, error_resilient_mode, intra_only = false;
bool mode_ref_delta_enabled, mode_ref_delta_update = false;
int i;
@ -265,7 +265,7 @@ void vlVaDecoderVP9BitstreamHeader(vlVaContext *context, vlVaBuffer *buf)
bitdepth_colorspace_sampling(&vlc, profile);
frame_size(&vlc);
} else {
bool intra_only, size_in_refs = false;
bool size_in_refs = false;
intra_only = show_frame ? 0 : vp9_u(&vlc, 1);
if (!error_resilient_mode)
@ -277,7 +277,8 @@ void vlVaDecoderVP9BitstreamHeader(vlVaContext *context, vlVaBuffer *buf)
if (vp9_u(&vlc, 24) != 0x498342)
return;
bitdepth_colorspace_sampling(&vlc, profile);
if (profile > 0)
bitdepth_colorspace_sampling(&vlc, profile);
/* refresh_frame_flags */
vp9_u(&vlc, 8);
frame_size(&vlc);
@ -333,6 +334,16 @@ void vlVaDecoderVP9BitstreamHeader(vlVaContext *context, vlVaBuffer *buf)
/* sharpness_level */
vp9_u(&vlc, 3);
if (frame_type == 0 || intra_only || error_resilient_mode) {
context->desc.vp9.picture_parameter.ref_deltas[0] = 1;
context->desc.vp9.picture_parameter.ref_deltas[1] = 0;
context->desc.vp9.picture_parameter.ref_deltas[2] = -1;
context->desc.vp9.picture_parameter.ref_deltas[3] = -1;
context->desc.vp9.picture_parameter.mode_deltas[0] = 0;
context->desc.vp9.picture_parameter.mode_deltas[1] = 0;
}
mode_ref_delta_enabled = vp9_u(&vlc, 1);
if (mode_ref_delta_enabled) {
mode_ref_delta_update = vp9_u(&vlc, 1);

View file

@ -1965,8 +1965,8 @@ struct pipe_vp9_picture_desc
int8_t uv_ac_delta_q;
int8_t uv_dc_delta_q;
uint8_t abs_delta;
uint8_t ref_deltas[4];
uint8_t mode_deltas[2];
int8_t ref_deltas[4];
int8_t mode_deltas[2];
} picture_parameter;
struct {