mirror of https://github.com/drowe67/LPCNet.git
simplified Makefile a bit
parent
8bd2c7e2e7
commit
88fe3634d5
100
Makefile
100
Makefile
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
CC=gcc
|
||||
CFLAGS+=-Wall -W -Wextra -Wno-unused-function -O3 -g -I../include -MD
|
||||
|
||||
LDFLAGS+=-Lsrc
|
||||
AVX2:=$(shell cat /proc/cpuinfo | grep -c avx2)
|
||||
AVX:=$(shell cat /proc/cpuinfo | grep -c avx)
|
||||
NEON:=$(shell cat /proc/cpuinfo | grep -c neon)
|
||||
|
|
@ -20,74 +20,79 @@ ifneq ($(NEON),0)
|
|||
CFLAGS+=-mfpu=neon -march=armv8-a -mtune=cortex-a53
|
||||
endif
|
||||
|
||||
PROG=dump_data test_lpcnet test_vec quant_feat tcodec2_pitch weight tdump tweak_pitch quant_test \
|
||||
PROG=dump_data test_lpcnet test_vec quant_feat tcodec2_pitch weight tdump quant_test \
|
||||
quant2c diff32 quant_enc quant_dec lpcnet_enc lpcnet_dec idct
|
||||
all: $(PROG)
|
||||
|
||||
dump_data_objs := src/dump_data.o src/freq.o src/kiss_fft.o src/pitch.o src/celt_lpc.o src/codec2_pitch.o
|
||||
dump_data_deps := $(dump_data_objs:.o=.d)
|
||||
dump_data: $(dump_data_objs)
|
||||
gcc -o $@ $(CFLAGS) $(dump_data_objs) -lm -lcodec2
|
||||
LIB=./src/liblpcnetfreedv.a
|
||||
|
||||
lpcnet_freedv_objs := src/freq.o src/kiss_fft.o src/celt_lpc.o src/pitch.o src/codec2_pitch.o \
|
||||
src/mbest.o src/lpcnet_quant.o src/4stage_pred_vq.o src/lpcnet_dump.o \
|
||||
src/4stage_pred_vq.o src/4stage_direct_split_vq.o \
|
||||
src/lpcnet.o src/nnet.o src/nnet_data.o
|
||||
lpcnet_freedv_deps := $(lpcnet_freedv_objs:.o=.d)
|
||||
./src/liblpcnetfreedv.a: $(lpcnet_freedv_objs)
|
||||
ar rcs $@ $(lpcnet_freedv_objs)
|
||||
-include $(lpcnet_freedv_deps)
|
||||
|
||||
dump_data_objs := src/dump_data.o
|
||||
dump_data_deps := $(dump_data_objs:.o=.d)
|
||||
dump_data: $(dump_data_objs) $(LIB)
|
||||
gcc -o $@ $(CFLAGS) $(dump_data_objs) $(LDFLAGS) -llpcnetfreedv -lm -lcodec2
|
||||
-include $dump_data_deps(_deps)
|
||||
|
||||
tdump_objs := src/tdump.o src/freq.o src/kiss_fft.o src/pitch.o src/celt_lpc.o src/codec2_pitch.o src/lpcnet_dump.o
|
||||
tdump_deps := $(tdump_objs:.o=.d)
|
||||
tdump: $(tdump_objs)
|
||||
gcc -o $@ $(CFLAGS) $(tdump_objs) -lm -lcodec2
|
||||
|
||||
tdump_objs := src/tdump.o
|
||||
tdump_deps := $(tdump_objs:.o=.d)
|
||||
tdump: $(tdump_objs) $(LIB)
|
||||
gcc -o $@ $(CFLAGS) $(tdump_objs) $(LDFLAGS) -llpcnetfreedv -lm -lcodec2
|
||||
-include $tdump_deps(_deps)
|
||||
|
||||
test_lpcnet_objs := src/test_lpcnet.o src/lpcnet.o src/nnet.o src/nnet_data.o src/freq.o src/kiss_fft.o src/pitch.o src/celt_lpc.o
|
||||
test_lpcnet_objs := src/test_lpcnet.o
|
||||
test_lpcnet_deps := $(test_lpcnet_objs:.o=.d)
|
||||
test_lpcnet: $(test_lpcnet_objs)
|
||||
gcc -o $@ $(CFLAGS) $(test_lpcnet_objs) -lm
|
||||
|
||||
test_lpcnet: $(test_lpcnet_objs) $(LIB)
|
||||
gcc -o $@ $(CFLAGS) $(test_lpcnet_objs) $(LDFLAGS) -llpcnetfreedv -lm
|
||||
-include $(test_lpcnet_deps)
|
||||
|
||||
test_vec_objs := src/test_vec.o
|
||||
test_vec_deps := $(test_vec_objs:.o=.d)
|
||||
test_vec: $(test_vec_objs)
|
||||
gcc -o $@ $(CFLAGS) $(test_vec_objs) -lm
|
||||
|
||||
-include $(test_vec_deps)
|
||||
|
||||
quant_feat_objs := src/quant_feat.o src/freq.o src/kiss_fft.o src/celt_lpc.o src/pitch.o src/mbest.o src/lpcnet_quant.o
|
||||
quant_feat_objs := src/quant_feat.o
|
||||
quant_feat_deps := $(quant_feat_objs:.o=.d)
|
||||
quant_feat: $(quant_feat_objs)
|
||||
gcc -o $@ $(CFLAGS) $(quant_feat_objs) -lm
|
||||
quant_feat: $(quant_feat_objs) $(LIB)
|
||||
gcc -o $@ $(CFLAGS) $(quant_feat_objs) $(LDFLAGS) -llpcnetfreedv -lm
|
||||
-include $(quant_feat_deps)
|
||||
|
||||
quant_test_objs := src/quant_test.o src/freq.o src/kiss_fft.o src/celt_lpc.o src/pitch.o src/mbest.o src/lpcnet_quant.o src/4stage_pred_vq.o
|
||||
quant_test_objs := src/quant_test.o
|
||||
quant_test_deps := $(quant_test_objs:.o=.d)
|
||||
quant_test: $(quant_test_objs)
|
||||
gcc -o $@ $(CFLAGS) $(quant_test_objs) -lm
|
||||
quant_test: $(quant_test_objs) $(LIB)
|
||||
gcc -o $@ $(CFLAGS) $(quant_test_objs) $(LDFLAGS) -llpcnetfreedv -lm
|
||||
-include $(quant_test_deps)
|
||||
|
||||
quant_enc_objs := src/quant_enc.o src/freq.o src/kiss_fft.o src/celt_lpc.o src/pitch.o src/mbest.o src/lpcnet_quant.o src/4stage_pred_vq.o
|
||||
quant_enc_objs := src/quant_enc.o
|
||||
quant_enc_deps := $(quant_enc_objs:.o=.d)
|
||||
quant_enc: $(quant_enc_objs)
|
||||
gcc -o $@ $(CFLAGS) $(quant_enc_objs) -lm
|
||||
quant_enc: $(quant_enc_objs) $(LIB)
|
||||
gcc -o $@ $(CFLAGS) $(quant_enc_objs) $(LDFLAGS) -llpcnetfreedv -lm
|
||||
-include $(quant_enc_deps)
|
||||
|
||||
quant_dec_objs := src/quant_dec.o src/freq.o src/kiss_fft.o src/celt_lpc.o src/pitch.o src/mbest.o src/lpcnet_quant.o src/4stage_pred_vq.o
|
||||
quant_dec_objs := src/quant_dec.o
|
||||
quant_dec_deps := $(quant_dec_objs:.o=.d)
|
||||
quant_dec: $(quant_dec_objs)
|
||||
gcc -o $@ $(CFLAGS) $(quant_dec_objs) -lm
|
||||
quant_dec: $(quant_dec_objs) $(LIB)
|
||||
gcc -o $@ $(CFLAGS) $(quant_dec_objs) $(LDFLAGS) -llpcnetfreedv -lm
|
||||
-include $(quant_dec_deps)
|
||||
|
||||
lpcnet_enc_objs := src/lpcnet_enc.o src/freq.o src/kiss_fft.o src/celt_lpc.o src/pitch.o src/codec2_pitch.o src/mbest.o src/lpcnet_quant.o \
|
||||
src/4stage_pred_vq.o src/lpcnet_dump.o
|
||||
lpcnet_enc_objs := src/lpcnet_enc.o
|
||||
lpcnet_enc_deps := $(lpcnet_enc_objs:.o=.d)
|
||||
lpcnet_enc: $(lpcnet_enc_objs)
|
||||
gcc -o $@ $(CFLAGS) $(lpcnet_enc_objs) -lm -lcodec2
|
||||
lpcnet_enc: $(lpcnet_enc_objs) $(LIB)
|
||||
gcc -o $@ $(CFLAGS) $(lpcnet_enc_objs) $(LDFLAGS) -llpcnetfreedv -lm -lcodec2
|
||||
-include $(lpcnet_enc_deps)
|
||||
|
||||
lpcnet_dec_objs := src/lpcnet_dec.o src/freq.o src/kiss_fft.o src/celt_lpc.o src/pitch.o src/codec2_pitch.o src/mbest.o src/lpcnet_quant.o \
|
||||
src/4stage_pred_vq.o src/lpcnet_dump.o src/lpcnet.o src/nnet.o src/nnet_data.o
|
||||
lpcnet_dec_objs := src/lpcnet_dec.o
|
||||
lpcnet_dec_deps := $(lpcnet_dec_objs:.o=.d)
|
||||
lpcnet_dec: $(lpcnet_dec_objs)
|
||||
gcc -o $@ $(CFLAGS) $(lpcnet_dec_objs) -lm -lcodec2
|
||||
lpcnet_dec: $(lpcnet_dec_objs) $(LIB)
|
||||
gcc -o $@ $(CFLAGS) $(lpcnet_dec_objs) $(LDFLAGS) -llpcnetfreedv -lm -lcodec2
|
||||
-include $(lpcnet_dec_deps)
|
||||
|
||||
quant2c_objs:= src/quant2c.o
|
||||
|
|
@ -108,29 +113,16 @@ weight: $(weight_objs)
|
|||
gcc -o $@ $(CFLAGS) $(weight_objs) -lm
|
||||
-include $(weight_deps)
|
||||
|
||||
idct_objs := src/idct.o src/freq.o src/kiss_fft.o src/celt_lpc.o src/pitch.o
|
||||
idct_objs := src/idct.o
|
||||
idct_deps := $(idct_objs:.o=.d)
|
||||
idct: $(idct_objs)
|
||||
gcc -o $@ $(CFLAGS) $(idct_objs) -lm
|
||||
idct: $(idct_objs) $(LIB)
|
||||
gcc -o $@ $(CFLAGS) $(idct_objs) $(LDFLAGS) -llpcnetfreedv -lm
|
||||
-include $(idct_deps)
|
||||
|
||||
tweak_pitch_objs := src/tweak_pitch.o
|
||||
tweak_pitch_deps := $(tweak_pitch_objs:.o=.d)
|
||||
tweak_pitch: $(tweak_pitch_objs)
|
||||
gcc -o $@ $(CFLAGS) $(tweak_pitch_objs) -lm
|
||||
|
||||
diff32: src/diff32.c
|
||||
gcc -o $@ $(CFLAGS) src/diff32.c -lm
|
||||
|
||||
-include $(tweak_pitch_deps)
|
||||
|
||||
test: test_vec
|
||||
./test_vec
|
||||
|
||||
clean:
|
||||
rm -f $(PROG)
|
||||
rm -f $(dump_data_objs) $(dump_data_deps)
|
||||
rm -f $(test_lpcnet_objs) $(test_lpcnet_deps)
|
||||
rm -f $(test_vec_objs) $(test_vec_deps)
|
||||
rm -f $(quant_feat_objs) $(quant_feat_deps)
|
||||
rm -f $(tdump_objs) $(tdump_deps)
|
||||
rm -f src/*.o src/*.d src/*.a
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
gcc -Wall -W -O3 -g -I../include dump_data.c freq.c kiss_fft.c pitch.c celt_lpc.c -o dump_data -lm
|
||||
gcc -o test_lpcnet -mavx2 -mfma -g -O3 -Wall -W -Wextra test_lpcnet.c lpcnet.c nnet.c nnet_data.c freq.c kiss_fft.c pitch.c celt_lpc.c -lm
|
||||
|
|
@ -44,9 +44,9 @@
|
|||
#undef NB_FEATURES
|
||||
#include "lpcnet.h"
|
||||
|
||||
extern int num_stages;
|
||||
extern float vq[MAX_STAGES*NB_BANDS*MAX_ENTRIES];
|
||||
extern int m[MAX_STAGES];
|
||||
extern int pred_num_stages;
|
||||
extern float pred_vq[MAX_STAGES*NB_BANDS*MAX_ENTRIES];
|
||||
extern int pred_m[MAX_STAGES];
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
FILE *fin, *fout;
|
||||
|
|
@ -59,6 +59,7 @@ int main(int argc, char **argv) {
|
|||
float weight = 1.0/sqrt(NB_BANDS);
|
||||
int pitch_bits = 6;
|
||||
float ber = 0.0;
|
||||
int num_stages = pred_num_stages;
|
||||
|
||||
/* quantiser options */
|
||||
|
||||
|
|
@ -112,7 +113,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
|
||||
LPCNET_QUANT *q = lpcnet_quant_create(num_stages, m, vq);
|
||||
LPCNET_QUANT *q = lpcnet_quant_create(num_stages, pred_m, pred_vq);
|
||||
q->weight = weight; q->pred = pred; q->mbest = mbest_survivors;
|
||||
q->pitch_bits = pitch_bits; q->dec = dec;
|
||||
lpcnet_quant_compute_bits_per_frame(q);
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@
|
|||
#include "lpcnet_dump.h"
|
||||
#include "lpcnet_quant.h"
|
||||
|
||||
extern int num_stages;
|
||||
extern float vq[MAX_STAGES*NB_BANDS*MAX_ENTRIES];
|
||||
extern int m[MAX_STAGES];
|
||||
extern int pred_num_stages;
|
||||
extern float pred_vq[MAX_STAGES*NB_BANDS*MAX_ENTRIES];
|
||||
extern int pred_m[MAX_STAGES];
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
FILE *fin, *fout;
|
||||
|
|
@ -53,7 +53,8 @@ int main(int argc, char **argv) {
|
|||
int mbest_survivors = 5;
|
||||
float weight = 1.0/sqrt(NB_BANDS);
|
||||
int pitch_bits = 6;
|
||||
|
||||
int num_stages = pred_num_stages;
|
||||
|
||||
/* quantiser options */
|
||||
|
||||
static struct option long_options[] = {
|
||||
|
|
@ -99,7 +100,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
LPCNET_DUMP *d = lpcnet_dump_create();
|
||||
LPCNET_QUANT *q = lpcnet_quant_create(num_stages, m, vq);
|
||||
LPCNET_QUANT *q = lpcnet_quant_create(num_stages, pred_m, pred_vq);
|
||||
q->weight = weight; q->pred = pred; q->mbest = mbest_survivors;
|
||||
q->pitch_bits = pitch_bits; q->dec = dec;
|
||||
lpcnet_quant_compute_bits_per_frame(q);
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@
|
|||
#define PITCH_MIN_PERIOD 32
|
||||
#define PITCH_MAX_PERIOD 256
|
||||
|
||||
extern int num_stages;
|
||||
extern float vq[MAX_STAGES*NB_BANDS*MAX_ENTRIES];
|
||||
extern int m[MAX_STAGES];
|
||||
extern int pred_num_stages;
|
||||
extern float pred_vq[MAX_STAGES*NB_BANDS*MAX_ENTRIES];
|
||||
extern int pred_m[MAX_STAGES];
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
FILE *fin, *fout;
|
||||
|
|
@ -36,6 +36,8 @@ int main(int argc, char *argv[]) {
|
|||
float weight = 1.0/sqrt(NB_BANDS);
|
||||
int pitch_bits = 6;
|
||||
|
||||
int num_stages = pred_num_stages;
|
||||
|
||||
//for(i=0; i<MAX_STAGES*NB_BANDS*MAX_ENTRIES; i++) vq[i] = 0.0;
|
||||
|
||||
static struct option long_options[] = {
|
||||
|
|
@ -79,7 +81,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
LPCNET_QUANT *q = lpcnet_quant_create(num_stages, m, vq);
|
||||
LPCNET_QUANT *q = lpcnet_quant_create(num_stages, pred_m, pred_vq);
|
||||
q->weight = weight; q->pred = pred;
|
||||
q->pitch_bits = pitch_bits; q->dec = dec;
|
||||
lpcnet_quant_compute_bits_per_frame(q);
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
#define MAX_STAGES 5 /* max number of VQ stages */
|
||||
#define NOUTLIERS 5 /* range of outilers to track in 1dB steps */
|
||||
|
||||
extern int num_stages;
|
||||
extern float vq[MAX_STAGES*NB_BANDS*MAX_ENTRIES];
|
||||
extern int m[MAX_STAGES];
|
||||
extern int pred_num_stages;
|
||||
extern float pred_vq[MAX_STAGES*NB_BANDS*MAX_ENTRIES];
|
||||
extern int pred_m[MAX_STAGES];
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
FILE *fin, *fout;
|
||||
|
|
@ -33,6 +33,7 @@ int main(int argc, char *argv[]) {
|
|||
/* weight applied to first cepstral */
|
||||
float weight = 1.0/sqrt(NB_BANDS);
|
||||
int pitch_bits = 6;
|
||||
int num_stages = pred_num_stages;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"decimate", required_argument, 0, 'd'},
|
||||
|
|
@ -75,7 +76,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
LPCNET_QUANT *q = lpcnet_quant_create(num_stages, m, vq);
|
||||
LPCNET_QUANT *q = lpcnet_quant_create(num_stages, pred_m, pred_vq);
|
||||
q->weight = weight; q->pred = pred; q->mbest = mbest_survivors;
|
||||
q->pitch_bits = pitch_bits; q->dec = dec;
|
||||
lpcnet_quant_compute_bits_per_frame(q);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@
|
|||
#define PITCH_MIN_PERIOD 32
|
||||
#define PITCH_MAX_PERIOD 256
|
||||
|
||||
// use predictive quantiser for this test
|
||||
#define num_stages pred_num_stages
|
||||
#define vq pred_vq
|
||||
#define m pred_m
|
||||
|
||||
extern int num_stages;
|
||||
extern float vq[MAX_STAGES*NB_BANDS*MAX_ENTRIES];
|
||||
extern int m[MAX_STAGES];
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
tweak_pitch.c
|
||||
David Rowe Feb 2019
|
||||
|
||||
Modify pitch of feature set, used to augment training vectors for
|
||||
low pitch speakers.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#define NB_FEATURES 55
|
||||
#define NB_BANDS 18
|
||||
#define PITCH_MIN_PERIOD 32
|
||||
#define PITCH_MAX_PERIOD 256
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
FILE *fin, *fout;
|
||||
float features[NB_FEATURES], delta_f0;
|
||||
fin = stdin; fout = stdout;
|
||||
int ret;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: %s delta_F0\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
delta_f0 = atof(argv[1]);
|
||||
|
||||
while(fread(features, sizeof(float), NB_FEATURES, fin) == NB_FEATURES) {
|
||||
// Note we work in f0 domain, rather than pitch period
|
||||
float feat = features[2*NB_BANDS];
|
||||
float pitch_index = 100*feat + 200;
|
||||
float Fs=16000.0;
|
||||
float f0 = 2*Fs/pitch_index;
|
||||
float f0_ = f0+delta_f0;
|
||||
float pitch_index_ = 2*Fs/f0_;
|
||||
if (pitch_index_ > 2*PITCH_MAX_PERIOD) pitch_index_ = 2*PITCH_MAX_PERIOD;
|
||||
if (pitch_index_ < 2*PITCH_MIN_PERIOD) pitch_index_ = 2*PITCH_MIN_PERIOD;
|
||||
assert(pitch_index_ <= 2*PITCH_MAX_PERIOD);
|
||||
assert(pitch_index_ >= 2*PITCH_MIN_PERIOD);
|
||||
|
||||
features[2*NB_BANDS] = 0.01*(pitch_index_-200);
|
||||
ret = fwrite(features, sizeof(float), NB_FEATURES, fout);
|
||||
assert(ret == NB_FEATURES);
|
||||
//fprintf(stderr, "pitch_index %f %f f0: %f %f feat: %f %f\n",
|
||||
// pitch_index, pitch_index_, f0, f0_, feat, features[2*NB_BANDS]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue