[Speex-dev] 8.4kbps data rate in 8kbps nb mode

Jean-Marc Valin Jean-Marc.Valin at USherbrooke.ca
Fri Nov 18 01:30:45 PST 2005


Indeed there was a bug in the speex_bits_insert_terminator() function.
It's now fixed in svn. The only people this bug affected are the ones
relying on detection of the end of packed Speex frames and some wasted
bytes when using 8 kbps mode.

	Jean-Marc


Le jeudi 17 novembre 2005 à 23:18 +0000, Andrew White a écrit :
> Hi Jean-Marc,
> 
> Thanks for your response.
> 
> I wrote a script to remove the Speex bits from an Ogg file - As I'm using 
> CBR
> mode I already know the number of bits in each frame and can do without the 
> Ogg
> overhead.
> 
> In the Ogg Format you have a segment table that shows the length of each
> segment. When --nframes is set to the default of 1, one Speex frame equals 
> one
> segment/packet.
> 
> If you encode at 8kbps each segment is 0x15(21) bytes long, if you encode at
> 15kbps each segment is 0x26(38) bytes long. You can easily see this if you 
> view
> the Speex file with a Hex text editor as the segment table is the segment 
> size
> repeated several times.
> 
> In 15kbps mode you get 300 Speex bits in one frame. This fits in the 38 byte
> segment with 4 bits to spare. I expected 160 Speex bits in 8kbps mode to fit
> into a segment 20 bytes long, but speexenc gives a file with 21 byte 
> segments.
> 
> If I drop the 21st byte and decode the stream I don't seem to get any loss 
> of
> quality, so I was wondering if it was extraneous data, or if the Ogg segment
> needs to be slightly larger than the Speex data for another reason. I looked
> through the code, but couldn't see why the segment size would need to be 
> larger
> than the Speex data itself.
> 
> Andy
> 
> 
> 
> 
> >From: Jean-Marc Valin <Jean-Marc.Valin at USherbrooke.ca>
> >To: Andy White <andrewmarkwhite at hotmail.com>
> >CC: speex-dev at xiph.org
> >Subject: Re: [Speex-dev] 8.4kbps data rate in 8kbps nb mode
> >Date: Fri, 18 Nov 2005 09:00:08 +1100
> >
> >I'm not aware of this. How did you measure this value? Note that in
> >practice, there is a small overhead to Ogg packets.
> >
> >	Jean-Marc
> >
> >Le mercredi 16 novembre 2005 à 12:18 +0000, Andy White a écrit :
> > > I know that most of the narrow band submodes don't have an exact 
> >multiple of
> > > eight bits in each frame
> > >
> > > 79 bits for 3.95kbps
> > > 119 bits for 5.95kbps ...etc
> > >
> > > This means that you have a few unused bits when transporting Speex in 
> >the Ogg
> > > format (you can achieve a lower number of unused bits if you change the 
> >number
> > > of frames per Ogg packet to suit the mode).
> > >
> > > However, in 8kbps mode, the number of bits per frame is 160. I would 
> >have
> > > expected this to fit into an Ogg segment 20 bytes long. However, when I 
> >use
> > > (speexenc -n --quality 3) to encode at 8kbps the Ogg segments are each 
> >21 bytes
> > > long.
> > >
> > > Is this an error, or is there extra information put in the 21st byte?
> > >
> > > I'll have a hunt through the code, but thought someone might have come 
> >across
> > > this before.
> > >
> > > Regards,
> > >
> > > Andy
> > >
> > > _______________________________________________
> > > Speex-dev mailing list
> > > Speex-dev at xiph.org
> > > http://lists.xiph.org/mailman/listinfo/speex-dev
> > >
> 
> 
> 


More information about the Speex-dev mailing list