[FFmpeg-devel] [HOWTO] Building FFmpeg for iPhone

Reimar Döffinger Reimar.Doeffinger
Thu Oct 8 14:08:30 CEST 2009


On Thu, Oct 08, 2009 at 02:03:04PM +0200, Reimar D?ffinger wrote:
> On Thu, Oct 08, 2009 at 12:03:57PM +0100, M?ns Rullg?rd wrote:
> > David Conrad <lessen42 at gmail.com> writes:
> > 
> > > On Oct 7, 2009, at 10:07 AM, Jason Millard wrote:
> > >
> > >> --arch=arm --extra-cflags='-arch armv6' --extra-ldflags='-arch armv6'
> > >> Thanks. that did the trick. With my tests, mp3 decoding is fine, but
> > >> aac
> > >> decoding is mostly static -- (almost like the volume is amplified)
> > >
> > > Reproduced, it's because the aac and dca decoders check for the C
> > > version of float_to_int16 but use float_to_int16_interleave, which
> > > doesn't have a VFP version.
> > >
> > > Patch attached
> > >
> > >
> > > commit 2f891fb5b0097b000303e0ee4d085a492dbc7fed
> > > Author: David Conrad <lessen42 at gmail.com>
> > > Date:   Thu Oct 8 06:50:21 2009 -0400
> > >
> > >     dca and aac decoders use float_to_int16_interleave, so check for
> > >     the C version of that rather than float_to_int16.
> > >     Fixes output on ARM/VFP
> > >
> > > diff --git a/libavcodec/aac.c b/libavcodec/aac.c
> > > index 2dc7960..68a007b 100644
> > > --- a/libavcodec/aac.c
> > > +++ b/libavcodec/aac.c
> > > @@ -527,7 +527,7 @@ static av_cold int aac_decode_init(AVCodecContext *avccontext)
> > >      // 32768 - Required to scale values to the correct range for the bias method
> > >      //         for float to int16 conversion.
> > >
> > > -    if (ac->dsp.float_to_int16 == ff_float_to_int16_c) {
> > > +    if (ac->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
> > >          ac->add_bias  = 385.0f;
> > >          ac->sf_scale  = 1. / (-1024. * 32768.);
> > >          ac->sf_offset = 0;
> > > diff --git a/libavcodec/dca.c b/libavcodec/dca.c
> > > index b68e547..e411c36 100644
> > > --- a/libavcodec/dca.c
> > > +++ b/libavcodec/dca.c
> > > @@ -1324,7 +1324,7 @@ static av_cold int dca_decode_init(AVCodecContext * avctx)
> > >          s->samples_chanptr[i] = s->samples + i * 256;
> > >      avctx->sample_fmt = SAMPLE_FMT_S16;
> > >
> > > -    if(s->dsp.float_to_int16 == ff_float_to_int16_c) {
> > > +    if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
> > >          s->add_bias = 385.0f;
> > >          s->scale_bias = 1.0 / 32768.0;
> > >      } else {
> > 
> > The idea of checking those functions like that is dreadful, but this
> > doesn't make it any worse, and it does fix a bug.  I say apply.
> 
> Maybe those values (385.0f, 1.0 / 32768.0) should just be added to the DspContext?
> Of course that depends on what sf_offset is and what its meaning is...

And also why on earth dca downmixing is disabled for the float_to_int16
c version. Well, I can imagine why, but it seems like a horrible idea to
make such a feature depend on CPU extensions, no downmixing at all sure
seems preferable to me over that kind of mess.



More information about the ffmpeg-devel mailing list