[Speex-dev] Determine number of 20ms frames in packet - without decoding

Alexander Chemeris Alexander.Chemeris at sipez.com
Wed Feb 13 12:16:27 PST 2008


Ok, here is cleaned up and fixed version.

* Function is named speex_get_num_frames() now and return
number of frames, as you suggested.
* WB layers sizes are taken from wb_skip_table[], while NB frame
sizes are calculated with speex_mode_query().

I've tested it with testenc in NB, WB and UWB modes with VBR enabled
to test in as many cases as possible. It seems to work fine.
Though, while testing I discovered possible bug - original version
of wb_skip_table[] (nb_celp.c:1081) does not seem to be correct.
Element 0 should be 4 instead of 0 and last four elements should
be -1 instead of 0 to make it compatible with speex_mode_query()
return values. So, for now I declared own version of wb_skip_table[].

I also think that having rame_num.c in libspeex, code size could be
reduced and simplified slightly by using speex_skip_wb_frame() in
nb_decode() instead of duplicating code.

>> One question - as far as I understand, to get number of samples
>> we should not parse WB frames even in (U)WB mode, becuase
>> in WB mode "meta"-frame consist of NB frame, and WB frame.
>> Is it correct?
> I don't understand your question.

You definitely have to create some dictionary of terms, used in Speex.
It's really hard to understand what is meant by "frame", "subframe"
and "layer" and how to name output of speex_encode()?
What I meant is that when encoding in WB/UWB mode every frame
consist of NB frame with one/two WB layers appended.

Alexander Chemeris.

SIP VoIP, IM and Presence Consulting
tel: +1 (617) 273-4000
-------------- next part --------------
A non-text attachment was scrubbed...
Name: frame_num.c
Type: application/octet-stream
Size: 3819 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20080213/d6c2cc22/frame_num.obj

More information about the Speex-dev mailing list