From 478455d66b80e335bdabc00df5dee298d630cbab Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 25 May 2011 20:12:57 -0400 Subject: ac3enc: initialize all coefficients to zero. Uninitialized coefficients were being used to generate exponents, some of which actually ended up in the final stream. Even though, they were just extra exponents that are not used by any decoder, it is still better to have consistent output for testing. This also fixes valgrind errors. --- libavcodec/ac3enc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 5014fdb753..ec3ffb30e4 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -583,8 +583,8 @@ static inline float calc_cpl_coord(float energy_ch, float energy_cpl) static void apply_channel_coupling(AC3EncodeContext *s) { #if CONFIG_AC3ENC_FLOAT - DECLARE_ALIGNED(16, float, cpl_coords) [AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16]; - DECLARE_ALIGNED(16, int32_t, fixed_cpl_coords)[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16]; + DECLARE_ALIGNED(16, float, cpl_coords) [AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}}; + DECLARE_ALIGNED(16, int32_t, fixed_cpl_coords)[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}}; int blk, ch, bnd, i, j; CoefSumType energy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}}; int num_cpl_coefs = s->num_cpl_subbands * 12; @@ -2658,8 +2658,8 @@ static av_cold int allocate_buffers(AVCodecContext *avctx) AC3_MAX_COEFS * sizeof(*s->bap_buffer), alloc_fail); FF_ALLOC_OR_GOTO(avctx, s->bap1_buffer, AC3_MAX_BLOCKS * channels * AC3_MAX_COEFS * sizeof(*s->bap1_buffer), alloc_fail); - FF_ALLOC_OR_GOTO(avctx, s->mdct_coef_buffer, AC3_MAX_BLOCKS * channels * - AC3_MAX_COEFS * sizeof(*s->mdct_coef_buffer), alloc_fail); + FF_ALLOCZ_OR_GOTO(avctx, s->mdct_coef_buffer, AC3_MAX_BLOCKS * channels * + AC3_MAX_COEFS * sizeof(*s->mdct_coef_buffer), alloc_fail); FF_ALLOC_OR_GOTO(avctx, s->exp_buffer, AC3_MAX_BLOCKS * channels * AC3_MAX_COEFS * sizeof(*s->exp_buffer), alloc_fail); FF_ALLOC_OR_GOTO(avctx, s->grouped_exp_buffer, AC3_MAX_BLOCKS * channels * @@ -2723,8 +2723,8 @@ static av_cold int allocate_buffers(AVCodecContext *avctx) } if (CONFIG_AC3ENC_FLOAT) { - FF_ALLOC_OR_GOTO(avctx, s->fixed_coef_buffer, AC3_MAX_BLOCKS * channels * - AC3_MAX_COEFS * sizeof(*s->fixed_coef_buffer), alloc_fail); + FF_ALLOCZ_OR_GOTO(avctx, s->fixed_coef_buffer, AC3_MAX_BLOCKS * channels * + AC3_MAX_COEFS * sizeof(*s->fixed_coef_buffer), alloc_fail); for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; FF_ALLOCZ_OR_GOTO(avctx, block->fixed_coef, channels * -- cgit v1.2.3 From e16942852979c44faaa8fcd6ad95d1ff3642368b Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 26 May 2011 13:37:13 +0200 Subject: Mark parameterless function declarations as 'void'. --- libavcodec/bink.c | 2 +- libavformat/network.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 34d4d10fae..e085aa54e2 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1208,7 +1208,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac /** * Caclulate quantization tables for version b */ -static av_cold void binkb_calc_quant() +static av_cold void binkb_calc_quant(void) { uint8_t inv_bink_scan[64]; double s[64]; diff --git a/libavformat/network.h b/libavformat/network.h index 881384c943..db8466ce20 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -33,7 +33,8 @@ #define ECONNREFUSED WSAECONNREFUSED #define EINPROGRESS WSAEINPROGRESS -static inline int ff_neterrno() { +static inline int ff_neterrno(void) +{ int err = WSAGetLastError(); switch (err) { case WSAEWOULDBLOCK: -- cgit v1.2.3