Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/ATK-2.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrucher committed Jul 6, 2017
2 parents fdc1b4f + c828a08 commit d0ce1c1
Show file tree
Hide file tree
Showing 63 changed files with 583 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
@@ -1,4 +1,4 @@
version: '2.1.0.{build}'
version: '2.1.1.{build}'

shallow_clone: true

Expand Down
25 changes: 13 additions & 12 deletions .travis.yml
Expand Up @@ -24,7 +24,7 @@ matrix:
- ENABLE_PYTHON=ON
- PYTHON_VERSION=2.7
- PYTHON=python2
- Python_ADDITIONAL_VERSIONS=2.7.12
- Python_ADDITIONAL_VERSIONS=2.7.13
- compiler: gcc
os: linux
dist: trusty
Expand All @@ -43,9 +43,9 @@ matrix:
- PLATFORM=gcc-5
- ADDITONAL_CMAKE_FLAGS=
- ENABLE_PYTHON=ON
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6
- PYTHON=python3
- Python_ADDITIONAL_VERSIONS=3.5.2
- Python_ADDITIONAL_VERSIONS=3.6.0
- compiler: gcc
os: linux
dist: trusty
Expand All @@ -66,7 +66,7 @@ matrix:
- ENABLE_PYTHON=ON
- PYTHON_VERSION=2.7
- PYTHON=python2
- Python_ADDITIONAL_VERSIONS=2.7.12
- Python_ADDITIONAL_VERSIONS=2.7.13
- compiler: gcc
os: linux
dist: trusty
Expand All @@ -85,9 +85,9 @@ matrix:
- PLATFORM=gcc-6
- ADDITONAL_CMAKE_FLAGS=
- ENABLE_PYTHON=ON
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6
- PYTHON=python3
- Python_ADDITIONAL_VERSIONS=3.5.2
- Python_ADDITIONAL_VERSIONS=3.6.0
- compiler: clang-3.8
os: linux
dist: trusty
Expand All @@ -110,7 +110,7 @@ matrix:
- ENABLE_PYTHON=ON
- PYTHON_VERSION=2.7
- PYTHON=python2
- Python_ADDITIONAL_VERSIONS=2.7.12
- Python_ADDITIONAL_VERSIONS=2.7.13
- compiler: clang-3.8
os: linux
dist: trusty
Expand All @@ -131,9 +131,9 @@ matrix:
- PLATFORM=clang-3.8
- ADDITONAL_CMAKE_FLAGS=
- ENABLE_PYTHON=ON
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6
- PYTHON=python3
- Python_ADDITIONAL_VERSIONS=3.5.2
- Python_ADDITIONAL_VERSIONS=3.6.0
- compiler: clang-3.9
os: linux
dist: trusty
Expand All @@ -156,7 +156,7 @@ matrix:
- ENABLE_PYTHON=ON
- PYTHON_VERSION=2.7
- PYTHON=python2
- Python_ADDITIONAL_VERSIONS=2.7.12
- Python_ADDITIONAL_VERSIONS=2.7.13
- compiler: clang-3.9
os: linux
dist: trusty
Expand All @@ -177,9 +177,9 @@ matrix:
- PLATFORM=clang-3.9
- ADDITONAL_CMAKE_FLAGS=
- ENABLE_PYTHON=ON
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6
- PYTHON=python3
- Python_ADDITIONAL_VERSIONS=3.5.2
- Python_ADDITIONAL_VERSIONS=3.6.0
- os: osx
osx_image: xcode7.3
env:
Expand Down Expand Up @@ -224,6 +224,7 @@ matrix:
before_install:
- mkdir $HOME/usr
- export PATH="$HOME/usr/bin:$PATH"
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then dir /opt/python/ ; fi
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then wget https://cmake.org/files/v3.8/cmake-3.8.1-Linux-x86_64.sh ; fi
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then chmod +x cmake-3.8.1-Linux-x86_64.sh ; fi
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then ./cmake-3.8.1-Linux-x86_64.sh --prefix=$HOME/usr --exclude-subdir --skip-license ; fi
Expand Down
16 changes: 13 additions & 3 deletions ATK/Core/BaseFilter.cpp
Expand Up @@ -143,7 +143,13 @@ namespace ATK
void BaseFilter::process(std::size_t size)
{
reset();
process_conditionnally(size);
process_conditionnally<true>(size);
}

