X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fac3enc.c;h=7ce17db0679f2c864b198f40b060c5c55ca1aa4f;hb=5392982241ededd6f6b041ff9ab288d0605564ea;hp=e7e18af92d5b75813552f0a3a616a3b763b723e0;hpb=398000abcf980d239a789da6f69811913d2fc635;p=ffmpeg diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index e7e18af92d5..7ce17db0679 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -652,7 +652,7 @@ void ff_ac3_process_exponents(AC3EncodeContext *s) */ static void count_frame_bits_fixed(AC3EncodeContext *s) { - static const int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 }; + static const uint8_t frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 }; int blk; int frame_bits; @@ -1065,7 +1065,7 @@ static int bit_alloc(AC3EncodeContext *s, int snr_offset) { int blk, ch; - snr_offset = (snr_offset - 240) << 2; + snr_offset = (snr_offset - 240) * 4; reset_block_bap(s); for (blk = 0; blk < s->num_blocks; blk++) { @@ -1993,12 +1993,11 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s) /* set bitstream id for alternate bitstream syntax */ if (!s->eac3 && (opt->extended_bsi_1 || opt->extended_bsi_2)) { if (s->bitstream_id > 8 && s->bitstream_id < 11) { - static int warn_once = 1; - if (warn_once) { + if (!s->warned_alternate_bitstream) { av_log(avctx, AV_LOG_WARNING, "alternate bitstream syntax is " "not compatible with reduced samplerates. writing of " "extended bitstream information will be disabled.\n"); - warn_once = 0; + s->warned_alternate_bitstream = 1; } } else { s->bitstream_id = 6; @@ -2051,7 +2050,8 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx) av_freep(&block->cpl_coord_mant); } - s->mdct_end(s); + if (s->mdct_end) + s->mdct_end(s); return 0; } @@ -2433,7 +2433,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx) ret = validate_options(s); if (ret) - return ret; + goto init_fail; avctx->frame_size = AC3_BLOCK_SIZE * s->num_blocks; avctx->initial_padding = AC3_BLOCK_SIZE;