X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fapedec.c;h=59be99694e4799f3bce45625e351455d2cddfd6f;hb=cc9c5126387a1d8093ca8cc1df6ab2c535c35dba;hp=83281c1035e3cfd4265b6d0046d86a207c8479d4;hpb=eca0bcb66ebb23200efe056a453560dbb68608ac;p=ffmpeg diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 83281c1035e..59be99694e4 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -27,7 +27,7 @@ #include "bytestream.h" /** - * @file apedec.c + * @file libavcodec/apedec.c * Monkey's Audio lossless audio decoder */ @@ -171,7 +171,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx) av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n"); return -1; } - if (avctx->bits_per_sample != 16) { + if (avctx->bits_per_coded_sample != 16) { av_log(avctx, AV_LOG_ERROR, "Only 16-bit samples are supported\n"); return -1; } @@ -199,6 +199,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx) dsputil_init(&s->dsp, avctx); avctx->sample_fmt = SAMPLE_FMT_S16; + avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; return 0; } @@ -247,6 +248,7 @@ static inline void range_dec_normalize(APEContext * ctx) /** * Calculate culmulative frequency for next symbol. Does NO update! + * @param ctx decoder context * @param tot_f is the total frequency or (code_value)1<k ? (1 << (rice->k + 4)) : 0; rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5); - if (rice->k == 0) - rice->k = 1; - else if (rice->ksum < (1 << (rice->k + 4))) + if (rice->ksum < lim) rice->k--; else if (rice->ksum >= (1 << (rice->k + 5))) rice->k++;