Add fwgan_load_model()
This commit is contained in:
parent
022f2b7ebc
commit
6cba42f999
2 changed files with 12 additions and 0 deletions
11
dnn/fwgan.c
11
dnn/fwgan.c
|
@ -35,6 +35,7 @@
|
||||||
#include "lpcnet.h"
|
#include "lpcnet.h"
|
||||||
#include "pitch.h"
|
#include "pitch.h"
|
||||||
#include "nnet.h"
|
#include "nnet.h"
|
||||||
|
#include "lpcnet_private.h"
|
||||||
|
|
||||||
#define FEAT_IN_SIZE (BFCC_WITH_CORR_UPSAMPLER_FC_OUT_SIZE/4 + FWGAN_FRAME_SIZE/2)
|
#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. */
|
/* 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)
|
static void fwgan_synthesize_impl(FWGANState *st, float *pcm, const float *lpc, const float *features)
|
||||||
{
|
{
|
||||||
int subframe;
|
int subframe;
|
||||||
|
|
|
@ -72,6 +72,7 @@ typedef struct {
|
||||||
} FWGANState;
|
} FWGANState;
|
||||||
|
|
||||||
void fwgan_init(FWGANState *st);
|
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);
|
void fwgan_cont(FWGANState *st, const float *pcm0, const float *features0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue