X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fac3dec.c;h=4b277296d159fcbd24ca95e9d6bc5f19b48e62b5;hb=0a23067ab41326dfa1da41d18923ea8547a51ff5;hp=503db5e2013af236bde4e8512ca32614b4c1781f;hpb=78d7d8fe9170f38ee0b2ab6f731ff1a61c712db5;p=ffmpeg diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 503db5e2013..4b277296d15 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -176,6 +176,11 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) AC3DecodeContext *s = avctx->priv_data; s->avctx = avctx; +#if FF_API_DRC_SCALE + if (avctx->drc_scale) + s->drc_scale = avctx->drc_scale; +#endif + ff_ac3_common_init(); ac3_tables_init(); ff_mdct_init(&s->imdct_256, 8, 1, 1.0); @@ -500,9 +505,9 @@ static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, ma mantissa = b5_mantissas[get_bits(gbc, 4)]; break; default: /* 6 to 15 */ - mantissa = get_bits(gbc, quantization_tab[bap]); /* Shift mantissa and sign-extend it. */ - mantissa = (mantissa << (32-quantization_tab[bap]))>>8; + mantissa = get_sbits(gbc, quantization_tab[bap]); + mantissa <<= 24 - quantization_tab[bap]; break; } coeffs[freq] = mantissa >> exps[freq]; @@ -788,7 +793,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) do { if(get_bits1(gbc)) { s->dynamic_range[i] = ((dynamic_range_tab[get_bits(gbc, 8)]-1.0) * - s->avctx->drc_scale)+1.0; + s->drc_scale)+1.0; } else if(blk == 0) { s->dynamic_range[i] = 1.0f; } @@ -1458,7 +1463,7 @@ static const AVOption options[] = { }; static const AVClass ac3_decoder_class = { - .class_name = "(E-)AC3 decoder", + .class_name = "AC3 decoder", .item_name = av_default_item_name, .option = options, .version = LIBAVUTIL_VERSION_INT, @@ -1480,6 +1485,12 @@ AVCodec ff_ac3_decoder = { }; #if CONFIG_EAC3_DECODER +static const AVClass eac3_decoder_class = { + .class_name = "E-AC3 decoder", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; AVCodec ff_eac3_decoder = { .name = "eac3", .type = AVMEDIA_TYPE_AUDIO, @@ -1492,6 +1503,6 @@ AVCodec ff_eac3_decoder = { .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, - .priv_class = &ac3_decoder_class, + .priv_class = &eac3_decoder_class, }; #endif