mirror of
https://github.com/xiph/opus.git
synced 2025-06-06 23:40:50 +00:00
misc fixes
This commit is contained in:
parent
c708e68bc6
commit
ec6e42ba3d
3 changed files with 11 additions and 1 deletions
|
@ -225,6 +225,9 @@ int main(int argc, char **argv) {
|
||||||
LPCNetPLCState *net;
|
LPCNetPLCState *net;
|
||||||
if ((plc_flags&0x3) == LPCNET_PLC_NONCAUSAL) skip=extra=80;
|
if ((plc_flags&0x3) == LPCNET_PLC_NONCAUSAL) skip=extra=80;
|
||||||
net = lpcnet_plc_create(plc_flags);
|
net = lpcnet_plc_create(plc_flags);
|
||||||
|
#ifdef USE_WEIGHTS_FILE
|
||||||
|
lpcnet_plc_load_model(net, data, len);
|
||||||
|
#endif
|
||||||
while (1) {
|
while (1) {
|
||||||
size_t ret;
|
size_t ret;
|
||||||
ret = fread(pcm, sizeof(pcm[0]), FRAME_SIZE, fin);
|
ret = fread(pcm, sizeof(pcm[0]), FRAME_SIZE, fin);
|
||||||
|
@ -260,6 +263,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
fclose(fin);
|
fclose(fin);
|
||||||
fclose(fout);
|
fclose(fout);
|
||||||
|
if (plc_file) fclose(plc_file);
|
||||||
#ifdef USE_WEIGHTS_FILE
|
#ifdef USE_WEIGHTS_FILE
|
||||||
free_blob(data, len);
|
free_blob(data, len);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -83,7 +83,9 @@ LPCNET_EXPORT int lpcnet_plc_load_model(LPCNetPLCState *st, const unsigned char
|
||||||
parse_weights(&list, data, len);
|
parse_weights(&list, data, len);
|
||||||
ret = init_plc_model(&st->model, list);
|
ret = init_plc_model(&st->model, list);
|
||||||
free(list);
|
free(list);
|
||||||
if (ret == 0) return 0;
|
if (ret == 0) {
|
||||||
|
return lpcnet_load_model(&st->lpcnet, data, len);
|
||||||
|
}
|
||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,10 @@ int parse_weights(WeightArray **list, const unsigned char *data, int len)
|
||||||
*list = realloc(*list, capacity*sizeof(WeightArray));
|
*list = realloc(*list, capacity*sizeof(WeightArray));
|
||||||
}
|
}
|
||||||
(*list)[nb_arrays++] = array;
|
(*list)[nb_arrays++] = array;
|
||||||
|
} else {
|
||||||
|
free(*list);
|
||||||
|
*list = NULL;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(*list)[nb_arrays].name=NULL;
|
(*list)[nb_arrays].name=NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue