X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fac3enc.c;h=ddbc7b247cce2e2c240c84af46f7b98a3a8474e6;hb=ffae62d96c75d4a476eb3890357c4f3e4f8bd4f5;hp=e7e18af92d5b75813552f0a3a616a3b763b723e0;hpb=fda424b300c1a0b991296aa585691609d01196bd;p=ffmpeg diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index e7e18af92d5..ddbc7b247cc 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -63,7 +63,7 @@ static const float surmixlev_options[SURMIXLEV_NUM_OPTIONS] = { #define EXTMIXLEV_NUM_OPTIONS 8 static const float extmixlev_options[EXTMIXLEV_NUM_OPTIONS] = { - LEVEL_PLUS_3DB, LEVEL_PLUS_1POINT5DB, LEVEL_ONE, LEVEL_MINUS_4POINT5DB, + LEVEL_PLUS_3DB, LEVEL_PLUS_1POINT5DB, LEVEL_ONE, LEVEL_MINUS_1POINT5DB, LEVEL_MINUS_3DB, LEVEL_MINUS_4POINT5DB, LEVEL_MINUS_6DB, LEVEL_ZERO }; @@ -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;