Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various warnings #18

Merged
merged 16 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions visr_bear/pythonwrappers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ set(BEAR_PYTHON_SITE_PACKAGES
# Check whether the pybind11 version used to build the VISR Python externals is
# compatible with the one used for building this library.
getvisrpybind11version(VISR::pythonsupport_shared VISR_PYBIND11_VERSION)
get_directory_property(pybind11_VERSION DIRECTORY ${PYBIND11_DIR} DEFINITION
pybind11_VERSION)

message(STATUS "VISR_PYBIND11_VERSION: " ${VISR_PYBIND11_VERSION})
if(NOT ${VISR_PYBIND11_VERSION} VERSION_EQUAL
${PYBIND11_VERSION_MAJOR}.${PYBIND11_VERSION_MINOR}.${PYBIND11_VERSION_PATCH}
)
message(STATUS "pybind11_VERSION: " ${pybind11_VERSION})
if(NOT ${VISR_PYBIND11_VERSION} VERSION_EQUAL ${pybind11_VERSION})
message(
WARNING
"Pybind11 version used in VISR differs from version used for library."
Expand Down
7 changes: 6 additions & 1 deletion visr_bear/src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ class RendererImpl {

void set_listener(const Listener &l, const boost::optional<Time> &interpolation_time)
{
// currently interpolation is ignored, but it's not clear if interpolating
// without some delay compensation would be a good idea anyway
(void)interpolation_time;

auto &data = dynamic_cast<ListenerParameter &>(listener_in.data());
data = l.get_impl();
listener_in.swapBuffers();
Expand Down Expand Up @@ -280,7 +284,8 @@ void Renderer::set_listener(const Listener &l, const boost::optional<Time> &inte

Renderer::~Renderer() = default;

struct DataFileMetadataImpl {
class DataFileMetadataImpl {
public:
rapidjson::Value metadata;

bool has_metadata = false;
Expand Down
2 changes: 1 addition & 1 deletion visr_bear/src/brir_interpolation_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace bear {
BRIRInterpolationController::BRIRInterpolationController(const SignalFlowContext &ctx,
const char *name,
CompositeComponent *parent,
const ConfigImpl &config,
const ConfigImpl &,
std::shared_ptr<Panner> panner_)
: AtomicComponent(ctx, name, parent),
panner(std::move(panner_)),
Expand Down
12 changes: 6 additions & 6 deletions visr_bear/src/dsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ DSP::DSP(const SignalFlowContext &ctx,
/* maxRoutings = */ 2 * panner->num_virtual_loudspeakers(),
/* numberOfInterpolants = */ 1,
/* transitionSamples = */ ctx.period(),
/* filters = */ initial_brir_filters(config),
/* initialInterpolants = */ initial_brir_interpolants(config),
/* routings = */ initial_brir_routings(config),
/* filters = */ initial_brir_filters(),
/* initialInterpolants = */ initial_brir_interpolants(),
/* routings = */ initial_brir_routings(),
/* controlInputs = */ rcl::InterpolatingFirFilterMatrix::ControlPortConfig::Interpolants,
/* fftImplementation = */ config.fft_implementation.c_str()),
brir_interpolation_controller(ctx, "brir_interpolation_controller", this, config, panner),
Expand Down Expand Up @@ -205,7 +205,7 @@ DSP::DSP(const SignalFlowContext &ctx,
audioConnection(add_hoa.audioPort("out"), out);
}

rbbl::InterpolationParameterSet DSP::initial_brir_interpolants(const ConfigImpl &config)
rbbl::InterpolationParameterSet DSP::initial_brir_interpolants()
{
rbbl::InterpolationParameterSet ips;
for (size_t vs = 0; vs < panner->num_virtual_loudspeakers(); vs++)
Expand All @@ -214,7 +214,7 @@ rbbl::InterpolationParameterSet DSP::initial_brir_interpolants(const ConfigImpl
return ips;
}

rbbl::FilterRoutingList DSP::initial_brir_routings(const ConfigImpl &config)
rbbl::FilterRoutingList DSP::initial_brir_routings()
{
rbbl::FilterRoutingList routings;
for (size_t vs = 0; vs < panner->num_virtual_loudspeakers(); vs++)
Expand All @@ -223,7 +223,7 @@ rbbl::FilterRoutingList DSP::initial_brir_routings(const ConfigImpl &config)
return routings;
}

efl::BasicMatrix<float> DSP::initial_brir_filters(const ConfigImpl &config)
efl::BasicMatrix<float> DSP::initial_brir_filters()
{
efl::BasicMatrix<float> filters(panner->num_views() * 2 * panner->num_virtual_loudspeakers(),
panner->brir_length());
Expand Down
6 changes: 3 additions & 3 deletions visr_bear/src/dsp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class DSP : public CompositeComponent {
std::shared_ptr<Panner> panner);

private:
rbbl::InterpolationParameterSet initial_brir_interpolants(const ConfigImpl &config);
rbbl::FilterRoutingList initial_brir_routings(const ConfigImpl &config);
efl::BasicMatrix<float> initial_brir_filters(const ConfigImpl &config);
rbbl::InterpolationParameterSet initial_brir_interpolants();
rbbl::FilterRoutingList initial_brir_routings();
efl::BasicMatrix<float> initial_brir_filters();

std::shared_ptr<Panner> panner;

Expand Down
6 changes: 4 additions & 2 deletions visr_bear/src/dynamic_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class StateMachine {
class TypeAdapter {};

struct ObjectsTypeAdapter {
static bool input_fits(const ConfigImpl &config, size_t channel, const ObjectsInput &metadata)
static bool input_fits(const ConfigImpl &config, size_t channel, const ObjectsInput &)
{
return channel < config.num_objects_channels;
}
Expand All @@ -141,7 +141,7 @@ struct ObjectsTypeAdapter {
};

struct DirectSpeakersTypeAdapter {
static bool input_fits(const ConfigImpl &config, size_t channel, const DirectSpeakersInput &metadata)
static bool input_fits(const ConfigImpl &config, size_t channel, const DirectSpeakersInput &)
{
return channel < config.num_direct_speakers_channels;
}
Expand All @@ -157,6 +157,8 @@ struct DirectSpeakersTypeAdapter {
struct HOATypeAdapter {
static bool input_fits(const ConfigImpl &config, size_t stream, const HOAInput &metadata)
{
(void)stream;

for (size_t channel : metadata.channels)
if (channel >= config.num_hoa_channels) return false;
return true;
Expand Down
2 changes: 1 addition & 1 deletion visr_bear/src/gain_calc_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GainCalcObjects::GainCalcObjects(const SignalFlowContext &ctx,
temp_diffuse_a(panner->num_gains()),
temp_direct_b(panner->num_gains()),
temp_diffuse_b(panner->num_gains()),
per_object_data(config.num_objects_channels, (size_t)panner->num_gains())
per_object_data(config.num_objects_channels, panner->num_gains())
{
}

Expand Down
6 changes: 4 additions & 2 deletions visr_bear/src/panner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void Panner::calc_objects_gains(const ear::ObjectsTypeMetadata &type_metadata,

void Panner::get_vs_gains(const DirectDiffuse<const Ref<const VectorXd> &> &gains,
DirectDiffuse<Ref<VectorXd>> vs_gains,
SelectedBRIR selected_brir) const
SelectedBRIR) const
{
if ((size_t)gains.direct.rows() != num_gains())
throw std::invalid_argument("direct gains has wrong number of rows");
Expand Down Expand Up @@ -336,6 +336,8 @@ double Panner::get_expected_gain_quick(double *gains,
LeftRight<double> direct_delays,
SelectedBRIR selected_brir) const
{
(void)direct_delays; // expected gain does not depend on delays

double sum = 0.0;
tensorfile::NDArrayT<float> &factors = *gain_comp_factors;

Expand Down Expand Up @@ -401,7 +403,7 @@ double Panner::compensation_gain_direct(const Ref<const VectorXd> &gains, Select
throw std::logic_error("unknown gain_comp_type");
}

const double Panner::decorrelation_delay() const { return (double)decorrelation_delay_ / fs; }
double Panner::decorrelation_delay() const { return (double)decorrelation_delay_ / fs; }

const float *Panner::get_hoa_ir(size_t channel, size_t ear) const
{
Expand Down
2 changes: 1 addition & 1 deletion visr_bear/src/panner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Panner {

double compensation_gain_direct(const Ref<const VectorXd> &gains, SelectedBRIR selected_brir) const;

const double decorrelation_delay() const;
double decorrelation_delay() const;

size_t n_hoa_channels() const { return n_hoa_channels_; }
size_t hoa_order() const { return hoa_order_; }
Expand Down
9 changes: 3 additions & 6 deletions visr_bear/src/parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,20 @@ struct ParameterTypeDetail {

template <>
struct ParameterTypeDetail<ObjectsInput> {
static constexpr const visr::ParameterType ptype()
{
return visr::detail::compileTimeHashFNV1("ObjectsInput");
}
static constexpr visr::ParameterType ptype() { return visr::detail::compileTimeHashFNV1("ObjectsInput"); }
};

template <>
struct ParameterTypeDetail<DirectSpeakersInput> {
static constexpr const visr::ParameterType ptype()
static constexpr visr::ParameterType ptype()
{
return visr::detail::compileTimeHashFNV1("DirectSpeakersInput");
}
};

template <>
struct ParameterTypeDetail<HOAInput> {
static constexpr const visr::ParameterType ptype() { return visr::detail::compileTimeHashFNV1("HOAInput"); }
static constexpr visr::ParameterType ptype() { return visr::detail::compileTimeHashFNV1("HOAInput"); }
};

template <typename ValueType>
Expand Down
3 changes: 1 addition & 2 deletions visr_bear/src/select_brir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace bear {
SelectBRIR::SelectBRIR(const SignalFlowContext &ctx,
const char *name,
CompositeComponent *parent,
const ConfigImpl &config,
const ConfigImpl &,
std::shared_ptr<Panner> panner_)
: AtomicComponent(ctx, name, parent),
panner(std::move(panner_)),
Expand Down Expand Up @@ -45,7 +45,6 @@ void SelectBRIR::process()

// calculate the 'residual' listener with the BRIR rotation removed
Eigen::Vector3d front{0.0, 1.0, 0.0};
Eigen::Quaterniond brir_rot = Eigen::Quaterniond::FromTwoVectors(front, views.row(max_dp_idx));
listener_out.data().position = listener_in.data().position;
listener_out.data().orientation = view_rotations[max_dp_idx] * listener_in.data().orientation;
listener_out.swapBuffers();
Expand Down
2 changes: 1 addition & 1 deletion visr_bear/src/sh_rotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void quaternion_to_sh_rotation_matrix(const Eigen::Quaterniond &q,
if (order <= 0) throw std::invalid_argument("order must be +ve");

size_t n_channels = (order + 1) * (order + 1);
if (sh_transform.rows() != n_channels || sh_transform.cols() != n_channels)
if ((size_t)sh_transform.rows() != n_channels || (size_t)sh_transform.cols() != n_channels)
throw std::invalid_argument("sh_transform is not correct size");

Eigen::Matrix3d rotation_matrix = quaternion_to_rotation_mat(q);
Expand Down
2 changes: 1 addition & 1 deletion visr_bear/src/static_delay_calc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace bear {
StaticDelayCalc::StaticDelayCalc(const SignalFlowContext &ctx,
const char *name,
CompositeComponent *parent,
const ConfigImpl &config,
const ConfigImpl &,
std::shared_ptr<Panner> panner_)
: AtomicComponent(ctx, name, parent),
panner(std::move(panner_)),
Expand Down
2 changes: 1 addition & 1 deletion visr_bear/src/tensorfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class format_error : public std::runtime_error {
class MMap;

namespace detail {
inline size_t calc_index(const size_t *strides) { return 0u; }
inline size_t calc_index(const size_t * /* strides */) { return 0u; }

template <typename Index, typename... Indices>
inline size_t calc_index(const size_t *strides, Index index, Indices... indices)
Expand Down
4 changes: 2 additions & 2 deletions visr_bear/test/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void run_benchmark_print(const BenchmarkConfig &c, size_t run)
std::cout << "\n";
}

int main(int argc, char **argv)
int main(int, char **)
{
for (size_t run = 0; run < 5; run++) {
for (size_t period : {128, 512, 2048}) {
Expand Down Expand Up @@ -267,7 +267,7 @@ int main(int argc, char **argv)
};

// non-default FFTs
for (const std::string &fft_implementation : {"kissfft"})
for (const char *fft_implementation : {"kissfft"})
for (int num_objects_p = -1; num_objects_p <= 6; num_objects_p++)
run_bench(num_objects_p >= 0 ? 1 << num_objects_p : 0, 0, 0, false, false, fft_implementation);

Expand Down
2 changes: 1 addition & 1 deletion visr_bear/test/test_sh_rotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Eigen::VectorXd encode(int order, Eigen::Vector3d pos)

int nch = (order + 1) * (order + 1);
Eigen::VectorXd res(nch);
for (size_t acn = 0; acn < nch; acn++) {
for (int acn = 0; acn < nch; acn++) {
int n, m;
std::tie(n, m) = bear::ear_bits::hoa::from_acn(acn);
res(acn) = bear::ear_bits::hoa::sph_harm(n, m, az, el, bear::ear_bits::hoa::norm_N3D);
Expand Down
Loading