Add lpcnet_compute_single_frame_features_float()
This commit is contained in:
parent
8e2b539338
commit
d749351ae5
2 changed files with 26 additions and 4 deletions
|
@ -145,6 +145,15 @@ LPCNET_EXPORT int lpcnet_compute_features(LPCNetEncState *st, const short *pcm,
|
||||||
*/
|
*/
|
||||||
LPCNET_EXPORT int lpcnet_compute_single_frame_features(LPCNetEncState *st, const short *pcm, float features[NB_TOTAL_FEATURES]);
|
LPCNET_EXPORT int lpcnet_compute_single_frame_features(LPCNetEncState *st, const short *pcm, float features[NB_TOTAL_FEATURES]);
|
||||||
|
|
||||||
|
|
||||||
|
/** Compute features on LPCNET_FRAME_SIZE speech samples (currently 160) and output features for one 10-ms frame.
|
||||||
|
* @param [in] st <tt>LPCNetDecState*</tt>: Encoder state
|
||||||
|
* @param [in] pcm <tt>float *</tt>: Input speech to be analyzed
|
||||||
|
* @param [out] features <tt>float[NB_TOTAL_FEATURES]</tt>: Four feature vectors
|
||||||
|
* @retval 0 Success
|
||||||
|
*/
|
||||||
|
LPCNET_EXPORT int lpcnet_compute_single_frame_features_float(LPCNetEncState *st, const float *pcm, float features[NB_TOTAL_FEATURES]);
|
||||||
|
|
||||||
/** Gets the size of an <code>LPCNetState</code> structure.
|
/** Gets the size of an <code>LPCNetState</code> structure.
|
||||||
* @returns The size in bytes.
|
* @returns The size in bytes.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -894,13 +894,26 @@ LPCNET_EXPORT int lpcnet_compute_features(LPCNetEncState *st, const short *pcm,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lpcnet_compute_single_frame_features(LPCNetEncState *st, const short *pcm, float features[NB_TOTAL_FEATURES]) {
|
static int lpcnet_compute_single_frame_features_impl(LPCNetEncState *st, float *x, float features[NB_TOTAL_FEATURES]) {
|
||||||
int i;
|
|
||||||
float x[FRAME_SIZE];
|
|
||||||
for (i=0;i<FRAME_SIZE;i++) x[i] = pcm[i];
|
|
||||||
preemphasis(x, &st->mem_preemph, x, PREEMPHASIS, FRAME_SIZE);
|
preemphasis(x, &st->mem_preemph, x, PREEMPHASIS, FRAME_SIZE);
|
||||||
compute_frame_features(st, x);
|
compute_frame_features(st, x);
|
||||||
process_single_frame(st, NULL);
|
process_single_frame(st, NULL);
|
||||||
RNN_COPY(features, &st->features[0][0], NB_TOTAL_FEATURES);
|
RNN_COPY(features, &st->features[0][0], NB_TOTAL_FEATURES);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lpcnet_compute_single_frame_features(LPCNetEncState *st, const short *pcm, float features[NB_TOTAL_FEATURES]) {
|
||||||
|
int i;
|
||||||
|
float x[FRAME_SIZE];
|
||||||
|
for (i=0;i<FRAME_SIZE;i++) x[i] = pcm[i];
|
||||||
|
lpcnet_compute_single_frame_features_impl(st, x, features);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lpcnet_compute_single_frame_features_float(LPCNetEncState *st, const float *pcm, float features[NB_TOTAL_FEATURES]) {
|
||||||
|
int i;
|
||||||
|
float x[FRAME_SIZE];
|
||||||
|
for (i=0;i<FRAME_SIZE;i++) x[i] = pcm[i];
|
||||||
|
lpcnet_compute_single_frame_features_impl(st, x, features);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue