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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4614>
This commit is contained in:
Seungha Yang 2023-03-05 19:53:37 +09:00 committed by Tim-Philipp Müller
parent 67a1e19bed
commit 8508ce0bc0
6 changed files with 28 additions and 27 deletions

View file

@ -680,7 +680,7 @@ gst_va_av1_dec_start_picture (GstAV1Decoder * decoder, GstAV1Picture * picture,
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder); GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstAV1FrameHeaderOBU *frame_header = &picture->frame_hdr; GstAV1FrameHeaderOBU *frame_header = &picture->frame_hdr;
GstAV1SequenceHeaderOBU *seq_header = &self->seq; GstAV1SequenceHeaderOBU *seq_header = &self->seq;
VADecPictureParameterBufferAV1 pic_param = { }; VADecPictureParameterBufferAV1 pic_param = { 0, };
GstVaDecodePicture *va_pic; GstVaDecodePicture *va_pic;
guint i; guint i;
@ -884,13 +884,11 @@ gst_va_av1_dec_decode_tile (GstAV1Decoder * decoder, GstAV1Picture * picture,
GstAV1TileGroupOBU *tile_group = &tile->tile_group; GstAV1TileGroupOBU *tile_group = &tile->tile_group;
GstVaDecodePicture *va_pic; GstVaDecodePicture *va_pic;
guint i; guint i;
VASliceParameterBufferAV1 slice_param[GST_AV1_MAX_TILE_COUNT]; VASliceParameterBufferAV1 slice_param[GST_AV1_MAX_TILE_COUNT] = { 0, };
GST_TRACE_OBJECT (self, "-"); GST_TRACE_OBJECT (self, "-");
for (i = 0; i < tile_group->tg_end - tile_group->tg_start + 1; i++) { for (i = 0; i < tile_group->tg_end - tile_group->tg_start + 1; i++) {
slice_param[i] = (VASliceParameterBufferAV1) {
};
slice_param[i].slice_data_size = slice_param[i].slice_data_size =
tile_group->entry[tile_group->tg_start + i].tile_size; tile_group->entry[tile_group->tg_start + i].tile_size;
slice_param[i].slice_data_offset = slice_param[i].slice_data_offset =

View file

@ -31,6 +31,7 @@
#include "gstvacaps.h" #include "gstvacaps.h"
#include "gstvadisplay_priv.h" #include "gstvadisplay_priv.h"
#include <string.h>
struct _GstVaFilter struct _GstVaFilter
{ {
@ -1260,9 +1261,7 @@ _config_color_properties (VAProcColorStandardType * std,
if (worstscore == 0) { if (worstscore == 0) {
/* No properties specified, there's not a useful choice. */ /* No properties specified, there's not a useful choice. */
*std = VAProcColorStandardNone; *std = VAProcColorStandardNone;
*props = (VAProcColorProperties) { memset (props, 0, sizeof (VAProcColorProperties));
};
return; return;
} }

View file

@ -2536,7 +2536,7 @@ static void
_insert_ref_pic_list_modification (GstH264SliceHdr * slice_hdr, _insert_ref_pic_list_modification (GstH264SliceHdr * slice_hdr,
GstVaH264EncFrame * list[16], guint list_num, gboolean is_asc) 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; guint modification_num, i;
GstH264RefPicListModification *ref_pic_list_modification = NULL; GstH264RefPicListModification *ref_pic_list_modification = NULL;
gint pic_num_diff, pic_num_lx_pred; gint pic_num_diff, pic_num_lx_pred;
@ -2716,7 +2716,7 @@ static gboolean
_add_aud (GstVaH264Enc * self, GstVaH264EncFrame * frame) _add_aud (GstVaH264Enc * self, GstVaH264EncFrame * frame)
{ {
GstVaBaseEnc *base = GST_VA_BASE_ENC (self); GstVaBaseEnc *base = GST_VA_BASE_ENC (self);
guint8 aud_data[8] = { }; guint8 aud_data[8] = { 0, };
guint size; guint size;
guint8 primary_pic_type = 0; guint8 primary_pic_type = 0;

View file

@ -538,7 +538,7 @@ _h265_fill_ptl (GstVaH265Enc * self,
.profile_space = 0, .profile_space = 0,
.tier_flag = sequence->general_tier_flag, .tier_flag = sequence->general_tier_flag,
.profile_idc = sequence->general_profile_idc, .profile_idc = sequence->general_profile_idc,
.profile_compatibility_flag = { }, .profile_compatibility_flag = { 0, },
.progressive_source_flag = 1, .progressive_source_flag = 1,
.interlaced_source_flag = 0, .interlaced_source_flag = 0,
.non_packed_constraint_flag = 0, .non_packed_constraint_flag = 0,
@ -901,7 +901,7 @@ _h265_fill_sps (GstVaH265Enc * self,
.delta_palette_max_predictor_size = 32, .delta_palette_max_predictor_size = 32,
.sps_palette_predictor_initializers_present_flag = 0, .sps_palette_predictor_initializers_present_flag = 0,
.sps_num_palette_predictor_initializer_minus1 = 0, .sps_num_palette_predictor_initializer_minus1 = 0,
.sps_palette_predictor_initializer = { }, .sps_palette_predictor_initializer = {{ 0, }},
.motion_vector_resolution_control_idc = 0, .motion_vector_resolution_control_idc = 0,
.intra_boundary_filtering_disabled_flag = 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 ? .collocated_ref_idx = (slice_param->slice_type == GST_H265_I_SLICE ?
0xFF : self->features.collocated_ref_idx), 0xFF : self->features.collocated_ref_idx),
/* not used now. */ /* not used now. */
.pred_weight_table = { }, .pred_weight_table = { 0, },
.five_minus_max_num_merge_cand = 5 - slice_param->max_num_merge_cand, .five_minus_max_num_merge_cand = 5 - slice_param->max_num_merge_cand,
.use_integer_mv_flag = 0, .use_integer_mv_flag = 0,
.qp_delta = slice_param->slice_qp_delta, .qp_delta = slice_param->slice_qp_delta,
@ -1261,7 +1261,7 @@ static gboolean
_h265_add_aud (GstVaH265Enc * self, GstVaH265EncFrame * frame) _h265_add_aud (GstVaH265Enc * self, GstVaH265EncFrame * frame)
{ {
GstVaBaseEnc *base = GST_VA_BASE_ENC (self); GstVaBaseEnc *base = GST_VA_BASE_ENC (self);
guint8 aud_data[8] = { }; guint8 aud_data[8] = { 0, };
guint size; guint size;
guint8 pic_type = 0; guint8 pic_type = 0;
@ -1692,12 +1692,12 @@ _h265_fill_slice_parameter (GstVaH265Enc * self, GstVaH265EncFrame * frame,
.delta_chroma_log2_weight_denom = 0, .delta_chroma_log2_weight_denom = 0,
.delta_luma_weight_l0 = { 0, }, .delta_luma_weight_l0 = { 0, },
.luma_offset_l0 = { 0, }, .luma_offset_l0 = { 0, },
.delta_chroma_weight_l0 = { }, .delta_chroma_weight_l0 = {{ 0, }},
.chroma_offset_l0 = { }, .chroma_offset_l0 = {{ 0, }},
.delta_luma_weight_l1 = { }, .delta_luma_weight_l1 = { 0, },
.luma_offset_l1 = { }, .luma_offset_l1 = { 0, },
.delta_chroma_weight_l1 = { }, .delta_chroma_weight_l1 = {{ 0, }},
.chroma_offset_l1 = { }, .chroma_offset_l1 = {{ 0, }},
.max_num_merge_cand = 5, .max_num_merge_cand = 5,
.slice_qp_delta = slice_qp_delta, .slice_qp_delta = slice_qp_delta,
@ -1878,9 +1878,9 @@ _h265_encode_one_frame (GstVaH265Enc * self, GstVideoCodecFrame * gst_frame)
guint list_forward_num = 0; guint list_forward_num = 0;
GstVaH265EncFrame *list_backward[16] = { NULL, }; GstVaH265EncFrame *list_backward[16] = { NULL, };
guint list_backward_num = 0; guint list_backward_num = 0;
gint negative_pocs[16] = { }; gint negative_pocs[16] = { 0, };
guint num_negative_pics = 0; guint num_negative_pics = 0;
gint positive_pocs[16] = { }; gint positive_pocs[16] = { 0, };
guint num_positive_pics = 0; guint num_positive_pics = 0;
gint collocated_poc = -1; gint collocated_poc = -1;
gint i; gint i;

View file

@ -176,7 +176,7 @@ _fill_quant_matrix (GstVp8Decoder * decoder, GstVp8Picture * picture,
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder); GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstVp8FrameHdr const *frame_hdr = &picture->frame_hdr; GstVp8FrameHdr const *frame_hdr = &picture->frame_hdr;
GstVp8Segmentation *const seg = &parser->segmentation; GstVp8Segmentation *const seg = &parser->segmentation;
VAIQMatrixBufferVP8 iq_matrix = { }; VAIQMatrixBufferVP8 iq_matrix = { 0, };
const gint8 QI_MAX = 127; const gint8 QI_MAX = 127;
gint16 qi, qi_base; gint16 qi, qi_base;
gint i; gint i;
@ -214,7 +214,7 @@ _fill_probability_table (GstVp8Decoder * decoder, GstVp8Picture * picture)
{ {
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder); GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstVp8FrameHdr const *frame_hdr = &picture->frame_hdr; GstVp8FrameHdr const *frame_hdr = &picture->frame_hdr;
VAProbabilityDataBufferVP8 prob_table = { }; VAProbabilityDataBufferVP8 prob_table = { 0, };
/* Fill in VAProbabilityDataBufferVP8 */ /* Fill in VAProbabilityDataBufferVP8 */
memcpy (prob_table.dct_coeff_probs, frame_hdr->token_probs.prob, memcpy (prob_table.dct_coeff_probs, frame_hdr->token_probs.prob,

View file

@ -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_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_FROM_INSTANCE (obj), GstVaVppClass))
#define GST_VA_VPP_CLASS(klass) ((GstVaVppClass *) klass) #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 _GstVaVpp GstVaVpp;
typedef struct _GstVaVppClass GstVaVppClass; 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_90L:
case GST_VIDEO_ORIENTATION_UL_LR: case GST_VIDEO_ORIENTATION_UL_LR:
case GST_VIDEO_ORIENTATION_UR_LL: case GST_VIDEO_ORIENTATION_UR_LL:
SWAP (from_dar_n, from_dar_d); SWAP_INT (from_dar_n, from_dar_d);
break; break;
default: default:
break; break;
@ -1332,8 +1336,8 @@ gst_va_vpp_fixate_size (GstVaVpp * self, GstPadDirection direction,
case GST_VIDEO_ORIENTATION_90L: case GST_VIDEO_ORIENTATION_90L:
case GST_VIDEO_ORIENTATION_UL_LR: case GST_VIDEO_ORIENTATION_UL_LR:
case GST_VIDEO_ORIENTATION_UR_LL: case GST_VIDEO_ORIENTATION_UR_LL:
SWAP (from_w, from_h); SWAP_INT (from_w, from_h);
SWAP (from_par_n, from_par_d); SWAP_INT (from_par_n, from_par_d);
break; break;
default: default:
break; break;