[FFmpeg-devel] [PATCH 4/5] binkaudio: simplify frame_len_bits and frame_len calculation
Peter Ross
pross
Wed Feb 23 13:49:54 CET 2011
On Wed, Feb 23, 2011 at 01:26:52PM +0100, Kostya wrote:
> On Sun, Feb 20, 2011 at 07:39:06AM +0100, Kostya wrote:
> > On Sun, Feb 20, 2011 at 12:24:48PM +1100, Peter Ross wrote:
> > > ---
> > > libavcodec/binkaudio.c | 6 ++----
> > > 1 files changed, 2 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
> > > index b601a01..116bf5b 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;
> > > --
> > > 1.7.1
> >
> > How many channels are possible there?
> > If just mono/stereo then ok, for non-power-of-two it may be just differently
> > wrong.
>
> Meanwhile I'm okay with the patch
Yep, just mono/stereo at this point in time.
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110223/36a50c63/attachment.pgp>
More information about the ffmpeg-devel
mailing list