1/******************************************************************************
2 *
3 * Copyright (C) 2018 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19*/
20#ifndef IMPD_DRC_TABLES_H
21#define IMPD_DRC_TABLES_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#define N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX (512 + 14)
28
29typedef struct {
30  WORD32 size;
31  WORD32 code;
32  WORD32 value;
33} ia_delta_time_code_table_entry_struct;
34
35typedef struct {
36  WORD32 size;
37  WORD32 code;
38  FLOAT32 value;
39  WORD32 index;
40} ia_slope_code_table_struct;
41
42typedef struct {
43  WORD32 size;
44  WORD32 code;
45  FLOAT32 value;
46} ia_delta_gain_code_table_struct;
47
48typedef struct {
49  ia_delta_time_code_table_entry_struct
50      delta_time_code_table[N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX];
51} ia_tables_struct;
52
53typedef struct {
54  FLOAT32 in_out_ratio;
55  FLOAT32 exp_lo;
56  FLOAT32 exp_hi;
57} ia_cicp_sigmoid_characteristic_param_struct;
58
59typedef struct {
60  FLOAT32 inLevel;
61  FLOAT32 gain;
62} ia_characteristic_node_coordinate_struct;
63
64typedef struct {
65  WORD32 coordinateCount;
66  ia_characteristic_node_coordinate_struct characteristicNodeCoordinate[5];
67} ia_cicp_node_characteristic_param;
68
69WORD32
70impd_init_tbls(const WORD32 num_gain_max_values, ia_tables_struct* str_tables);
71
72void impd_gen_delta_time_code_tbl(
73    const WORD32 num_gain_max_values,
74    ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item);
75
76void impd_get_delta_gain_code_tbl(
77    const WORD32 gain_coding_profile,
78    ia_delta_gain_code_table_struct const** delta_time_code_tbl,
79    WORD32* num_entries);
80
81WORD32
82impd_get_delta_tmin(const WORD32 sampling_rate);
83
84#ifdef __cplusplus
85}
86#endif
87#endif
88