void BaseFilter::dryrun(std::size_t size)
{
reset();
process_conditionnally<false>(size);
}

#if ATK_USE_THREADPOOL == 1
Expand All @@ -154,6 +160,7 @@ namespace ATK
}
#endif

template<bool must_process>
void BaseFilter::process_conditionnally(std::size_t size)
{
if(size == 0)
Expand All @@ -178,7 +185,7 @@ namespace ATK
else
{
assert(output_sampling_rate);
connections[port].second->process_conditionnally(uint64_t(size) * input_sampling_rate / output_sampling_rate);
connections[port].second->template process_conditionnally<must_process>(uint64_t(size) * input_sampling_rate / output_sampling_rate);
}
}
#if ATK_PROFILING == 1
Expand All @@ -196,7 +203,10 @@ namespace ATK
output_conversion_time += (timer2 - timer);
timer = timer2;
#endif
process_impl(size);
if(must_process)
{
process_impl(size);
}
#if ATK_PROFILING == 1
timer2 = std::chrono::steady_clock::now();
process_time += (timer2 - timer);
Expand Down
5 changes: 4 additions & 1 deletion ATK/Core/BaseFilter.h
Expand Up @@ -51,7 +51,9 @@ namespace ATK

/// Starts processing after calling reset
ATK_CORE_EXPORT void process(std::size_t size);

/// As process, but doesn't call process_impl
ATK_CORE_EXPORT void dryrun(std::size_t size);

#if ATK_USE_THREADPOOL == 1
/// Allows threaded processing
ATK_CORE_EXPORT void process_parallel(std::size_t size);
Expand Down Expand Up @@ -114,6 +116,7 @@ namespace ATK
/// Returns the type that the filter processes
virtual int get_type() const = 0;
/// Starts processing without calling reset
template<bool must_process>
void process_conditionnally(std::size_t size);
#if ATK_USE_THREADPOOL == 1
/// Starts parallel processing without calling reset
Expand Down
2 changes: 1 addition & 1 deletion ATK/Core/OutCircularPointerFilter.cpp
Expand Up @@ -35,7 +35,7 @@ namespace ATK
{
auto update_size = std::min(size, array.size() - offset);
memcpy(reinterpret_cast<void*>(&array[offset]), reinterpret_cast<const void*>(converted_inputs[0]), static_cast<size_t>(update_size) * sizeof(DataType));
offset += size;
offset += update_size;
if(offset == array.size())
{
auto additional_update_size = size - update_size;
Expand Down
2 changes: 1 addition & 1 deletion ATK/Core/PipelineGlobalSinkFilter.cpp
Expand Up @@ -81,7 +81,7 @@ namespace ATK
{
for (auto it = filters.begin(); it != filters.end(); ++it)
{
(*it)->process_conditionnally(size * (*it)->get_output_sampling_rate() / input_sampling_rate);
(*it)->process_conditionnally<true>(size * (*it)->get_output_sampling_rate() / input_sampling_rate);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions ATK/Delay/HadamardMixture.cpp
Expand Up @@ -48,10 +48,10 @@ namespace ATK
}

template<unsigned int recursive_order>
static typename std::enable_if<recursive_order != 0, Eigen::Matrix<typename TypeTraits<DataType_>::Scalar, 1<<recursive_order, 1<<recursive_order>>::type recursive_create()
static typename std::enable_if<recursive_order != 0, Eigen::Matrix<typename TypeTraits<DataType_>::Scalar, (1<<recursive_order), (1<<recursive_order)>>::type recursive_create()
{
constexpr auto big_size = 1 << recursive_order;
constexpr auto small_size = 1 << (recursive_order - 1);
constexpr auto big_size = (1U << recursive_order);
constexpr auto small_size = (1U << (recursive_order - 1));
Eigen::Matrix<typename TypeTraits<DataType_>::Scalar, big_size, big_size> cur_transition;

auto M_1 = recursive_create<recursive_order - 1>();
Expand Down
3 changes: 1 addition & 2 deletions ATK/Delay/HadamardMixture.h
Expand Up @@ -23,10 +23,9 @@ namespace ATK
static const unsigned int nb_channels = 1 << order;
typedef DataType_ DataType;
/// Gain factor to take into account in the feedback loop due to the instability of the mixture
static constexpr double gain_factor = 1;
static constexpr float gain_factor = 1.f;

class MixtureImpl;

};
}

Expand Down
3 changes: 1 addition & 2 deletions ATK/Delay/HouseholderMixture.h
Expand Up @@ -23,10 +23,9 @@ namespace ATK
static const int nb_channels = nb_channels_;
typedef DataType_ DataType;
/// Gain factor to take into account in the feedback loop due to the instability of the mixture
static constexpr double gain_factor = 0.5; // should be std::pow(2, -order / 2.);, but pow is not constexpr :/
static constexpr float gain_factor = 0.5f; // should be std::pow(2, -order / 2.);, but pow is not constexpr :/

class MixtureImpl;

};
}

