From 8508ce0bc0adb5a2f91899cd3e2a2d1b8ce44864 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sun, 5 Mar 2023 19:53:37 +0900 Subject: [PATCH] va: Fix struct empty initialization syntax "struct Foo bar; bar = {};" is not a valid syntax. Also remove use of __typeof__ which is GCC specific Part-of: --- .../gst-plugins-bad/sys/va/gstvaav1dec.c | 6 ++--- .../gst-plugins-bad/sys/va/gstvafilter.c | 5 ++-- .../gst-plugins-bad/sys/va/gstvah264enc.c | 4 ++-- .../gst-plugins-bad/sys/va/gstvah265enc.c | 24 +++++++++---------- .../gst-plugins-bad/sys/va/gstvavp8dec.c | 4 ++-- subprojects/gst-plugins-bad/sys/va/gstvavpp.c | 12 ++++++---- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c b/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c index 9404f2b394..3659b354e9 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c @@ -680,7 +680,7 @@ gst_va_av1_dec_start_picture (GstAV1Decoder * decoder, GstAV1Picture * picture, GstVaBaseDec *base = GST_VA_BASE_DEC (decoder); GstAV1FrameHeaderOBU *frame_header = &picture->frame_hdr; GstAV1SequenceHeaderOBU *seq_header = &self->seq; - VADecPictureParameterBufferAV1 pic_param = { }; + VADecPictureParameterBufferAV1 pic_param = { 0, }; GstVaDecodePicture *va_pic; guint i; @@ -884,13 +884,11 @@ gst_va_av1_dec_decode_tile (GstAV1Decoder * decoder, GstAV1Picture * picture, GstAV1TileGroupOBU *tile_group = &tile->tile_group; GstVaDecodePicture *va_pic; guint i; - VASliceParameterBufferAV1 slice_param[GST_AV1_MAX_TILE_COUNT]; + VASliceParameterBufferAV1 slice_param[GST_AV1_MAX_TILE_COUNT] = { 0, }; GST_TRACE_OBJECT (self, "-"); for (i = 0; i < tile_group->tg_end - tile_group->tg_start + 1; i++) { - slice_param[i] = (VASliceParameterBufferAV1) { - }; slice_param[i].slice_data_size = tile_group->entry[tile_group->tg_start + i].tile_size; slice_param[i].slice_data_offset = diff --git a/subprojects/gst-plugins-bad/sys/va/gstvafilter.c b/subprojects/gst-plugins-bad/sys/va/gstvafilter.c index 44f54db091..4d1645276b 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvafilter.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvafilter.c @@ -31,6 +31,7 @@ #include "gstvacaps.h" #include "gstvadisplay_priv.h" +#include struct _GstVaFilter { @@ -1260,9 +1261,7 @@ _config_color_properties (VAProcColorStandardType * std, if (worstscore == 0) { /* No properties specified, there's not a useful choice. */ *std = VAProcColorStandardNone; - *props = (VAProcColorProperties) { - }; - + memset (props, 0, sizeof (VAProcColorProperties)); return; } diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c index 1072e256d4..7bfa55fcdd 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah264enc.c @@ -2536,7 +2536,7 @@ static void _insert_ref_pic_list_modification (GstH264SliceHdr * slice_hdr, GstVaH264EncFrame * list[16], guint list_num, gboolean is_asc) { - GstVaH264EncFrame *list_by_pic_num[16] = { }; + GstVaH264EncFrame *list_by_pic_num[16] = { NULL, }; guint modification_num, i; GstH264RefPicListModification *ref_pic_list_modification = NULL; gint pic_num_diff, pic_num_lx_pred; @@ -2716,7 +2716,7 @@ static gboolean _add_aud (GstVaH264Enc * self, GstVaH264EncFrame * frame) { GstVaBaseEnc *base = GST_VA_BASE_ENC (self); - guint8 aud_data[8] = { }; + guint8 aud_data[8] = { 0, }; guint size; guint8 primary_pic_type = 0; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c index 796ec21478..560634953f 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c @@ -538,7 +538,7 @@ _h265_fill_ptl (GstVaH265Enc * self, .profile_space = 0, .tier_flag = sequence->general_tier_flag, .profile_idc = sequence->general_profile_idc, - .profile_compatibility_flag = { }, + .profile_compatibility_flag = { 0, }, .progressive_source_flag = 1, .interlaced_source_flag = 0, .non_packed_constraint_flag = 0, @@ -901,7 +901,7 @@ _h265_fill_sps (GstVaH265Enc * self, .delta_palette_max_predictor_size = 32, .sps_palette_predictor_initializers_present_flag = 0, .sps_num_palette_predictor_initializer_minus1 = 0, - .sps_palette_predictor_initializer = { }, + .sps_palette_predictor_initializer = {{ 0, }}, .motion_vector_resolution_control_idc = 0, .intra_boundary_filtering_disabled_flag = 0, }, @@ -1050,7 +1050,7 @@ _h265_fill_slice_header (GstVaH265Enc * self, GstVaH265EncFrame * frame, .collocated_ref_idx = (slice_param->slice_type == GST_H265_I_SLICE ? 0xFF : self->features.collocated_ref_idx), /* not used now. */ - .pred_weight_table = { }, + .pred_weight_table = { 0, }, .five_minus_max_num_merge_cand = 5 - slice_param->max_num_merge_cand, .use_integer_mv_flag = 0, .qp_delta = slice_param->slice_qp_delta, @@ -1261,7 +1261,7 @@ static gboolean _h265_add_aud (GstVaH265Enc * self, GstVaH265EncFrame * frame) { GstVaBaseEnc *base = GST_VA_BASE_ENC (self); - guint8 aud_data[8] = { }; + guint8 aud_data[8] = { 0, }; guint size; guint8 pic_type = 0; @@ -1692,12 +1692,12 @@ _h265_fill_slice_parameter (GstVaH265Enc * self, GstVaH265EncFrame * frame, .delta_chroma_log2_weight_denom = 0, .delta_luma_weight_l0 = { 0, }, .luma_offset_l0 = { 0, }, - .delta_chroma_weight_l0 = { }, - .chroma_offset_l0 = { }, - .delta_luma_weight_l1 = { }, - .luma_offset_l1 = { }, - .delta_chroma_weight_l1 = { }, - .chroma_offset_l1 = { }, + .delta_chroma_weight_l0 = {{ 0, }}, + .chroma_offset_l0 = {{ 0, }}, + .delta_luma_weight_l1 = { 0, }, + .luma_offset_l1 = { 0, }, + .delta_chroma_weight_l1 = {{ 0, }}, + .chroma_offset_l1 = {{ 0, }}, .max_num_merge_cand = 5, .slice_qp_delta = slice_qp_delta, @@ -1878,9 +1878,9 @@ _h265_encode_one_frame (GstVaH265Enc * self, GstVideoCodecFrame * gst_frame) guint list_forward_num = 0; GstVaH265EncFrame *list_backward[16] = { NULL, }; guint list_backward_num = 0; - gint negative_pocs[16] = { }; + gint negative_pocs[16] = { 0, }; guint num_negative_pics = 0; - gint positive_pocs[16] = { }; + gint positive_pocs[16] = { 0, }; guint num_positive_pics = 0; gint collocated_poc = -1; gint i; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c b/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c index 6f7f930a43..fc1adcb5fc 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c @@ -176,7 +176,7 @@ _fill_quant_matrix (GstVp8Decoder * decoder, GstVp8Picture * picture, GstVaBaseDec *base = GST_VA_BASE_DEC (decoder); GstVp8FrameHdr const *frame_hdr = &picture->frame_hdr; GstVp8Segmentation *const seg = &parser->segmentation; - VAIQMatrixBufferVP8 iq_matrix = { }; + VAIQMatrixBufferVP8 iq_matrix = { 0, }; const gint8 QI_MAX = 127; gint16 qi, qi_base; gint i; @@ -214,7 +214,7 @@ _fill_probability_table (GstVp8Decoder * decoder, GstVp8Picture * picture) { GstVaBaseDec *base = GST_VA_BASE_DEC (decoder); GstVp8FrameHdr const *frame_hdr = &picture->frame_hdr; - VAProbabilityDataBufferVP8 prob_table = { }; + VAProbabilityDataBufferVP8 prob_table = { 0, }; /* Fill in VAProbabilityDataBufferVP8 */ memcpy (prob_table.dct_coeff_probs, frame_hdr->token_probs.prob, diff --git a/subprojects/gst-plugins-bad/sys/va/gstvavpp.c b/subprojects/gst-plugins-bad/sys/va/gstvavpp.c index 6355216ad3..831cdf502c 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvavpp.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvavpp.c @@ -78,7 +78,11 @@ GST_DEBUG_CATEGORY_STATIC (gst_va_vpp_debug); #define GST_VA_VPP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_FROM_INSTANCE (obj), GstVaVppClass)) #define GST_VA_VPP_CLASS(klass) ((GstVaVppClass *) klass) -#define SWAP(a, b) do { const __typeof__ (a) t = a; a = b; b = t; } while (0) +#define SWAP_INT(a, b) G_STMT_START { \ + gint __tmp = a; \ + a = b; \ + b = __tmp; \ +} G_STMT_END typedef struct _GstVaVpp GstVaVpp; typedef struct _GstVaVppClass GstVaVppClass; @@ -494,7 +498,7 @@ gst_va_vpp_set_info (GstVaBaseTransform * btrans, GstCaps * incaps, case GST_VIDEO_ORIENTATION_90L: case GST_VIDEO_ORIENTATION_UL_LR: case GST_VIDEO_ORIENTATION_UR_LL: - SWAP (from_dar_n, from_dar_d); + SWAP_INT (from_dar_n, from_dar_d); break; default: break; @@ -1332,8 +1336,8 @@ gst_va_vpp_fixate_size (GstVaVpp * self, GstPadDirection direction, case GST_VIDEO_ORIENTATION_90L: case GST_VIDEO_ORIENTATION_UL_LR: case GST_VIDEO_ORIENTATION_UR_LL: - SWAP (from_w, from_h); - SWAP (from_par_n, from_par_d); + SWAP_INT (from_w, from_h); + SWAP_INT (from_par_n, from_par_d); break; default: break;