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#ifndef LOG_TAG
20#define LOG_TAG NULL
21#endif
22//#define LOG_NDEBUG 0
23
24#include <log/log.h>
25
26namespace le_fx {
27
28inline void AdaptiveDynamicRangeCompression::set_knee_threshold(float decibel) {
29  // Converts to 1og-base
30  knee_threshold_in_decibel_ = decibel;
31  knee_threshold_ = 0.1151292546497023061569109358970308676362037658691406250f *
32      decibel + 10.39717719035538401328722102334722876548767089843750f;
33}
34
35
36inline void AdaptiveDynamicRangeCompression::set_knee_threshold_via_target_gain(
37    float target_gain) {
38  const float decibel = target_gain_to_knee_threshold_.Interpolate(
39        target_gain);
40  ALOGV("set_knee_threshold_via_target_gain: decibel =%.3fdB", decibel);
41  set_knee_threshold(decibel);
42}
43
44}  // namespace le_fx
45
46
47#endif  // LE_FX_ENGINE_DSP_CORE_DYNAMIC_RANGE_COMPRESSION_INL_H_
48