Skip to content

Commit

Permalink
Merge pull request #28 from mchinen/v310_exp_status_pffft_squashed
Browse files Browse the repository at this point in the history
[New version V310] 
This PR is quite large and does various things:

Squashes several internal commits that do the following.
Introduces an exponential fit for speech mode. This means the scores will differ when using speech mode, but not audio mode. As a result, the conformance version was bumped to 310, and we will apply a v3.1.0 tag.
Merges internal Status{,Or} changes from @gjasny's PR #23. In many cases I preferred the internal version even though #23 had better formatting, because it will be overwritten by the next internal export due to things like alphabetical ordering or different internal namings.
Merges pffft windows and linux repositories
  • Loading branch information
mchinen authored Oct 15, 2020
2 parents 852a12a + 27a6eba commit 5d7ae5f
Show file tree
Hide file tree
Showing 53 changed files with 1,023 additions and 429 deletions.
71 changes: 39 additions & 32 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,24 @@ exports_files(["LICENSE"])
proto_library(
name = "similarity_result",
srcs = ["src/proto/similarity_result.proto"],
visibility = ["//visibility:public"],
)

proto_library(
name = "visqol_config",
srcs = ["src/proto/visqol_config.proto"],
visibility = ["//visibility:public"],
)

cc_proto_library(
name = "similarity_result_cc_proto",
visibility = ["//visibility:public"],
deps = [":similarity_result"],
)

cc_proto_library(
name = "visqol_config_cc_proto",
visibility = ["//visibility:public"],
deps = [":visqol_config"],
)

Expand All @@ -48,52 +52,35 @@ cc_library(
# Windows Compile Opts
"/D_USE_MATH_DEFINES",
],
"@bazel_tools//src/conditions:darwin_x86_64": [
# Mac Compile Opts
],
"//conditions:default": [
# Linux Compile Opts
# Mac/Linux Compile Opts
],
}),
includes = [
"src/include",
"src/proto",
"src/svr_training",
],
linkopts = select({
"//conditions:default": [
# Linux Link Opts
],
}),
visibility = ["//visibility:public"],
deps = select({
"@bazel_tools//src/conditions:windows": [
# Windows Dependencies
"@boost//:system",
"@boost//:filesystem",
"@pffft_lib_win//:pffft_win",
],
"//conditions:default": [
# Linux Dependencies
"@boost//:system",
"@boost//:filesystem",
"@pffft_lib_linux//:pffft_linux",
],
}) + [
deps = [
":similarity_result_cc_proto",
":visqol_config_cc_proto",
"@com_google_absl//absl/base",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:usage",
"@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/flags:usage",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/synchronization",
"@com_google_absl//absl/types:optional",
"@com_google_absl//absl/types:span",
"@com_google_protobuf//:protobuf_lite",
"@svm_lib//:libsvm",
"@armadillo_headers//:armadillo_header",
"@svm_lib//:libsvm",
"@pffft_lib//:pffft_lib",
"@boost//:filesystem",
"@boost//:system",
"@com_google_protobuf//:protobuf_lite",
],
)

Expand All @@ -107,7 +94,12 @@ cc_binary(
"//model:tcdvoip_nu.568_c5.31474325639_g3.17773760038_model.txt",
],
visibility = ["//visibility:public"],
deps = [":visqol_lib"],
deps = [
":visqol_lib",
"@com_google_absl//absl/base",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
],
)

