Add fwgan_load_model()

This commit is contained in:
Jean-Marc Valin 2023-08-04 16:16:58 -04:00
parent 022f2b7ebc
commit 6cba42f999
No known key found for this signature in database
GPG key ID: 531A52533318F00A
2 changed files with 12 additions and 0 deletions

View file

@ -35,6 +35,7 @@
#include "lpcnet.h"
#include "pitch.h"
#include "nnet.h"
#include "lpcnet_private.h"
#define FEAT_IN_SIZE (BFCC_WITH_CORR_UPSAMPLER_FC_OUT_SIZE/4 + FWGAN_FRAME_SIZE/2)
@ -269,6 +270,16 @@ void fwgan_init(FWGANState *st)
/* FIXME: perform arch detection. */
}
int fwgan_load_model(FWGANState *st, const unsigned char *data, int len) {
WeightArray *list;
int ret;
parse_weights(&list, data, len);
ret = init_fwgan(&st->model, list);
free(list);
if (ret == 0) return 0;
else return -1;
}
static void fwgan_synthesize_impl(FWGANState *st, float *pcm, const float *lpc, const float *features)
{
int subframe;

View file

@ -72,6 +72,7 @@ typedef struct {
} FWGANState;
void fwgan_init(FWGANState *st);
int fwgan_load_model(FWGANState *st, const unsigned char *data, int len);
void fwgan_cont(FWGANState *st, const float *pcm0, const float *features0);