This repository has been archived by the owner on Jan 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
583 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: '2.1.0.{build}' | ||
version: '2.1.1.{build}' | ||
|
||
shallow_clone: true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>>; | ||
} |
Oops, something went wrong.