# Tests
Expand Down Expand Up @@ -152,6 +144,7 @@ test_suite(
cc_test(
name = "visqol_manager_test",
size = "large",
timeout = "long",
srcs = [
"tests/test_utility.h",
"tests/visqol_manager_test.cc",
Expand All @@ -166,6 +159,7 @@ cc_test(
"//testdata/conformance_testdata_subset:guitar48_stereo.wav",
"//testdata/conformance_testdata_subset:guitar48_stereo_64kbps_aac.wav",
],
shard_count = 15,
deps = [
":visqol_lib",
"@com_google_googletest//:gtest_main",
Expand All @@ -180,14 +174,15 @@ cc_test(
],
deps = [
":visqol_lib",
"@com_google_absl//absl/memory",
"@com_google_googletest//:gtest_main",
"@com_google_absl//absl/memory",
],
)

cc_test(
name = "visqol_api_test",
size = "medium",
timeout = "long",
srcs = ["tests/visqol_api_test.cc"],
data = [
"//model:libsvm_nu_svr_model.txt",
Expand All @@ -196,11 +191,13 @@ cc_test(
"//testdata/conformance_testdata_subset:contrabassoon48_stereo.wav",
"//testdata/conformance_testdata_subset:contrabassoon48_stereo_24kbps_aac.wav",
],
shard_count = 15,
deps = [
":similarity_result_cc_proto",
":visqol_config_cc_proto",
":visqol_lib",
"@com_google_googletest//:gtest_main",
"@com_google_absl//absl/status",
],
)

Expand Down Expand Up @@ -253,20 +250,25 @@ cc_test(
deps = [
":visqol_lib",
"@com_google_googletest//:gtest_main",
"@com_google_absl//absl/status:statusor",
],
)

cc_test(
name = "conformance_test",
size = "large",
timeout = "long",
srcs = [
"tests/conformance_test.cc",
"tests/test_utility.h",
],
data = [
"//model:libsvm_nu_svr_model.txt",
"//testdata:alignment/degraded.wav",
"//testdata:alignment/reference.wav",
"//testdata:clean_speech/CA01_01.wav",
"//testdata:clean_speech/transcoded_CA01_01.wav",
"//testdata:short_duration/5_second/guitar48_stereo_5_sec.wav",
"//testdata/conformance_testdata_subset:castanets48_stereo.wav",
"//testdata/conformance_testdata_subset:contrabassoon48_stereo.wav",
"//testdata/conformance_testdata_subset:contrabassoon48_stereo_24kbps_aac.wav",
Expand All @@ -287,6 +289,7 @@ cc_test(
"//testdata/conformance_testdata_subset:strauss48_stereo.wav",
"//testdata/conformance_testdata_subset:strauss48_stereo_lp35.wav",
],
shard_count = 15,
deps = [
":visqol_lib",
"@com_google_googletest//:gtest_main",
Expand All @@ -305,8 +308,8 @@ cc_test(
],
deps = [
":visqol_lib",
"@com_google_absl//absl/memory",
"@com_google_googletest//:gtest_main",
"@com_google_absl//absl/memory",
],
)

Expand Down Expand Up @@ -383,9 +386,11 @@ cc_test(
data = [
"//model:libsvm_nu_svr_model.txt",
"//testdata:mismatched_duration/guitar48_stereo_middle_2sec_cut.wav",
"//testdata:mismatched_duration/guitar48_stereo_middle_50ms_cut.wav",
"//testdata:mismatched_duration/guitar48_stereo_x2.wav",
"//testdata/conformance_testdata_subset:guitar48_stereo.wav",
],
shard_count = 15,
deps = [
":visqol_lib",
"@com_google_googletest//:gtest_main",
Expand Down Expand Up @@ -423,8 +428,8 @@ cc_test(
],
deps = [
":visqol_lib",
"@com_google_absl//absl/memory",
"@com_google_googletest//:gtest_main",
"@com_google_absl//absl/memory",
],
)

Expand All @@ -451,6 +456,7 @@ cc_test(
cc_test(
name = "multithreading_test",
size = "medium",
timeout = "long",
srcs = [
"tests/multithreading_test.cc",
"tests/test_utility.h",
Expand Down Expand Up @@ -478,8 +484,8 @@ cc_test(
],
data = [
"//model:libsvm_nu_svr_model.txt",
"//testdata:long_duration/1_min/guitar48_stereo_deg_1min.wav",
"//testdata:long_duration/1_min/guitar48_stereo_ref_1min.wav",
"//testdata:long_duration/1_min/guitar48_stereo_deg_25s.wav",
"//testdata:long_duration/1_min/guitar48_stereo_ref_25s.wav",
],
deps = [
":visqol_lib",
Expand Down Expand Up @@ -507,5 +513,6 @@ cc_test(
deps = [
":visqol_lib",
"@com_google_googletest//:gtest_main",
"@com_google_absl//absl/status",
],
)
37 changes: 9 additions & 28 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -159,47 +159,28 @@ pybind_library(
"""
)

##################
# Platform Linux #
##################
# PFFFT - Linux
# PFFFT
new_git_repository(
name = "pffft_lib_linux",
name = "pffft_lib",
remote = "https://bitbucket.org/jpommier/pffft.git",
branch = "master",
build_file_content = """
cc_library(
name = "pffft_linux",
name = "pffft_lib",
srcs = glob(["pffft.c"]),
hdrs = glob(["pffft.h"]),
visibility = ["//visibility:public"],
)
""",
)

####################
# Platform Windows #
####################
# PFFFT - Windows
new_git_repository(
name = "pffft_lib_win",
remote = "https://bitbucket.org/jpommier/pffft.git",
branch = "master",
build_file_content = """
cc_library(
name = "pffft_win",
srcs = glob(["pffft.c"]),
hdrs = glob(["pffft.h"]),
copts = [
"/D_USE_MATH_DEFINES",
"/W0",
copts = select({
"@bazel_tools//src/conditions:windows": [
"/D_USE_MATH_DEFINES",
"/W0",
],
"//conditions:default": [
]}),
visibility = ["//visibility:public"],
)
""",
)


load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
Expand Down
2 changes: 2 additions & 0 deletions python/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ licenses(["notice"])
pybind_extension(
name = "visqol_lib_py",
srcs = ["visqol_lib_py.cc"],
visibility = ["//visibility:public"],
deps = [
"@com_google_absl//absl/status",
"@pybind11_bazel//:pybind11_eigen",
"@pybind11_abseil//:absl_casters",
"@pybind11_abseil//:absl_numpy_span_caster",
"@pybind11_abseil//:status_casters",
"@pybind11_protobuf//:proto_casters",
"//third_party/visqol:similarity_result_cc_proto",
"//:visqol_config_cc_proto",
"//:visqol_lib",
],
Expand Down
6 changes: 6 additions & 0 deletions python/visqol_lib_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
#include "conformance.h"
#include "visqol_api.h"
#include "visqol_manager.h"
#include "third_party/visqol/src/proto/similarity_result.proto.h"
#include "src/proto/visqol_config.pb.h"

namespace Visqol {

PYBIND11_MODULE(visqol_lib_py, m) {
pybind11::google::ImportStatusModule();
pybind11::google::ImportProtoModule();

m.doc() = "ViSQOL plugin";
m.def("ConformanceSpeechCA01TranscodedValue",
[]() { return kConformanceSpeechCA01Transcoded; });
Expand All @@ -31,6 +35,8 @@ PYBIND11_MODULE(visqol_lib_py, m) {
pybind11::class_<Visqol::FilePath>(m, "FilePath")
.def(pybind11::init<const std::string &>());

pybind11::google::RegisterProtoMessageType<SimilarityResultMsg>(m);

m.def("MakeVisqolConfig", []() { return Visqol::VisqolConfig(); });
}
} // namespace Visqol
Loading

0 comments on commit 5d7ae5f

Please sign in to comment.