diff options
author | Diego Biurrun <diego@biurrun.de> | 2011-06-06 14:13:02 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2012-03-28 09:38:33 +0200 |
commit | a92be9b856bd11b081041c43c25d442028fe9a63 (patch) | |
tree | 32f852fdf904a30238c789e57510be710eaa7826 /libavcodec | |
parent | 856c8e0a049dc7069b7504d3aaa48549c75852de (diff) | |
download | ffmpeg-a92be9b856bd11b081041c43c25d442028fe9a63.tar.gz |
Replace memset(0) by zero initializations.
Also remove one pointless zero initialization in rangecoder.c.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/4xm.c | 6 | ||||
-rw-r--r-- | libavcodec/aaccoder.c | 3 | ||||
-rw-r--r-- | libavcodec/aacpsy.c | 6 | ||||
-rw-r--r-- | libavcodec/ac3dec.c | 4 | ||||
-rw-r--r-- | libavcodec/alsdec.c | 11 | ||||
-rw-r--r-- | libavcodec/bink.c | 3 | ||||
-rw-r--r-- | libavcodec/cook.c | 20 | ||||
-rw-r--r-- | libavcodec/dvdsubdec.c | 6 | ||||
-rw-r--r-- | libavcodec/dxva2.c | 3 | ||||
-rw-r--r-- | libavcodec/flac_parser.c | 3 | ||||
-rw-r--r-- | libavcodec/intrax8dsp.c | 6 | ||||
-rw-r--r-- | libavcodec/jpeglsenc.c | 3 | ||||
-rw-r--r-- | libavcodec/libxvid_rc.c | 9 | ||||
-rw-r--r-- | libavcodec/libxvidff.c | 21 | ||||
-rw-r--r-- | libavcodec/mjpegdec.c | 3 | ||||
-rw-r--r-- | libavcodec/motion_est.c | 3 | ||||
-rw-r--r-- | libavcodec/mpegaudiodec.c | 7 | ||||
-rw-r--r-- | libavcodec/ra144enc.c | 3 | ||||
-rw-r--r-- | libavcodec/rangecoder.c | 2 | ||||
-rw-r--r-- | libavcodec/rv34.c | 5 | ||||
-rw-r--r-- | libavcodec/smacker.c | 11 | ||||
-rw-r--r-- | libavcodec/tiff.c | 3 | ||||
-rw-r--r-- | libavcodec/truemotion1.c | 3 | ||||
-rw-r--r-- | libavcodec/wmaprodec.c | 4 | ||||
-rw-r--r-- | libavcodec/wmavoice.c | 3 |
25 files changed, 47 insertions, 104 deletions
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 139a642a47..8cc5592c73 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -552,7 +552,7 @@ static int decode_i_mb(FourXContext *f) static const uint8_t *read_huffman_tables(FourXContext *f, const uint8_t * const buf) { - int frequency[512]; + int frequency[512] = { 0 }; uint8_t flag[512]; int up[512]; uint8_t len_tab[257]; @@ -561,7 +561,6 @@ static const uint8_t *read_huffman_tables(FourXContext *f, const uint8_t *ptr = buf; int j; - memset(frequency, 0, sizeof(frequency)); memset(up, -1, sizeof(up)); start = *ptr++; @@ -661,8 +660,7 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length) for (y = 0; y < height; y += 16) { for (x = 0; x < width; x += 16) { - unsigned int color[4], bits; - memset(color, 0, sizeof(color)); + unsigned int color[4] = { 0 }, bits; // warning following is purely guessed ... color[0] = bytestream2_get_le16u(&g3); color[1] = bytestream2_get_le16u(&g3); diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 72be2a272b..36a49a7538 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -714,7 +714,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, { int start = 0, i, w, w2, g; int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels; - float dists[128], uplims[128]; + float dists[128] = { 0 }, uplims[128]; float maxvals[128]; int fflag, minscaler; int its = 0; @@ -722,7 +722,6 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, float minthr = INFINITY; //XXX: some heuristic to determine initial quantizers will reduce search time - memset(dists, 0, sizeof(dists)); //determine zero bands and upper limits for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { for (g = 0; g < sce->ics.num_swb; g++) { diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c index 8ee393ad1d..42db471428 100644 --- a/libavcodec/aacpsy.c +++ b/libavcodec/aacpsy.c @@ -389,9 +389,8 @@ static av_unused FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx, AacPsyChannel *pch = &pctx->ch[channel]; uint8_t grouping = 0; int next_type = pch->next_window_seq; - FFPsyWindowInfo wi; + FFPsyWindowInfo wi = { { 0 } }; - memset(&wi, 0, sizeof(wi)); if (la) { float s[8], v; int switch_to_eight = 0; @@ -785,9 +784,8 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio, int uselongblock = 1; int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 }; int i; - FFPsyWindowInfo wi; + FFPsyWindowInfo wi = { { 0 } }; - memset(&wi, 0, sizeof(wi)); if (la) { float hpfsmpl[AAC_BLOCK_SIZE_LONG]; float const *pf = hpfsmpl; diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index a8bc48ab6e..3056403dcf 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -753,9 +753,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) int downmix_output; int cpl_in_use; GetBitContext *gbc = &s->gbc; - uint8_t bit_alloc_stages[AC3_MAX_CHANNELS]; - - memset(bit_alloc_stages, 0, AC3_MAX_CHANNELS); + uint8_t bit_alloc_stages[AC3_MAX_CHANNELS] = { 0 }; /* block switch flags */ different_transforms = 0; diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 1b916e4ff2..35952ae21f 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1026,9 +1026,7 @@ static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame, unsigned int *js_blocks) { unsigned int b; - ALSBlockData bd; - - memset(&bd, 0, sizeof(ALSBlockData)); + ALSBlockData bd = { 0 }; bd.ra_block = ra_frame; bd.const_block = ctx->const_block; @@ -1069,9 +1067,7 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame, ALSSpecificConfig *sconf = &ctx->sconf; unsigned int offset = 0; unsigned int b; - ALSBlockData bd[2]; - - memset(bd, 0, 2 * sizeof(ALSBlockData)); + ALSBlockData bd[2] = { { 0 } }; bd[0].ra_block = ra_frame; bd[0].const_block = ctx->const_block; @@ -1337,7 +1333,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame) sizeof(*ctx->raw_samples[c]) * sconf->max_order); } } else { // multi-channel coding - ALSBlockData bd; + ALSBlockData bd = { 0 }; int b; int *reverted_channels = ctx->reverted_channels; unsigned int offset = 0; @@ -1348,7 +1344,6 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame) return -1; } - memset(&bd, 0, sizeof(ALSBlockData)); memset(reverted_channels, 0, sizeof(*reverted_channels) * avctx->channels); bd.ra_block = ra_frame; diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 4e9b1a8ca2..47f4b72733 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -233,7 +233,7 @@ static void merge(GetBitContext *gb, uint8_t *dst, uint8_t *src, int size) */ static void read_tree(GetBitContext *gb, Tree *tree) { - uint8_t tmp1[16], tmp2[16], *in = tmp1, *out = tmp2; + uint8_t tmp1[16] = { 0 }, tmp2[16], *in = tmp1, *out = tmp2; int i, t, len; tree->vlc_num = get_bits(gb, 4); @@ -244,7 +244,6 @@ static void read_tree(GetBitContext *gb, Tree *tree) } if (get_bits1(gb)) { len = get_bits(gb, 3); - memset(tmp1, 0, sizeof(tmp1)); for (i = 0; i <= len; i++) { tree->syms[i] = get_bits(gb, 4); tmp1[tree->syms[i]] = 1; diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 74378521b3..217abcf117 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -411,10 +411,10 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int *quant_index_table, int *category, int *category_index) { int exp_idx, bias, tmpbias1, tmpbias2, bits_left, num_bits, index, v, i, j; - int exp_index2[102]; - int exp_index1[102]; + int exp_index2[102] = { 0 }; + int exp_index1[102] = { 0 }; - int tmp_categorize_array[128 * 2]; + int tmp_categorize_array[128 * 2] = { 0 }; int tmp_categorize_array1_idx = p->numvector_size; int tmp_categorize_array2_idx = p->numvector_size; @@ -426,10 +426,6 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int *quant_index_table, //av_log(q->avctx, AV_LOG_ERROR, "bits_left = %d\n",bits_left); } - memset(&exp_index1, 0, sizeof(exp_index1)); - memset(&exp_index2, 0, sizeof(exp_index2)); - memset(&tmp_categorize_array, 0, sizeof(tmp_categorize_array)); - bias = -32; /* Estimate bias. */ @@ -649,14 +645,11 @@ static void decode_vectors(COOKContext *q, COOKSubpacket *p, int *category, */ static int mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer) { - int category_index[128]; + int category_index[128] = { 0 }; + int category[128] = { 0 }; int quant_index_table[102]; - int category[128]; int res; - memset(&category, 0, sizeof(category)); - memset(&category_index, 0, sizeof(category_index)); - if ((res = decode_envelope(q, p, quant_index_table)) < 0) return res; q->num_vectors = get_bits(&q->gb, p->log2_numvector_size); @@ -818,13 +811,12 @@ static int joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1, float *mlt_buffer2) { int i, j, res; - int decouple_tab[SUBBAND_SIZE]; + int decouple_tab[SUBBAND_SIZE] = { 0 }; float *decode_buffer = q->decode_buffer_0; int idx, cpl_tmp; float f1, f2; const float *cplscale; - memset(decouple_tab, 0, sizeof(decouple_tab)); memset(decode_buffer, 0, sizeof(q->decode_buffer_0)); /* Make sure the buffers are zeroed out. */ diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index ee9331cabe..83e71d1238 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -120,13 +120,12 @@ static void guess_palette(uint32_t *rgba_palette, uint8_t *alpha, uint32_t subtitle_color) { - uint8_t color_used[16]; + uint8_t color_used[16] = { 0 }; int nb_opaque_colors, i, level, j, r, g, b; for(i = 0; i < 4; i++) rgba_palette[i] = 0; - memset(color_used, 0, 16); nb_opaque_colors = 0; for(i = 0; i < 4; i++) { if (alpha[i] != 0 && !color_used[colormap[i]]) { @@ -371,14 +370,13 @@ static int is_transp(const uint8_t *buf, int pitch, int n, /* return 0 if empty rectangle, 1 if non empty */ static int find_smallest_bounding_rectangle(AVSubtitle *s) { - uint8_t transp_color[256]; + uint8_t transp_color[256] = { 0 }; int y1, y2, x1, x2, y, w, h, i; uint8_t *bitmap; if (s->num_rects == 0 || s->rects == NULL || s->rects[0]->w <= 0 || s->rects[0]->h <= 0) return 0; - memset(transp_color, 0, 256); for(i = 0; i < s->rects[0]->nb_colors; i++) { if ((((uint32_t*)s->rects[0]->pict.data[1])[i] >> 24) == 0) transp_color[i] = 1; diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c index d7d893c457..71c8405feb 100644 --- a/libavcodec/dxva2.c +++ b/libavcodec/dxva2.c @@ -86,7 +86,7 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s, struct dxva_context *ctx = avctx->hwaccel_context; unsigned buffer_count = 0; DXVA2_DecodeBufferDesc buffer[4]; - DXVA2_DecodeExecuteParams exec; + DXVA2_DecodeExecuteParams exec = { 0 }; int result; if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder, @@ -132,7 +132,6 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s, assert(buffer_count == 1 + (qm_size > 0) + 2); - memset(&exec, 0, sizeof(exec)); exec.NumCompBuffers = buffer_count; exec.pCompressedBuffers = buffer; exec.pExtensionData = NULL; diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c index 6a4032ded6..8ce7a23f8b 100644 --- a/libavcodec/flac_parser.c +++ b/libavcodec/flac_parser.c @@ -573,8 +573,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, av_fifo_generic_write(fpc->fifo_buf, (void*) read_start, read_end - read_start, NULL); } else { - int8_t pad[MAX_FRAME_HEADER_SIZE]; - memset(pad, 0, sizeof(pad)); + int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 }; av_fifo_generic_write(fpc->fifo_buf, (void*) pad, sizeof(pad), NULL); } diff --git a/libavcodec/intrax8dsp.c b/libavcodec/intrax8dsp.c index 1a62fcde77..0e79276b82 100644 --- a/libavcodec/intrax8dsp.c +++ b/libavcodec/intrax8dsp.c @@ -152,10 +152,8 @@ static void spatial_compensation_0(uint8_t *src , uint8_t *dst, int linesize){ int x,y; unsigned int p;//power divided by 2 int a; - uint16_t left_sum[2][8]; - uint16_t top_sum[2][8]; - memset(left_sum,0,2*8*sizeof(uint16_t)); - memset( top_sum,0,2*8*sizeof(uint16_t)); + uint16_t left_sum[2][8] = { { 0 } }; + uint16_t top_sum[2][8] = { { 0 } }; for(i=0;i<8;i++){ a=src[area2+7-i]<<4; diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c index d3f2e0fe84..2606706bbc 100644 --- a/libavcodec/jpeglsenc.c +++ b/libavcodec/jpeglsenc.c @@ -210,8 +210,7 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, void *last static void ls_store_lse(JLSState *state, PutBitContext *pb){ /* Test if we have default params and don't need to store LSE */ - JLSState state2; - memset(&state2, 0, sizeof(JLSState)); + JLSState state2 = { 0 }; state2.bpp = state->bpp; state2.near = state->near; ff_jpegls_reset_coding_parameters(&state2, 1); diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c index 7a0e60dd09..e87142749e 100644 --- a/libavcodec/libxvid_rc.c +++ b/libavcodec/libxvid_rc.c @@ -35,8 +35,8 @@ extern unsigned int xvid_debug; int ff_xvid_rate_control_init(MpegEncContext *s){ char *tmp_name; int fd, i; - xvid_plg_create_t xvid_plg_create; - xvid_plugin_2pass2_t xvid_2pass2; + xvid_plg_create_t xvid_plg_create = { 0 }; + xvid_plugin_2pass2_t xvid_2pass2 = { 0 }; //xvid_debug=-1; @@ -63,7 +63,6 @@ int ff_xvid_rate_control_init(MpegEncContext *s){ close(fd); - memset(&xvid_2pass2, 0, sizeof(xvid_2pass2)); xvid_2pass2.version= XVID_MAKE_VERSION(1,1,0); xvid_2pass2.filename= tmp_name; xvid_2pass2.bitrate= s->avctx->bit_rate; @@ -71,7 +70,6 @@ int ff_xvid_rate_control_init(MpegEncContext *s){ xvid_2pass2.vbv_maxrate= s->avctx->rc_max_rate; xvid_2pass2.vbv_initial= s->avctx->rc_initial_buffer_occupancy; - memset(&xvid_plg_create, 0, sizeof(xvid_plg_create)); xvid_plg_create.version= XVID_MAKE_VERSION(1,1,0); xvid_plg_create.fbase= s->avctx->time_base.den; xvid_plg_create.fincr= s->avctx->time_base.num; @@ -85,9 +83,8 @@ int ff_xvid_rate_control_init(MpegEncContext *s){ } float ff_xvid_rate_estimate_qscale(MpegEncContext *s, int dry_run){ - xvid_plg_data_t xvid_plg_data; + xvid_plg_data_t xvid_plg_data = { 0 }; - memset(&xvid_plg_data, 0, sizeof(xvid_plg_data)); xvid_plg_data.version= XVID_MAKE_VERSION(1,1,0); xvid_plg_data.width = s->width; xvid_plg_data.height= s->height; diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c index 44580d1364..0193bc8751 100644 --- a/libavcodec/libxvidff.c +++ b/libavcodec/libxvidff.c @@ -131,11 +131,11 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { uint16_t *intra, *inter; int fd; - xvid_plugin_single_t single; - struct xvid_ff_pass1 rc2pass1; - xvid_plugin_2pass2_t rc2pass2; - xvid_gbl_init_t xvid_gbl_init; - xvid_enc_create_t xvid_enc_create; + xvid_plugin_single_t single = { 0 }; + struct xvid_ff_pass1 rc2pass1 = { 0 }; + xvid_plugin_2pass2_t rc2pass2 = { 0 }; + xvid_gbl_init_t xvid_gbl_init = { 0 }; + xvid_enc_create_t xvid_enc_create = { 0 }; xvid_enc_plugin_t plugins[7]; /* Bring in VOP flags from avconv command-line */ @@ -205,7 +205,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { x->me_flags |= XVID_ME_QUARTERPELREFINE8; } - memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init)); xvid_gbl_init.version = XVID_VERSION; xvid_gbl_init.debug = 0; @@ -226,7 +225,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { xvid_global(NULL, XVID_GBL_INIT, &xvid_gbl_init, NULL); /* Create the encoder reference */ - memset(&xvid_enc_create, 0, sizeof(xvid_enc_create)); xvid_enc_create.version = XVID_VERSION; /* Store the desired frame size */ @@ -251,7 +249,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { x->twopassfile = NULL; if( xvid_flags & CODEC_FLAG_PASS1 ) { - memset(&rc2pass1, 0, sizeof(struct xvid_ff_pass1)); rc2pass1.version = XVID_VERSION; rc2pass1.context = x; x->twopassbuffer = av_malloc(BUFFER_SIZE); @@ -267,7 +264,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { plugins[xvid_enc_create.num_plugins].param = &rc2pass1; xvid_enc_create.num_plugins++; } else if( xvid_flags & CODEC_FLAG_PASS2 ) { - memset(&rc2pass2, 0, sizeof(xvid_plugin_2pass2_t)); rc2pass2.version = XVID_VERSION; rc2pass2.bitrate = avctx->bit_rate; @@ -299,7 +295,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { xvid_enc_create.num_plugins++; } else if( !(xvid_flags & CODEC_FLAG_QSCALE) ) { /* Single Pass Bitrate Control! */ - memset(&single, 0, sizeof(xvid_plugin_single_t)); single.version = XVID_VERSION; single.bitrate = avctx->bit_rate; @@ -419,8 +414,8 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt, int mb_width = (avctx->width + 15) / 16; int mb_height = (avctx->height + 15) / 16; - xvid_enc_frame_t xvid_enc_frame; - xvid_enc_stats_t xvid_enc_stats; + xvid_enc_frame_t xvid_enc_frame = { 0 }; + xvid_enc_stats_t xvid_enc_stats = { 0 }; if (!user_packet && (ret = av_new_packet(pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0) { @@ -429,9 +424,7 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt, } /* Start setting up the frame */ - memset(&xvid_enc_frame, 0, sizeof(xvid_enc_frame)); xvid_enc_frame.version = XVID_VERSION; - memset(&xvid_enc_stats, 0, sizeof(xvid_enc_stats)); xvid_enc_stats.version = XVID_VERSION; *p = *picture; diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 1c5fa79f39..5eab559f84 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -46,14 +46,13 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table, int nb_codes, int use_static, int is_ac) { - uint8_t huff_size[256]; + uint8_t huff_size[256] = { 0 }; uint16_t huff_code[256]; uint16_t huff_sym[256]; int i; assert(nb_codes <= 256); - memset(huff_size, 0, sizeof(huff_size)); ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table); for (i = 0; i < 256; i++) diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 2aa89786a1..ce802e5d1b 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -1424,9 +1424,8 @@ static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y) #define HASH(fx,fy,bx,by) ((fx)+17*(fy)+63*(bx)+117*(by)) #define HASH8(fx,fy,bx,by) ((uint8_t)HASH(fx,fy,bx,by)) int hashidx= HASH(motion_fx,motion_fy, motion_bx, motion_by); - uint8_t map[256]; + uint8_t map[256] = { 0 }; - memset(map,0,sizeof(map)); map[hashidx&255] = 1; fbmin= check_bidir_mv(s, motion_fx, motion_fy, diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index dd43beb4fe..6ed124b5f1 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -304,11 +304,8 @@ static av_cold void decode_init_static(void) for (i = 1; i < 16; i++) { const HuffTable *h = &mpa_huff_tables[i]; int xsize, x, y; - uint8_t tmp_bits [512]; - uint16_t tmp_codes[512]; - - memset(tmp_bits , 0, sizeof(tmp_bits )); - memset(tmp_codes, 0, sizeof(tmp_codes)); + uint8_t tmp_bits [512] = { 0 }; + uint16_t tmp_codes[512] = { 0 }; xsize = h->xsize; diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c index bbea9d7f2a..47f0d6d414 100644 --- a/libavcodec/ra144enc.c +++ b/libavcodec/ra144enc.c @@ -342,7 +342,7 @@ static void ra144_encode_subblock(RA144Context *ractx, const int16_t *lpc_coefs, unsigned int rms, PutBitContext *pb) { - float data[BLOCKSIZE], work[LPC_ORDER + BLOCKSIZE]; + float data[BLOCKSIZE] = { 0 }, work[LPC_ORDER + BLOCKSIZE]; float coefs[LPC_ORDER]; float zero[BLOCKSIZE], cba[BLOCKSIZE], cb1[BLOCKSIZE], cb2[BLOCKSIZE]; int16_t cba_vect[BLOCKSIZE]; @@ -360,7 +360,6 @@ static void ra144_encode_subblock(RA144Context *ractx, * Calculate the zero-input response of the LPC filter and subtract it from * input data. */ - memset(data, 0, sizeof(data)); ff_celp_lp_synthesis_filterf(work + LPC_ORDER, coefs, data, BLOCKSIZE, LPC_ORDER); for (i = 0; i < BLOCKSIZE; i++) { diff --git a/libavcodec/rangecoder.c b/libavcodec/rangecoder.c index 1cd6762cb5..b0c9f21512 100644 --- a/libavcodec/rangecoder.c +++ b/libavcodec/rangecoder.c @@ -119,7 +119,7 @@ int main(void){ uint8_t b[9*SIZE]; uint8_t r[9*SIZE]; int i; - uint8_t state[10]= {0}; + uint8_t state[10]; AVLFG prng; av_lfg_init(&prng, 1); diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index b366ead776..3ad1717d13 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -554,7 +554,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir) MpegEncContext *s = &r->s; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride; - int A[2], B[2], C[2]; + int A[2] = { 0 }, B[2] = { 0 }, C[2] = { 0 }; int has_A = 0, has_B = 0, has_C = 0; int mx, my; int i, j; @@ -562,9 +562,6 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir) const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0; int type = cur_pic->f.mb_type[mb_pos]; - memset(A, 0, sizeof(A)); - memset(B, 0, sizeof(B)); - memset(C, 0, sizeof(C)); if((r->avail_cache[6-1] & type) & mask){ A[0] = cur_pic->f.motion_val[dir][mv_pos - 1][0]; A[1] = cur_pic->f.motion_val[dir][mv_pos - 1][1]; diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 05f4a925fb..d4253873c5 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -180,7 +180,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int int res; HuffContext huff; HuffContext tmp1, tmp2; - VLC vlc[2]; + VLC vlc[2] = { { 0 } }; int escapes[3]; DBCtx ctx; int err = 0; @@ -204,9 +204,6 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int tmp2.lengths = av_mallocz(256 * sizeof(int)); tmp2.values = av_mallocz(256 * sizeof(int)); - memset(&vlc[0], 0, sizeof(VLC)); - memset(&vlc[1], 0, sizeof(VLC)); - if(get_bits1(gb)) { smacker_decode_tree(gb, &tmp1, 0, 0); skip_bits1(gb); @@ -591,8 +588,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; GetBitContext gb; - HuffContext h[4]; - VLC vlc[4]; + HuffContext h[4] = { { 0 } }; + VLC vlc[4] = { { 0 } }; int16_t *samples; uint8_t *samples8; int val; @@ -635,8 +632,6 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, samples = (int16_t *)s->frame.data[0]; samples8 = s->frame.data[0]; - memset(vlc, 0, sizeof(VLC) * 4); - memset(h, 0, sizeof(HuffContext) * 4); // Initialize for(i = 0; i < (1 << (bits + stereo)); i++) { h[i].length = 256; diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 9ca91636a1..adbd15cbeb 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -83,10 +83,9 @@ static unsigned tget(const uint8_t **p, int type, int le) { #if CONFIG_ZLIB static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src, int size) { - z_stream zstream; + z_stream zstream = { 0 }; int zret; - memset(&zstream, 0, sizeof(zstream)); zstream.next_in = src; zstream.avail_in = size; zstream.next_out = dst; diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index fcf6004c51..a3bd3730fb 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -310,7 +310,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s) int width_shift = 0; int new_pix_fmt; struct frame_header header; - uint8_t header_buffer[128]; /* logical maximum size of the header */ + uint8_t header_buffer[128] = { 0 }; /* logical maximum size of the header */ const uint8_t *sel_vector_table; header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f; @@ -321,7 +321,6 @@ static int truemotion1_decode_header(TrueMotion1Context *s) } /* unscramble the header bytes with a XOR operation */ - memset(header_buffer, 0, 128); for (i = 1; i < header.header_size; i++) header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1]; diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 65ca3c8e58..ce87aeffc2 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -521,7 +521,7 @@ static int decode_subframe_length(WMAProDecodeCtx *s, int offset) */ static int decode_tilehdr(WMAProDecodeCtx *s) { - uint16_t num_samples[WMAPRO_MAX_CHANNELS]; /**< sum of samples for all currently known subframes of a channel */ + uint16_t num_samples[WMAPRO_MAX_CHANNELS] = { 0 };/**< sum of samples for all currently known subframes of a channel */ uint8_t contains_subframe[WMAPRO_MAX_CHANNELS]; /**< flag indicating if a channel contains the current subframe */ int channels_for_cur_subframe = s->num_channels; /**< number of channels that contain the current subframe */ int fixed_channel_layout = 0; /**< flag indicating that all channels use the same subframe offsets and sizes */ @@ -538,8 +538,6 @@ static int decode_tilehdr(WMAProDecodeCtx *s) for (c = 0; c < s->num_channels; c++) s->channel[c].num_subframes = 0; - memset(num_samples, 0, sizeof(num_samples)); - if (s->max_num_subframes == 1 || get_bits1(&s->gb)) fixed_channel_layout = 1; diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index a222f09f90..ebc6a59ae9 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -318,10 +318,9 @@ static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25]) 0x0ffc, 0x0ffd, 0x0ffe, // 1111111111+00/01/10 0x3ffc, 0x3ffd, 0x3ffe, 0x3fff // 111111111111+xx }; - int cntr[8], n, res; + int cntr[8] = { 0 }, n, res; memset(vbm_tree, 0xff, sizeof(vbm_tree[0]) * 25); - memset(cntr, 0, sizeof(cntr)); for (n = 0; n < 17; n++) { res = get_bits(gb, 3); if (cntr[res] > 3) // should be >= 3 + (res == 7)) |