diff options
author | Chris Robinson <[email protected]> | 2019-10-22 16:30:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-10-22 16:30:07 -0700 |
commit | 0dfdebdf6d2a27a7af666a64aab976c3ef2102b0 (patch) | |
tree | 23e6120ee4d1dc2d13079bf1571fbe15251f468b /utils | |
parent | 4733fc6f1e2ba1bcdaca9d7c1941b2abbf150b67 (diff) |
Limit the number of azimuths and elevations used in SOFA files
Diffstat (limited to 'utils')
-rw-r--r-- | utils/makemhr/loadsofa.cpp | 10 | ||||
-rw-r--r-- | utils/sofa-info.cpp | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/utils/makemhr/loadsofa.cpp b/utils/makemhr/loadsofa.cpp index 49d16556..c91613c8 100644 --- a/utils/makemhr/loadsofa.cpp +++ b/utils/makemhr/loadsofa.cpp @@ -149,9 +149,17 @@ static double GetUniformStepSize(const double epsilon, const uint m, const doubl count = 1; if(counts[0] > m/2) - return steps[0]; + break; } + if(counts[0] > 255) + { + uint i{2u}; + while(counts[0]/i > 255 && (counts[0]%i) != 0) + ++i; + counts[0] /= i; + steps[0] *= i; + } if(counts[0] > 5) return steps[0]; return 0.0; diff --git a/utils/sofa-info.cpp b/utils/sofa-info.cpp index a0ed9ff4..bc5b709a 100644 --- a/utils/sofa-info.cpp +++ b/utils/sofa-info.cpp @@ -174,9 +174,17 @@ static double GetUniformStepSize(const double epsilon, const uint m, const doubl count = 1; if(counts[0] > m/2) - return steps[0]; + break; } + if(counts[0] > 255) + { + uint i{2u}; + while(counts[0]/i > 255 && (counts[0]%i) != 0) + ++i; + counts[0] /= i; + steps[0] *= i; + } if(counts[0] > 5) return steps[0]; return 0.0; |