[Speex-dev] Determine number of 20ms frames in packet - without
decoding
Jean-Marc Valin
jean-marc.valin at usherbrooke.ca
Wed Feb 13 13:22:16 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().
Looking better. Just make sure to remove the stuff that isn't
C99-compatible (e.g. // comments).
> 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'll need to have a closer look at that code.
> 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.
Well, the code is a bit different (e.g. handling of in-band data), so
I'm not sure it's possible in a way that is worth it.
> 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.
frame: 20 ms encoding
sub-frame: 5 ms encoding (internal)
layer: one frame of nb or sb
sb: sub-band
wb: nb+sb
uwb: nb+sb+sb
But what you say seems right.
Cheers,
Jean-Marc
More information about the Speex-dev
mailing list