single-frame features for -features option

This commit is contained in:
Jean-Marc Valin 2021-09-15 16:02:54 -04:00
parent e4b4613d05
commit 3b8d64d746

View file

@ -99,13 +99,13 @@ int main(int argc, char **argv) {
LPCNetEncState *net;
net = lpcnet_encoder_create();
while (1) {
float features[4][NB_TOTAL_FEATURES];
short pcm[LPCNET_PACKET_SAMPLES];
float features[NB_TOTAL_FEATURES];
short pcm[LPCNET_FRAME_SIZE];
size_t ret;
ret = fread(pcm, sizeof(pcm[0]), LPCNET_PACKET_SAMPLES, fin);
if (feof(fin) || ret != LPCNET_PACKET_SAMPLES) break;
lpcnet_compute_features(net, pcm, features);
fwrite(features, sizeof(float), 4*NB_TOTAL_FEATURES, fout);
ret = fread(pcm, sizeof(pcm[0]), LPCNET_FRAME_SIZE, fin);
if (feof(fin) || ret != LPCNET_FRAME_SIZE) break;
lpcnet_compute_single_frame_features(net, pcm, features);
fwrite(features, sizeof(float), NB_TOTAL_FEATURES, fout);
}
lpcnet_encoder_destroy(net);
} else if (mode == MODE_SYNTHESIS) {