Expand Down
2 changes: 1 addition & 1 deletion ATK/Dynamic/GainColoredCompressorFilter.cpp
Expand Up @@ -78,7 +78,7 @@ namespace ATK
DataType diff = 10 * fmath::log10(value);

DataType additional_color = color * fmath::exp(- diff * diff * quality);
return static_cast<DataType>(std::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1) / ratio)) + additional_color;
return static_cast<DataType>(fmath::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1) / ratio)) + additional_color;
}

template class GainColoredCompressorFilter<float>;
Expand Down
2 changes: 1 addition & 1 deletion ATK/Dynamic/GainColoredExpanderFilter.cpp
Expand Up @@ -77,7 +77,7 @@ namespace ATK
return 0;
DataType diff = -10 * fmath::log10(value);
DataType additional_color = color * fmath::exp(- diff * diff * quality);
return static_cast<DataType>(std::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1))) + additional_color;
return static_cast<DataType>(fmath::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1))) + additional_color;
}

template class GainColoredExpanderFilter<float>;
Expand Down
2 changes: 1 addition & 1 deletion ATK/Dynamic/GainCompressorFilter.cpp
Expand Up @@ -46,7 +46,7 @@ namespace ATK
if(value == 0)
return 1;
DataType diff = 10 * fmath::log10(value);
return static_cast<DataType>(std::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1) / ratio));
return static_cast<DataType>(fmath::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1) / ratio));
}

template class GainCompressorFilter<float>;
Expand Down
2 changes: 1 addition & 1 deletion ATK/Dynamic/GainExpanderFilter.cpp
Expand Up @@ -46,7 +46,7 @@ namespace ATK
if(value == 0)
return 0;
DataType diff = -10 * fmath::log10(value);
return static_cast<DataType>(std::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1)));
return static_cast<DataType>(fmath::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1)));
}

template class GainExpanderFilter<float>;
Expand Down
2 changes: 1 addition & 1 deletion ATK/Dynamic/GainLimiterFilter.cpp
Expand Up @@ -46,7 +46,7 @@ namespace ATK
if(value == 0)
return 1;
DataType diff = 10 * fmath::log10(value);
return static_cast<DataType>(std::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40));
return static_cast<DataType>(fmath::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40));
}

