[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter describes the main functions of the SPro library and should be sufficient for most implementations using the library. For more details, the reader is invited to read the source code which is, and will probably ever be, the most detailed and up-to-date description of what a function does. In particular, the library header `spro.h' gives a lot of details about functions arguments. The SPro tools(11) are good example on the use of the library functions.
Basic type definitions are voluntarily not given in the manual. Wherever necessary, accessors are given to access the most crucial members of structured types and, unless not possible otherwise, direct access should be avoided as much as possible in order to ensure a better compatibility with future versions of the library. For sake of rapidity, these accessors are mostly macros rather than functions. These accessors are described in the relevant sections.
4.1 Waveform streams Functions related to waveforms 4.2 Feature description flags Describing feature vector contents 4.3 Feature streams Reading and writing features 4.4 Storing features without streams I/O with feature buffers 4.5 Feature conversion Adding delta features, CMS, etc... 4.6 FFT-based functions FFT analysis functions 4.7 LPC-based functions LPC analysis functions 4.8 Miscellaneous functions Whatever could not go anywhere else
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes functions related to waveforms, or equivalently
signals. From now on, the term signal will be used as a synonym to
waveform unless otherwise specified. Functions related to signals are
usually prefixed with sig_
and located in `sig.c' and
`misc.c'.
4.1.1 Memory allocation Memory allocation for waveforms 4.1.2 Opening streams Opening waveform streams for reading 4.1.3 Reading frames Reading frames from a waveform stream 4.1.4 Computing frame energy
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Waveforms, or signals, are stored in a variable whose type is
spsig_t
. This type is not intended for storing waveform
streams, i.e. the entire waveform for a document, but rather
the frame samples. Therefore, no I/O functions are provided for this
data type. Every signal processing function which operates on a frame
takes as input a variable of the type spsig_t
. Memory allocation
for a signal is performed using sig_alloc
and released using
sig_free
.
NULL
in case of error.
sig_alloc
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Signals are usually read from a stream, i.e. a collection of samples, from which the frames are made. As the SPro library has been designed to process signals into feature vectors, signal streams are solely input streams and no output function is provided. Therefore, a signal stream is always opened in read mode. The following two functions are used to open a stream for reading and to close the stream when all is done. Reading frames from a stream is explained in the next section.
NULL
, input will be made from
stdin
. Valid file formats are SPRO_SIG_PCM16_FORMAT
,
SPRO_SIG_WAVE_FORMAT
and SPRO_SIG_SPHERE_FORMAT
if the
library has been compiled to support the SPHERE file
format. If fmt is SPRO_SIG_PCM16_FORMAT
, the sample rate
Fs (in Hz) must be specified. Otherwise, the sample rate is read
from the header and Fs is ignored. The input buffer size is
specified by nbytes, which means nbytes bytes will be
allocated for input. If swap is non null, byte swapping is
performed on the samples after reading them. Return a pointer to the
opened signal stream or NULL
in case of error.
sig_stream_open
, releasing
allocated memory.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Though possible, accessing directly samples in the stream is not the
purpose of signal streams in SPro. Indeed, speech processing is based on
the processing of successive overlapping frames. The library provides
function to access directly to frames, such as
get_next_sig_frame
which returns frame samples which can be
weighted using sig_weight
. Weighting vectors for standard
signal processing windows are created using set_sig_win
.
SPRO_HAMMING_WINDOW
, SPRO_HANNING_WINDOW
and
SPRO_BLACKMAN_WINDOW
. The window type SPRO_NULL_WINDOW
is
defined for the purpose of argument processing but is not a valid
argument for this function. Return a pointer to the allocated vector or
NULL
in case of error.
The following is a typical piece of code used to open a signal stream and loop on all the input frames of N samples every D samples(12).
spfstream_t *f = sig_stream_open("foo.wav", SPRO_SIG_WAVE_FORMAT, 0, 10000, 0); spsig_t *frame = sig_alloc(N); float *w = set_sig_win(N, SPRO_HAMMING_WINDOW); sample_t *buf = (sample_t *)malloc(N * sizeof(sample_t)); while (get_next_sig_frame(f, 1, N, D, 0.95, buf)) { sig_weight(frame, buf, w); /* weight signal */ /* ... */ } sig_stream_close(f); sig_free(frame); free(w); free(buf); |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Assuming the frame signal is centered, sig_normalize
compute the
frame energy and may perform energy normalization to unity.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Feature description flags are used to describe the content of a feature
vectors indicating information about mean and variance normalization,
delta features, etc. See section 4.3 Feature streams, for details. In the
library, such flags are represented as field of bits, coded as
long
integers. To avoid incomprehensible code, symbolic constants
are defined for each piece of information possibly encoded in the
feature description flag. Bit mask constants are of the form
WITHX
, where X
is one of the letter E
, Z
,
R
, D
, A
or N
. The constant
SPRO_EMPTY_FLAG
, equals to 0, can also be used to denote an empty
flag.
The two functions set_flag_bits
and get_flag_bits
can
be used to raise or check the presence of elements (bits) in the
flags. Alternatively, logical operators can be used directly on the flag
value. For example, the instruction
flag = flag | WITHZ; |
flag &
WITHZ
will be true if the bit corresponding to Z
is raised and
false otherwise. However, we recommend using the two macros for
compatibility purposes. Another way o set flags is via the function
sp_str_to_flag
which converts a string of characters to a
flag. The dual operation is implemented in sp_flag_to_str
.
flag = set_flag_bits(flag, WITHZ | WITHR) |
WITHZ
and WITHR
in flag,
corresponding to mean and variance normalization respectively. Bits
already raised in flag will be left untouched.
get_flag_bits
will be
true if at least two corresponding bits are raised in flag and
mask. For example, if mask has the value (WITHZ |
WITHR)
, get_flag_bits
will return true if flag has either
the WITHZ
or WITHR
bit raised, or, obviously, both. To
check that both bits are raised, use the following test
if (get_flag_bits(flag, WITHZ | WITHR) == (WITHZ | WITHR)) { /* ... */ } |
E
, Z
, R
,
D
, A
or N
. Return a flag where the bits
corresponding to the letters in str are raised.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes the functions related to input and output of
feature vectors. The functions are divided into three categories, namely
opening a feature stream, reading and writing features from or to a
stream and seeking to a particular position in the stream. Feature
stream functions are usually prefixed by spf_stream_
and are
located in `spf.c', `misc.c' and `header.c'.
4.3.1 Opening feature streams Opening feature streams for I/O 4.3.2 Reading and writing feature vectors Reading features from and writing features to streams 4.3.3 Seeking into a stream Access a particular frame in a stream
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes in detail feature streams open and close mechanism. The section also explains how to access stream attributes, such as fields in the variable length header or the frame rate for streams in read mode.
Conversion flags Dynamically converting features at I/O time Opening for I/O Open a feature stream Accessing stream attributes What's the stream dimension, frame rate, etc...
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In SPro, conversions such as adding dynamic features, normalization or
energy scaling are associated with streams since these are typically
global operations which cannot be carried out at the frame level. Such
conversions are indicated by a conversion flag which specifies how
the input data should be converted before output. In read mode, input
refers to the file content and output is what is returned from the read
function while, in write mode, input refers to the input of the write
function and output to the file content. The conversion flag is a flag
which indicates the processing that must be done between the input and
the output. The conversion flag is actually a feature description flag
containing the bits that should be raised in the output feature
description flag in addition to those already present in the input
description flag. For example, if the conversion flag takes the value
(WITHZ|WITHA)
and the input feature description flag, e.g. as
specified in the header of an input file, is (WITHZ|WITHD)
, the
resulting feature description for the input stream will be
(WITHZ|WITHD|WITHA)
.
Though not coded as a flag, conversion in feature streams may include
energy scaling. As this is not coded in the stream header, one must be
careful not to specify scaling twice. Energy scaling conversion is
turned on using set_stream_energy_scale
. In a very similar way,
the function set_stream_seg_length
can be used to specify
segmental normalization or scaling. Both functions should be called
between the call to open and the first call to read or write, depending
on the stream mode, in order to be effective.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
As opposed to signal streams, feature streams can be either in read or
write mode. Since the arguments are quite different in both cases, two
different functions are provided, namely spf_input_stream_open
and spf_input_stream_open
. The function
spf_stream_close
is common to input and output streams.
Feature streams have very important attributes, such as the dimension, the feature description flag, the frame rate or the variable header, for which accessors are provided. Macros to access the most important attributes are documented here under.
spf_stream_write
, dimension is dim with a
corresponding feature description flag iflag and a frame rate of
Fs Hz.. Conversion between the input features and the actual
features written to file is specified by cflag. See above for
details on conversion flags. Fields in the variable length header can be
added via a possibly NULL
array of fields hd, where
hd is a NULL terminated array of {char *name; char
*value;}
elements. See example below. Return a pointer to the feature
stream.
spf_*_stream_open
function, releasing allocated memory.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Stream attributes, such as dimension, fields in the variable length header, frame rate can be accessed using the following accessors.
stdin
and
stdout
, return NULL.
get_next_spf_stream
while, for output stream, the dimension is
the dimension as in the output header.
get_next_spf_stream
while, for output stream, the flag is the output header's flag.
NULL
if there are no attribute name.
NULL
if there are no attribute name.
NULL
terminated array of {char *name; char *value;}
elements. For example, the following code
spfheader_t *header = spf_header_init(NULL); spfield_t tab[] = { {"snr", "20 dB"}, {"date", "July 29, 2003"}, {NULL , NULL} }; spf_header_add (header, tab); |
spf_header_init
) and add the two fields `snr' and
`date' to the header along with the corresponding values. No
control is performed over duplicate field names. If several fields with
the same name are added, the first one will always be returned by
spf_header_get
and the remaining one ignored. Return the number
of fields added to the header.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The functions documented in this section are provided to read from or
write to feature streams. Reading can be done in one of two ways. You
can either read vector by vector using get_next_spf_vec
or read
in at once all the data in the feature buffer using
spf_stream_read
. Writing can only be done vector by vector using
spf_stream_write
, unless accessing directly the stream
buffer. See section 4.4 Storing features without streams, for details on this
highly not recommended operation. In write mode, the feature are
actually written to the output file when the buffer is full or when the
stream is closed. However, function spf_stream_flush
can be used
to force the output to file by flushing the buffer.
Note that the two functions spf_stream_read
and
spf_stream_write
are actually not dual functions. The first one
fills in the buffer with as much data as possible while the second one
writes some feature vectors in the stream buffer.
NULL
at the end of stream. See section 4.3.3 Seeking into a stream, for
details on how to get a particular vector in the stream.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The I/O functions described above are mainly intended for linear input
and output, i.e. for reading or writing feature vectors in a
sequential way. Though this is the most common case in speech
processing, accessing a particular feature vector directly is also very
useful. Functions to seek to a specified feature vector in a stream are
provided. Feature vectors are indexed starting from 0. In read mode,
seeking to a particular frame n using spf_stream_seek
means
that a pointer to frame n is returned by the next call to
get_next_spf_vec
. In write mode, the next call to
spf_stream_write
will start writing at frame n, thus
overwriting frame n and possibly the following if those frames add
already been set.
fseek
and specifies the reference point for
offset. If whence is equal to SEEK_SET
(0),
offset is relative to the first frame. If whence is equal to
SEEK_CUR
(1), offset is relative to the current frame in
the stream. Positioning relative to the end of the stream is not
possible since the stream length is not known. The offset can be
positive to seek forward in time or negative to seek backward. Seeking
is only possible if the file associated with f is a seekable
device, which is not the case of stdout
or stdin
. Return 0
if seek was correct or an error code (SPRO_STREAM_SEEK_ERR
)
otherwise.
spf_stream_seek(f, 0, SEEK_SET)
. Return 0 upon success.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In some programs, one may find useful to compute and keep in memory
feature vectors inside a program without accessing the disk. This is for
example the case if you want to embed feature extraction into your own
program. Feature streams are of course not adapted to such operations
which should rely on the use of feature buffers to store the
feature vectors. Feature buffers are buffers containing a collection of
feature vectors of the same dimension. Nearly no accessors are available
for the buffer structure spfbuf_t
whose attributes can be
referenced directly. The structure definition is as follows:
typedef struct { unsigned short adim; /* allocated vector dimension */ unsigned short dim; /* actual vector dimension */ unsigned long n; /* number of vectors */ unsigned long m; /* maximum number of vectors */ spf_t *s; /* pointer to features */ } spfbuf_t; |
m
is the
maximum number of vectors of dimension adim
that can be stored in
the buffer. Feature vectors are stored concatenated in the feature
array s
. Scanning the buffer vectors, using the
adim
, is illustrated in an example below.
4.4.1 Buffer allocation Allocating memory for a buffer 4.4.2 Accessing buffer elements Accessing vectors in a buffer 4.4.3 Buffer I/O Reading and writing buffers to disk 4.4.4 Buffers and streams Direct access to stream buffers (not recommended)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Functions are provided to allocate a buffer of a given size in bytes, resize for a given number of feature vectors and free a buffer.
buf->s
) set to NULL
. Return a pointer to the
allocated buffer.
NULL
), the buffer array is allocated. This function can
therefore be used to allocate a buffer for a given number of vectors
rather than for a given size in bytes as in spf_buf_alloc
. The
following code is an example for allocating a buffer of 1000 feature
vectors of dimension 33 using spf_buf_resize
.
spfbuf_t *buf = spf_buf_alloc(33, 0); /* alloc. empty buffer */ spf_buf_resize(&buf, 1000); /* resize for 1000 vectors */ |
buf->s
may be changed in spf_buf_resize
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The best way to reach a particular vector in a buffer is to grab a
pointer to the vector using get_spf_buf_vec
. In addition, the
function spf_buf_append
can be used to append feature vectors to
a buffer, possibly extending the buffer size if necessary.
NULL
is returned. If the buffer is
empty, the input vector dimension dim will be checked upon the
buffer dimension. Else, dim will be used to initialize the buffer
dimension. In any case, dim must be less than or equal to the
maximum dimension (buf->adim
) for which the buffer has been
allocated. Return a pointer to the appended vector in the buffer or
NULL
in case of error.
Access to the buffer elements via get_spf_buf_vec
implies a
multiplication. Scanning all the vectors in the buffer may result faster
using a pointer to the buffer array which is recursively
incremented. The following example illustrates this method and print to
stdout
the feature vectors in text format.
unsigned long i; unsigned short j; spf_t *p; p = buf->s; for (i = 0; i < spf_buf_length(buf); i++) { /* print vector at index i */ fprintf(stdout, "index %lu", i); for (j = 0; j < spf_buf_dim(buf); j++) fprintf(stdout, " %8.4f", *(p+j)); fprintf(stdout, "\n"); /* move to next vector */ p += buf->adim; } |
adim
,
not the actual dimension dim
. This example also illustrates the
use of the two accessors macros spf_buf_length
and
spf_buf_dim
which return the actual number of elements in the
buffer and the actual feature vector dimension respectively.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If you need the following functions to read or write the content of a buffer to disk, you should be wondering why you are not using feature streams for I/Os! Feature buffers are provided to store features in the memory not for I/Os, for which using the feature streams, dedicated to this purpose, should always be preferred. Still want to use buffer for I/Os?
Ok, but don't say you have not been warned! In case you insist on buffer
I/Os, the two functions spf_buf_read
and spf_buf_write
are
provided respectively to read the buffer content from disk or to write
the buffer content to disk.
buf->dim
. Return the number of vectors read into the buffer.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In feature streams, I/O functions clearly make use of a feature
buffer. Accessing directly the element of the stream buffer using the
buffer functions described above is therefore possible. A pointer to the
stream buffer can be obtained using spf_stream_buf
.
Unless you are quite familiar with SPro programming, direct
access to stream buffers is strongly discouraged since direct buffer
I/Os may result in corrupted stream position information. The main
consequence of corrupted stream position information is that
spf_stream_seek
and spf_stream_tell
will not work
properly. Rather than direct access to the stream buffer, the use of
spf_stream_seek
and get_next_spf_frame
to access a
particular vector should always be preferred.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Feature conversion is the process of modifying the feature description flag, for example, by normalizing the feature mean and variance or by adding dynamic features. In other word, converting features consist on modifying the input features to match a specified target feature description. See section 4.2 Feature description flags.
Changing the feature type, e.g. converting feature bank features to cepstral coefficients, is not considered as a feature conversion and is outside the scope of the function described in this section. See section 4.7 LPC-based functions, for details about changing the the feature type between various LPC representation. See section 4.6 FFT-based functions, for details about changing the filter-bank representation..
Feature conversions are global operations in the sense that the
conversion applies to a collection of feature vectors rather than to
isolated feature vectors. Therefore, the conversion function,
spf_buf_convert
, operates on a feature buffer, modifying at once
all the buffer vectors and returning a buffer (possibly the same -- see
below) containing the new features. The conversion itself is as follows
WITHE|WITHD
to
WITHE|WITHD|WITHN
, delta features will be recomputed, even though
this is not strictly necessary(13)!
Conversion can operate under three different modes, namely duplicate,
replace and update. In duplicate mode, spf_buf_convert
allocates
the output buffer and leaves the input buffer unchanged. This mode can
be used to duplicate a buffer, hence the name. In replace mode,
spf_buf_convert
allocates the output buffer and releases memory
allocated for the input buffer, thus replacing somehow the input buffer
by the output one. Note that due to reallocation, the buffer address may
have changed after the call to spf_buf_convert
. In replace mode,
calls to the conversion functions should therefore always look like
buf = spf_buf_convert(buf, SPRO_EMPTY_FLAG, WITHD, 0, SPRO_CONV_REPLACE); |
buf
. Finally, in update mode, the output buffer is the same as
the input one and conversion is done in place. For this, buffer
maximum dimension must be at least equal to the maximum of the input and
output dimensions. Otherwise update conversion is impossible and an
error is returned. In any of the three mode, spf_buf_convert
returns a pointer to the output buffer.
SPRO_CONV_DUPLICATE
,
SPRO_CONV_REPLACE
, SPRO_CONV_UPDATE
. Return a pointer to
the buffer containing the converted data.
In addition to spf_buf_convert
, the function
spf_buf_normalize
can be used to normalize the mean and variance
of the features in a buffer. Similarly, the function
spf_add_delta
can be used to compute the derivatives of some
features in a buffer. Both functions are generic functions which
should be used solely for the purpose of non-standard operations. For
example, normalizing the dynamic features or the energy variance is not
possible with spf_buf_convert
but is possible with
spf_buf_normalize
. Though not exactly a conversion function,
scale_energy
is a generic function used to scale the energy
coefficients in a buffer.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section documents all the functions related to Fourier analysis of speech signals.
4.6.1 Fourier transform Fast Fourier transform of a signal 4.6.2 Filter-bank Filter-bank integration 4.6.3 Cosine transform Discrete Cosine Transform
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SPro implements a fast Fourier transform (FFT) algorithm as described in
P. Duhamel and M. Vetterli, Improved Fourier and Hartley Transform
Algorithms: Application to CycliC Convolution of Real Data, IEEE
Trans. on ASSP, 35(6), June 1987. For sake of rapidity, the
implementation is based on a pre-computed FFT kernel which is
initialized by fft_init
. Initializing the FFT kernel for a given
FFT size is necessary before the first invocation of fft
. In
particular, this implicates that the kernel should be reinitialized
whenever the FFT size changes. Memory allocated to the kernel is
released using fft-reset
.
NULL
, in which case no value is returned. Return 0 upon
success.
fft_init(0)
which always returns 0.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Filter-bank analysis is a two step process. The first step consists in
defining the filter-bank geometry, either with set_mel_idx
or
set_alpha_idx
. Both functions set the indices in the FFT
magnitude vector of the filters' cutoff frequencies according to the
specified frequency warping. The second step is the Fourier transform
and the filter-bank integration embedded in function
log_filter_bank
. Using log_filter_bank
requires that the
FFT kernel has been initialized previously.
NULL
in case of
error.
NULL
in case of error.
set_xxx_idx
functions above. Channel log-magnitudes are
returned in vector e, previously allocated to contain at least
n elements. Return 0 upon success.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
As for the Fourier transform, discrete cosine transform (DCT) is a
kernel based transformation. A DCT kernel for a given size is
initialized using dct_init
while the transformation itself is
carried out by dct
. The macro dct_reset
resets the kernel.
dct_init(0, 0)
which always returns 0.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section documents functions related to LPC analysis of speech signals. The first part documents how to solve the LPC equations while the second one deals with transforming the LPC or PARCOR representation into a different one.
4.7.1 Linear prediction Computing linear prediction coefficients 4.7.2 LPC conversion Conversions between LPC, LAR, PARCOR and LSF
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Linear prediction is a two step process in which the first step is to
compute the generalized correlation sequence (sig_correl
) before
solving the normal equations with lpc to obtain the prediction and
reflection coefficients.
float
scalar.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Linear prediction can be converted into line spectrum frequencies
(lpc_to_lsf
) and LP-derived cepstral coefficients
(lpc_to_cep). Reflection coefficients are converted into log-area
ratio using refc_to_lar
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section documents a bunch of very useful functions. The two
functions spf_indexes
and spf_tot_dim
are dedicated to
manipulating the content of a feature vector. A feature vector contains
various elements characterized by the description
flag. spf_indexes
lets you find out where the indices of the
various elements in a feature vector given the description flag while
spf_tot_dim
computes the feature vector total dimension from the
dimension of the static coefficients and the description flag.
The function set_lifter
is a utility functions that allocates
memory for a lifter vector and initializes the vector according to the
lifter parameter.
< static ><E>< delta ><dE>< delta delta ><ddE> | | ... | | | | ... | | | | ... | | | ^ ^ ^ ^ ^ ^ ^ ^ ^ | | | | | | | | | idx[0] idx[1]| idx[3] idx[4]| idx[6] idx[7]| | | | idx[2] idx[5] idx[8] |
spf_indexes(idx, 25, WITHE | WITHD | WITHN) |
idx = { 0, 11, 0, 12, 23, 24, 0, 0, 0 } |
WITHN
), delta features are from p[12] to
p[23] and delta log-energy can be accessed at p[24].
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |