[FFmpeg-devel] [PATCH] Fixing NB AMR SID frame sizes.

Haim Alon haim.alon
Wed Mar 4 13:21:07 CET 2009


On Thu, 2009-02-26 at 11:08 -0800, Baptiste Coudurier wrote: 

> Hi,
> 
> On 2/26/2009 4:47 AM, Haim Alon wrote:
> > Hi,
> > 
> > This patch sets the proper SID frame sizes for NB AMR.
> > Regards,
> > Haim.
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > Index: libavformat/movenc.c
> > ===================================================================
> > --- libavformat/movenc.c	(revision 17607)
> > +++ libavformat/movenc.c	(working copy)
> > @@ -1721,7 +1721,7 @@
> >      if (enc->codec_id == CODEC_ID_AMR_NB) {
> >          /* We must find out how many AMR blocks there are in one packet */
> >          static uint16_t packed_size[16] =
> > -            {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 0};
> > +            {13, 14, 16, 18, 20, 21, 27, 32, 6, 7, 6, 6, 1, 1, 1, 1};
> >          int len = 0;
> >  
> >          while (len < size && samplesInChunk < 100) {
> 
> Can you please quote specs regarding this ?
> 
> Also an AMR-NB parser, to split packed frames, would be welcome.
> 


I found 2 more cases that should be part of this patch (attached).

The reference spec is 3gpp AMR speech codec frame structure (Release 7)
It can be found at : 
ftp://ftp.3gpp.org/specs/2008-12/Rel-7/26_series/26101-700.zip

The frame size info is in Table 7.

  Table 7. Number of bits for different fields in different AMR frame
                              compositions



 Frame
 Type
Index  






 Frame
 Type






 Frame
Quality
Indicator






 Mode
Indication






 Mode
Request






 Codec
  CRC






Class A






Class B






Class C






 Total






























  AMR
 Core
 Frame










   0






   4






   1






   3






   3






   8






  42






  53






   0






  114






   1






   4






   1






   3






   3






   8






  49






  54






   0






  122






   2






   4






   1






   3






   3






   8






  55






  63






   0






  137






   3






   4






   1






   3






   3






   8






  58






  76






   0






  153






   4






   4






   1






   3






   3






   8






  61






  87






   0






  167






   5






   4






   1






   3






   3






   8






  75






  84






   0






  178






   6






   4






   1






   3






   3






   8






  65






  99






  40






  223






   7






   4






   1






   3






   3






   8






  81






  103






  60






  263






   8






   4






   1






   3






   3






   8






  39






   0






   0






  58






   9






   4






   1






   3






   3






   8






  43






   0






   0






  62






  10






   4






   1






   3






   3






   8






  38






   0






   0






  57






  11






   4






   1






   3






   3






   8






  37






   0






   0






  56






  12






  Not
 used






































  13






  Not
 used






































  14






  Not
 used






































  15






   4






   0






   0






   0






   0






   0






   0






   0






   4









-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg.amr.patch
Type: text/x-patch
Size: 1640 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090304/b5abfc69/attachment.bin>



More information about the ffmpeg-devel mailing list