template class GainLimiterFilter<float>;
Expand Down
6 changes: 3 additions & 3 deletions ATK/Dynamic/GainMaxColoredExpanderFilter.cpp
Expand Up @@ -99,12 +99,12 @@ namespace ATK
DataType_ GainMaxColoredExpanderFilter<DataType_>::computeGain( DataType_ value ) const
{
if(value == 0)
return static_cast<DataType_>(std::pow(max_reduction, 1 / (ratio - 1)));
return static_cast<DataType_>(fmath::pow(max_reduction, 1 / (ratio - 1)));

DataType diff = static_cast<DataType_>(-5 * fmath::log10(value * value + std::pow(max_reduction, 2 / (ratio - 1))));
DataType diff = static_cast<DataType_>(-5 * fmath::log10(value * value + fmath::pow(max_reduction, 2 / (ratio - 1))));
DataType additional_color = color * fmath::exp(- diff * diff * quality);

return static_cast<DataType>(std::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1))) + additional_color;
return static_cast<DataType>(fmath::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1))) + additional_color;
}

template class GainMaxColoredExpanderFilter<float>;
Expand Down
80 changes: 80 additions & 0 deletions ATK/Dynamic/GainMaxCompressorFilter.cpp
@@ -0,0 +1,80 @@
/**
* \file GainMaxCompressorFilter.cpp
*/

#include "GainMaxCompressorFilter.h"

#include <cmath>
#include <cstdint>
#include <stdexcept>

#include <ATK/Utility/fmath.h>

namespace ATK
{
template<typename DataType_>
GainMaxCompressorFilter<DataType_>::GainMaxCompressorFilter(std::size_t nb_channels, size_t LUTsize, size_t LUTprecision)
:Parent(nb_channels, LUTsize, LUTprecision), softness(static_cast<DataType_>(.0001)), max_reduction(static_cast<DataType_>(0.01))
{
}

template<typename DataType_>
GainMaxCompressorFilter<DataType_>::~GainMaxCompressorFilter()
{
}

template<typename DataType_>
void GainMaxCompressorFilter<DataType_>::set_softness(DataType_ softness)
{
if (softness <= 0)
{
throw std::out_of_range("Softness factor must be strictly positive value");
}
this->softness = softness;
start_recomputeLUT();
}

template<typename DataType_>
DataType_ GainMaxCompressorFilter<DataType_>::get_softness() const
{
return softness;
}

template<typename DataType_>
void GainMaxCompressorFilter<DataType_>::set_max_reduction(DataType_ max_reduction)
{
if (max_reduction <= 0)
{
throw std::out_of_range("Maximum reduction factor must be strictly positive value");
}
this->max_reduction = max_reduction;
start_recomputeLUT();
}

template<typename DataType_>
void GainMaxCompressorFilter<DataType_>::set_max_reduction_db(DataType_ max_reduction_db)
{
this->max_reduction = static_cast<DataType_>(std::pow(10, max_reduction_db / 10));
start_recomputeLUT();
}

template<typename DataType_>
DataType_ GainMaxCompressorFilter<DataType_>::get_max_reduction() const
{
return max_reduction;
}

template<typename DataType_>
DataType_ GainMaxCompressorFilter<DataType_>::computeGain( DataType_ value ) const
{
if(value == 0)
return 1;
DataType diff = static_cast<DataType_>(-5 * fmath::log10(1/(value * value) + fmath::pow(max_reduction, 2 * ratio / (ratio - 1))));
return static_cast<DataType>(fmath::pow(10, -(std::sqrt(diff*diff + softness) + diff) / 40 * (ratio - 1) / ratio));
}

template class GainMaxCompressorFilter<float>;
template class GainMaxCompressorFilter<double>;
template class GainFilter<GainMaxCompressorFilter<float>>;
template class GainFilter<GainMaxCompressorFilter<double>>;
}

0 comments on commit d0ce1c1

Please sign in to comment.