Skip to content

Commit

Permalink
Add missing delta from non-squashed version.
Browse files Browse the repository at this point in the history
  • Loading branch information
mchinen committed Oct 15, 2020
1 parent f116bc2 commit 27a6eba
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 33 deletions.
43 changes: 19 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ ViSQOL (Virtual Speech Quality Objective Listener) is an objective, full-referen
- [API Usage](#api-usage)
- [Dependencies](#dependencies)
- [License](#license)
- [Papers](#papers)
- [FAQ](#faq)
- [Acknowledgement](#acknowledgement)

## Features
ViSQOL can be run from the command line, or integrated into a project and used through its API. Whether being used from the command line, or used through the API, ViSQOL is capable of running in two modes:
Expand All @@ -28,31 +31,21 @@ ViSQOL can be run from the command line, or integrated into a project and used t
#### Linux Build Instructions
1. ##### Install Bazel
- Bazel can be install for Linux from [here](https://docs.bazel.build/versions/master/install-ubuntu.html).
- Tested with Bazel version 0.22.0.
2. ##### Install Boost
- Boost can be installed on Linux with the following command: `sudo apt-get install libboost-all-dev`
- Tested with Boost version 1.65.0.
3. ##### Build ViSQOL
- Tested with Bazel version `3.4.1`.
2. ##### Build ViSQOL
- Change directory to the root of the ViSQOL project (i.e. where the WORKSPACE file is) and run the following command: `bazel build :visqol -c opt`

#### Windows Build Instructions (Experimental, last Tested on Windows 10 x64, 2019 March)
#### Windows Build Instructions (Experimental, last Tested on Windows 10 x64, 2020 August)

1. ##### Install Visual Studio
- Bazel requires Visual Studio 2015 or later. See further details [here](https://docs.bazel.build/versions/master/windows.html#build-c).
- Install Visual Studio from [here](https://visualstudio.microsoft.com/vs/community/). Ensure that the C++ build tools are installed and the Windows SDK e.g. the 'Desktop development with C++' option in the VS installer.

2. ##### Install Bazel
1. ##### Install Bazel
- Bazel can be install for Windows from [here](https://docs.bazel.build/versions/master/windows.html).
- Tested with Bazel version 0.22.0.

3. ##### Install Boost
- Tested with version 1.60.0.
- Download the Windows version from [here](https://www.boost.org/users/history/version_1_60_0.html).
- Extract the contents of the download to the `C:` directory, and rename the extracted folder to remove any version info. You should now have the following directory structure: `C:\boost`
- Navigate to this directory and build the Boost binaries for x64. For version 1.60.0, these instructions can be found [here](https://www.boost.org/doc/libs/1_60_0/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary).
- Tested with Bazel version `3.5.0`.

2. ##### Install git
- `git` for Windows can be obtained from the [official git website](https://git-scm.com/downloads).
- When installing, select the option that allows `git` to be accessed from the system shells.

4. ##### Build ViSQOL:
3. ##### Build ViSQOL:
- Change directory to the root of the ViSQOL project (i.e. where the WORKSPACE file is) and run the following command: `bazel build :visqol -c opt`

## Command Line Usage
Expand Down Expand Up @@ -195,7 +188,7 @@ int main(int argc, char **argv) {
// Create an instance of the ViSQOL API. A new instance
// is required for each signal pair to be compared.
Visqol::VisqolApi visqol;
util::Status status = visqol.Create(config);
absl::Status status = visqol.Create(config);

// Ensure that the creation succeeded.
if (!status.ok()) {
Expand All @@ -214,7 +207,7 @@ int main(int argc, char **argv) {
}

// Extract the comparison result from the StatusOr.
Visqol::SimilarityResultMsg similarity_result = comparison_status_or.ValueOrDie();
Visqol::SimilarityResultMsg similarity_result = comparison_status_or.value();

// Get the "Mean Opinion Score - Listening Quality Objective" for the degraded
// signal, following the comparison to the reference signal.
Expand Down Expand Up @@ -291,9 +284,11 @@ Use of this source code is governed by a Apache v2.0 license that can be found i
There have been several papers that describe the design of the ViSQOL algorithm and compare it to other metrics.
These three should serve as an overview:
[ViSQOL: The virtual speech quality objective listener](https://arrow.dit.ie/cgi/viewcontent.cgi?article=1168&context=scschcomcon) (IWAENC 2012)
[Robustness of speech quality metrics to background noise and network degradations: Comparing ViSQOL, PESQ and POLQA](https://arrow.dit.ie/cgi/viewcontent.cgi?article=1160&context=scschcomcon) (ICASSP 2013)
[ViSQOLAudio: An objective audio quality metric for low bitrate codecs](https://asa.scitation.org/doi/full/10.1121/1.4921674) (Journal of the Acoustic Society of America, 2015)
[ViSQOL v3: An Open Source Production Ready Objective Speech and Audio Metric](https://arxiv.org/abs/2004.09584) (2020 Twelfth International Conference on Quality of Multimedia Experience (QoMEX))
[ViSQOL: an objective speech quality model](https://asmp-eurasipjournals.springeropen.com/track/pdf/10.1186/s13636-015-0054-9) (2015 EURASIP Journal on Audio, Speech, and Music Processing)
[Objective Assessment of Perceptual Audio Quality Using ViSQOLAudio](https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7940042) (The 2017 IEEE Transactions on Broadcasting)
## FAQ
Expand Down
5 changes: 2 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,10 @@ cc_library(
copts = select({
"@bazel_tools//src/conditions:windows": [
"/D_USE_MATH_DEFINES",
"/W0",
],
"//conditions:default": [
]) + [
"/W0",
]
]}),
visibility = ["//visibility:public"],
)
""",
Expand Down
19 changes: 13 additions & 6 deletions src/include/fft_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,26 @@
#ifndef VISQOL_INCLUDE_FFT_MANAGER_H
#define VISQOL_INCLUDE_FFT_MANAGER_H

#include <xmmintrin.h>
#if defined(__x86_64__) || defined(_M_X64) || defined(i386) || defined(_M_IX86)
#include <xmmintrin.h>
typedef __m128 SimdVector;
#define SIMD_LENGTH 4
#define SIMD_MULTIPLY(a, b) _mm_mul_ps(a, b)
#define SIMD_LOAD_ONE_FLOAT(p) _mm_set1_ps(p)
#elif defined(__arm__) || defined(__aarch64__) || defined(__arm64__)
#include <arm_neon.h>
typedef float32x4_t SimdVector;
#define SIMD_LENGTH 4
#define SIMD_MULTIPLY(a, b) vmulq_f32(a, b)
#define SIMD_LOAD_ONE_FLOAT(p) vld1q_dup_f32(&(p))
#endif

#include "pffft.h"

#include "audio_channel.h"

namespace Visqol {

typedef __m128 SimdVector;
#define SIMD_LENGTH 4
#define SIMD_MULTIPLY(a, b) _mm_mul_ps(a, b)
#define SIMD_LOAD_ONE_FLOAT(p) _mm_set1_ps(p)

/**
* This class acts as a wrapper for the PFFFT library operations. It is not
* responsible for managing the lifecycles of the AudioChannels it operates on.
Expand Down
46 changes: 46 additions & 0 deletions src/include/status_macros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef VISQOL_INCLUDE_STATUSOR_MACROS_H
#define VISQOL_INCLUDE_STATUSOR_MACROS_H

#include "absl/status/status.h"
#include "absl/status/statusor.h"

namespace Visqol {

#define VISQOL_RETURN_IF_ERROR(expr) \
do { \
/* Using _status below to avoid capture problems if expr is "status". */ \
const absl::Status _status = (expr); \
if (!_status.ok()) return _status; \
} while (0)

template<typename T>
absl::Status DoAssignOrReturn(T& lhs, absl::StatusOr<T> result) {
if (result.ok()) {
lhs = result.value();
}
return result.status();
}

#define VISQOL_ASSIGN_OR_RETURN_IMPL(status, lhs, rexpr) \
absl::Status status = ::Visqol::DoAssignOrReturn(lhs, (rexpr)); \
if (!status.ok()) return status;

#define VISQOL_STATUS_MACROS_CONCAT_NAME_INNER(x, y) x##y
#define VISQOL_STATUS_MACROS_CONCAT_NAME(x, y) VISQOL_STATUS_MACROS_CONCAT_NAME_INNER(x, y)

// Executes an expression that returns a util::StatusOr, extracting its value
// into the variable defined by lhs (or returning on error).
//
// Example: Assigning to an existing value
// ValueType value;
// ASSIGN_OR_RETURN(value, MaybeGetValue(arg));
//
// WARNING: VISQOL_ASSIGN_OR_RETURN expands into multiple statements; it cannot be used
// in a single statement (e.g. as the body of an if statement without {})!
#define VISQOL_ASSIGN_OR_RETURN(lhs, rexpr) \
VISQOL_ASSIGN_OR_RETURN_IMPL( \
VISQOL_STATUS_MACROS_CONCAT_NAME(_status_or_value, __COUNTER__), lhs, rexpr);

} // namespace Visqol

#endif // VISQOL_INCLUDE_STATUSOR_MACROS_H

0 comments on commit 27a6eba

Please sign in to comment.