diff options
author | Chris Robinson <[email protected]> | 2019-12-08 17:01:34 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-12-08 17:01:34 -0800 |
commit | 8076fd8aa94e3f5421610ed72415280515070f5c (patch) | |
tree | 09a89b1a92da29ac06931015c8bf861caf05cdf8 /utils/makemhr | |
parent | a280373dc1d596b720c33556e8cbbf30276fe388 (diff) |
Report the number of IRs used from SOFA files
Diffstat (limited to 'utils/makemhr')
-rw-r--r-- | utils/makemhr/loadsofa.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/utils/makemhr/loadsofa.cpp b/utils/makemhr/loadsofa.cpp index 2b5bfe0b..1dc64522 100644 --- a/utils/makemhr/loadsofa.cpp +++ b/utils/makemhr/loadsofa.cpp @@ -172,6 +172,8 @@ static double GetUniformElevStep(const double epsilon, const std::vector<double> */ static bool PrepareLayout(const uint m, const float *xyzs, HrirDataT *hData) { + fprintf(stdout, "Detecting compatible layout...\n"); + auto aers = std::vector<double3>(m, double3{}); for(uint i{0u};i < m;++i) { @@ -197,6 +199,7 @@ static bool PrepareLayout(const uint m, const float *xyzs, HrirDataT *hData) std::bind(std::greater_equal<double>{}, _1, hData->mRadius)); auto fdCount = static_cast<uint>(std::distance(std::begin(distances), dist_end)); + uint ir_total{0u}; for(uint fi{0u};fi < fdCount;) { const double dist{distances[fi]}; @@ -269,6 +272,7 @@ static bool PrepareLayout(const uint m, const float *xyzs, HrirDataT *hData) const double ev{-90.0 + ei*180.0/(evCount - 1)}; auto azims = GetUniquelySortedElems(aers, 0, {nullptr, &ev, &dist}, {0.1, 0.1, 0.001}); + uint azCount; if(ei == 0 || ei == (evCount-1)) { if(azims.size() != 1) @@ -276,7 +280,7 @@ static bool PrepareLayout(const uint m, const float *xyzs, HrirDataT *hData) fprintf(stdout, "Non-singular poles on field distance %f.\n", dist); return false; } - azCounts[fi*MAX_EV_COUNT + ei] = 1u; + azCount = 1u; } else { @@ -287,14 +291,17 @@ static bool PrepareLayout(const uint m, const float *xyzs, HrirDataT *hData) ev, dist); return false; } - azCounts[fi*MAX_EV_COUNT + ei] = static_cast<uint>(std::round(360.0 / step)); + azCount = static_cast<uint>(std::round(360.0 / step)); } + azCounts[fi*MAX_EV_COUNT + ei] = azCount; + ir_total += azCount; } for(uint ei{0u};ei < evStart;ei++) azCounts[fi*MAX_EV_COUNT + ei] = azCounts[fi*MAX_EV_COUNT + evCount - ei - 1]; ++fi; } + fprintf(stdout, "Using %u of %u IRs.\n", ir_total, m); return PrepareHrirData(fdCount, distances, evCounts, azCounts.data(), hData) != 0; } |