From 9147dc3d37018dc480cf6cfec314f6064cbcf16c Mon Sep 17 00:00:00 2001 From: Mengkejiergeli Ba Date: Thu, 9 Feb 2023 10:42:00 +0800 Subject: [PATCH] vaapidec: Fix uninitialized vars Part-of: --- .../gst-libs/gst/vaapi/gstvaapidecoder_av1.c | 18 +++++++++++------- .../gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 16 ++++++++++------ .../gst-libs/gst/vaapi/gstvaapidecoder_h265.c | 16 ++++++++++------ .../gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c | 17 +++++++++++------ .../gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c | 16 ++++++++++------ .../gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c | 16 ++++++++++------ .../gst-libs/gst/vaapi/gstvaapidecoder_vc1.c | 16 ++++++++++------ .../gst-libs/gst/vaapi/gstvaapidecoder_vp8.c | 16 ++++++++++------ .../gst-libs/gst/vaapi/gstvaapidecoder_vp9.c | 14 +++++++++----- 9 files changed, 91 insertions(+), 54 deletions(-) diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_av1.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_av1.c index 68ae3ef3c8..2d9f0e9584 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_av1.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_av1.c @@ -314,16 +314,20 @@ av1_decoder_ensure_context (GstVaapiDecoderAV1 * decoder) if (priv->current_picture) gst_vaapi_picture_replace (&priv->current_picture, NULL); - info.profile = priv->profile; - info.entrypoint = GST_VAAPI_ENTRYPOINT_VLD; - info.width = priv->width; - info.height = priv->height; - info.chroma_type = av1_get_chroma_type (info.profile, priv->seq_header); + /* *INDENT-OFF* */ + info = (GstVaapiContextInfo) { + .profile = priv->profile, + .entrypoint = GST_VAAPI_ENTRYPOINT_VLD, + .chroma_type = av1_get_chroma_type (priv->profile, priv->seq_header), + .width = priv->width, + .height = priv->height, + .ref_frames = GST_AV1_NUM_REF_FRAMES + 2, + }; + /* *INDENT-ON* */ + if (!info.chroma_type) return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT; - info.ref_frames = GST_AV1_NUM_REF_FRAMES + 2; - priv->reset_context = FALSE; if (!gst_vaapi_decoder_ensure_context (GST_VAAPI_DECODER (decoder), &info)) { GST_WARNING ("can not make av1 decoder context with profile %s," diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h264.c index e19c184a14..b693107ae6 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h264.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h264.c @@ -1645,12 +1645,16 @@ ensure_context (GstVaapiDecoderH264 * decoder, GstH264SPS * sps) return GST_VAAPI_DECODER_STATUS_SUCCESS; /* XXX: fix surface size when cropping is implemented */ - info.profile = priv->profile; - info.entrypoint = priv->entrypoint; - info.chroma_type = priv->chroma_type; - info.width = sps->width; - info.height = sps->height; - info.ref_frames = dpb_size; + /* *INDENT-OFF* */ + info = (GstVaapiContextInfo) { + .profile = priv->profile, + .entrypoint = priv->entrypoint, + .chroma_type = priv->chroma_type, + .width = sps->width, + .height = sps->height, + .ref_frames = dpb_size, + }; + /* *INDENT-ON* */ if (!gst_vaapi_decoder_ensure_context (GST_VAAPI_DECODER (decoder), &info)) return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN; diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h265.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h265.c index 025939c2c5..afd4f79f22 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h265.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h265.c @@ -1210,12 +1210,16 @@ ensure_context (GstVaapiDecoderH265 * decoder, GstH265SPS * sps) return GST_VAAPI_DECODER_STATUS_SUCCESS; /* XXX: fix surface size when cropping is implemented */ - info.profile = priv->profile; - info.entrypoint = priv->entrypoint; - info.chroma_type = priv->chroma_type; - info.width = sps->width; - info.height = sps->height; - info.ref_frames = dpb_size; + /* *INDENT-OFF* */ + info = (GstVaapiContextInfo) { + .profile = priv->profile, + .entrypoint = priv->entrypoint, + .chroma_type = priv->chroma_type, + .width = sps->width, + .height = sps->height, + .ref_frames = dpb_size, + }; + /* *INDENT-ON* */ if (!gst_vaapi_decoder_ensure_context (GST_VAAPI_DECODER (decoder), &info)) return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN; diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c index 3122f7beeb..ae90d8b773 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c @@ -250,14 +250,19 @@ ensure_context (GstVaapiDecoderJpeg * decoder) if (reset_context) { GstVaapiContextInfo info; - info.profile = priv->profile; - info.entrypoint = entrypoint; - info.width = priv->width; - info.height = priv->height; - info.ref_frames = 2; if (!get_chroma_type (frame_hdr, &chroma_type)) return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT; - info.chroma_type = chroma_type; + + /* *INDENT-OFF* */ + info = (GstVaapiContextInfo) { + .profile = priv->profile, + .entrypoint = entrypoint, + .chroma_type = chroma_type, + .width = priv->width, + .height = priv->height, + .ref_frames = 2, + }; + /* *INDENT-ON* */ reset_context = gst_vaapi_decoder_ensure_context (GST_VAAPI_DECODER (decoder), &info); diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c index 3855aa06f9..8f42493e10 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c @@ -461,13 +461,17 @@ ensure_context (GstVaapiDecoderMpeg2 * decoder) if (reset_context) { GstVaapiContextInfo info; + /* *INDENT-OFF* */ + info = (GstVaapiContextInfo) { + .profile = priv->hw_profile, + .entrypoint = entrypoint, + .chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420, + .width = priv->width, + .height = priv->height, + .ref_frames = 2, + }; + /* *INDENT-ON* */ - info.profile = priv->hw_profile; - info.entrypoint = entrypoint; - info.chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420; - info.width = priv->width; - info.height = priv->height; - info.ref_frames = 2; reset_context = gst_vaapi_decoder_ensure_context (GST_VAAPI_DECODER_CAST (decoder), &info); diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c index 8ecdb324fd..93c9b8a735 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c @@ -231,13 +231,17 @@ ensure_context (GstVaapiDecoderMpeg4 * decoder) if (reset_context) { GstVaapiContextInfo info; + /* *INDENT-OFF* */ + info = (GstVaapiContextInfo) { + .profile = priv->profile, + .entrypoint = entrypoint, + .chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420, + .width = priv->width, + .height = priv->height, + .ref_frames = 2, + }; + /* *INDENT-ON* */ - info.profile = priv->profile; - info.entrypoint = entrypoint; - info.chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420; - info.width = priv->width; - info.height = priv->height; - info.ref_frames = 2; reset_context = gst_vaapi_decoder_ensure_context (GST_VAAPI_DECODER (decoder), &info); if (!reset_context) diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c index d8dcbce6fa..cb4dfbff14 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c @@ -233,13 +233,17 @@ ensure_context (GstVaapiDecoderVC1 * decoder) if (reset_context) { GstVaapiContextInfo info; + /* *INDENT-OFF* */ + info = (GstVaapiContextInfo) { + .profile = priv->profile, + .entrypoint = entrypoint, + .chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420, + .width = priv->width, + .height = priv->height, + .ref_frames = 2, + }; + /* *INDENT-ON* */ - info.profile = priv->profile; - info.entrypoint = entrypoint; - info.chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420; - info.width = priv->width; - info.height = priv->height; - info.ref_frames = 2; reset_context = gst_vaapi_decoder_ensure_context (GST_VAAPI_DECODER (decoder), &info); if (!reset_context) diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vp8.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vp8.c index b61a0a9261..92cd3e2b44 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vp8.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vp8.c @@ -180,13 +180,17 @@ ensure_context (GstVaapiDecoderVp8 * decoder) if (reset_context) { GstVaapiContextInfo info; + /* *INDENT-OFF* */ + info = (GstVaapiContextInfo) { + .profile = priv->profile, + .entrypoint = entrypoint, + .chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420, + .width = priv->width, + .height = priv->height, + .ref_frames = 3, + }; + /* *INDENT-ON* */ - info.profile = priv->profile; - info.entrypoint = entrypoint; - info.chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420; - info.width = priv->width; - info.height = priv->height; - info.ref_frames = 3; reset_context = gst_vaapi_decoder_ensure_context (GST_VAAPI_DECODER (decoder), &info); diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c index 3862cc26c2..3e02891b64 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c @@ -259,12 +259,16 @@ ensure_context (GstVaapiDecoderVp9 * decoder) if (reset_context) { GstVaapiContextInfo info; + /* *INDENT-OFF* */ + info = (GstVaapiContextInfo) { + .profile = priv->profile, + .entrypoint = entrypoint, + .width = priv->width, + .height = priv->height, + .ref_frames = 8, + }; + /* *INDENT-ON* */ - info.profile = priv->profile; - info.entrypoint = entrypoint; - info.width = priv->width; - info.height = priv->height; - info.ref_frames = 8; if (!get_chroma_type (frame_hdr, parser, &info)) return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT;