diff options
author | Peter Ross <pross@xvid.org> | 2011-02-20 12:24:48 +1100 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-02-25 15:24:35 -0500 |
commit | 8a8c283edd0da5863eb729a31a94b70820400941 (patch) | |
tree | 29fc40d537727fc49648511753f47dc755263939 /libavcodec | |
parent | a304def1dca50d63bf2a39651f84792980db3508 (diff) | |
download | ffmpeg-8a8c283edd0da5863eb729a31a94b70820400941.tar.gz |
binkaudio: simplify frame_len_bits and frame_len calculation
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/binkaudio.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index b601a01f0a..116bf5b7e6 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -81,7 +81,6 @@ static av_cold int decode_init(AVCodecContext *avctx) } else { frame_len_bits = 11; } - s->frame_len = 1 << frame_len_bits; if (avctx->channels > MAX_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels); @@ -91,14 +90,13 @@ static av_cold int decode_init(AVCodecContext *avctx) if (avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT) { // audio is already interleaved for the RDFT format variant sample_rate *= avctx->channels; - s->frame_len *= avctx->channels; s->channels = 1; - if (avctx->channels == 2) - frame_len_bits++; + frame_len_bits += av_log2(avctx->channels); } else { s->channels = avctx->channels; } + s->frame_len = 1 << frame_len_bits; s->overlap_len = s->frame_len / 16; s->block_size = (s->frame_len - s->overlap_len) * s->channels; sample_rate_half = (sample_rate + 1) / 2; |