[Ffmpeg-devel] Re: PATCH: Support for AMR Interface Format 2

Andriy Tylychko mail.ru telya
Mon Sep 18 17:14:55 CEST 2006

Torsten wrote (2005-03-04):

The AMR reference code from 3GPP uses Interface Format 1 (IF1, described

in 26.101 Section 4) by default. 

This patch adds the --enable-amr_if2 option to the configure script,

which causes the AMR code to be compiled with IF2 defined. 

This in turn means that the code uses Interface Format 2 (IF2, described

in 26.101 Annex A).



Hi Torsten.
I'm not sure, does you mean that it enables IF2 for AMR-WB only? "configure
[...] --enable-amr_if2" says "...AMR-WB IF2 support yes...". What do you
think about extending it to AMR-NB too?
First, I'd like to propose to add comments to libavcodec/amr.c about this
"amr_if2" flag, and to complete that comments at all (detailed description
on request). 
Second, I'd like to propose to fix amr-nb wrapper because it makes check
that isn't compatible with IF2, libavcodec/amr.c:425
dec_mode = (buf[0] >> 3) & 0x000F;
packet_size = block_size[dec_mode]+1;
if(packet_size > buf_size) {
    av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n",
buf_size, packet_size);
    return -1;
The first line is incompatible to IF2 format, it should be: dec_mode =
buf[0] & 0x000F;
But I doubt this check is useful at all, because during 3G video call you
can receive pretty correct packets one byte smaller then predefined sizes.
And it's not a problem for reference decoder (more details on request). So
to avoid additional complexity for simple-purpose codec wrapper, I'd like to
propose to remove this check at all.
All above is about AMR-NB float. Seems like fixed-version doesn't support
IF2, so no troubles.
Updated libavcodec\amr.c can looks like attached one.
I'm new to this list, and it's my first try to contribute to open-source, so
if I do something wrong - pls don't beat but advise :)
Best regards,
Andriy Tylychko,
telia at vichnavich.com
www.vichnavich.com <http://www.vichnavich.com/> 
outsourcing to Ukraine

More information about the ffmpeg-devel mailing list