1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef LE_FX_ENGINE_DSP_CORE_DYNAMIC_RANGE_COMPRESSION_INL_H_
17 #define LE_FX_ENGINE_DSP_CORE_DYNAMIC_RANGE_COMPRESSION_INL_H_
18 
19 //#define LOG_NDEBUG 0
20 #include <cutils/log.h>
21 
22 
23 namespace le_fx {
24 
25 
set_knee_threshold(float decibel)26 inline void AdaptiveDynamicRangeCompression::set_knee_threshold(float decibel) {
27   // Converts to 1og-base
28   knee_threshold_in_decibel_ = decibel;
29   knee_threshold_ = 0.1151292546497023061569109358970308676362037658691406250f *
30       decibel + 10.39717719035538401328722102334722876548767089843750f;
31 }
32 
33 
set_knee_threshold_via_target_gain(float target_gain)34 inline void AdaptiveDynamicRangeCompression::set_knee_threshold_via_target_gain(
35     float target_gain) {
36   const float decibel = target_gain_to_knee_threshold_.Interpolate(
37         target_gain);
38   ALOGV("set_knee_threshold_via_target_gain: decibel =%.3fdB", decibel);
39   set_knee_threshold(decibel);
40 }
41 
42 }  // namespace le_fx
43 
44 
45 #endif  // LE_FX_ENGINE_DSP_CORE_DYNAMIC_RANGE_COMPRESSION_INL_H_
46