1 /****************************************************************************** 2 * * 3 * Copyright (C) 2023 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 21 #pragma once 22 #define MAX_DRC_PAYLOAD_BYTES (2048) 23 #define MAX_SPEAKER_POS_COUNT (128) 24 #define MAX_DOWNMIX_COEFF_COUNT (32 * 32) 25 #define MAX_CHANNEL_COUNT (8) 26 #define MAX_BAND_COUNT (8) 27 #define MAX_SEQUENCE_COUNT (8) 28 #define MAX_MEASUREMENT_COUNT (15) 29 #define MAX_DOWNMIX_INSTRUCTION_COUNT (16) 30 #define MAX_DRC_COEFF_COUNT (7) 31 #define MAX_DRC_INSTRUCTIONS_COUNT (MAX_DOWNMIX_INSTRUCTION_COUNT + 16) 32 #define MAX_LOUDNESS_INFO_COUNT (MAX_DOWNMIX_INSTRUCTION_COUNT + 16) 33 #define MAX_AUDIO_CODEC_FRAME_SIZE (2048) 34 #define MAX_DRC_CODEC_FRAME_SIZE (MAX_AUDIO_CODEC_FRAME_SIZE / 8) 35 #define MAX_NODE_COUNT (MAX_DRC_CODEC_FRAME_SIZE) 36 #define MAX_CHANNEL_GROUP_COUNT (MAX_SEQUENCE_COUNT) 37 #define MAX_ADDITIONAL_DOWNMIX_ID (7) 38 #define DELAY_MODE_REGULAR_DELAY (0) 39 #define MAX_EXT_COUNT (2) 40 #define MAX_GAIN_POINTS (256) 41 #define MAX_DRC_INSTRUCTIONS_BASIC_COUNT (15) 42 43 #define UNIDRC_GAIN_EXT_TERM (0x0) 44 #define UNIDRC_LOUD_EXT_TERM (0x0) 45 #define UNIDRC_CONF_EXT_TERM (0x0) 46 #define UNIDRC_CONF_EXT_PARAM_DRC (0x1) 47 #define UNIDRC_CONF_EXT_V1 (0x2) 48 #define UNIDRC_LOUD_EXT_EQ (0x1) 49 50 #define MAX_PARAM_DRC_INSTRUCTIONS_COUNT (8) 51 52 #define PARAM_DRC_TYPE_FF (0x0) 53 #define MAX_PARAM_DRC_TYPE_FF_NODE_COUNT (9) 54 55 #define PARAM_DRC_TYPE_LIM (0x1) 56 #define PARAM_DRC_TYPE_LIM_ATTACK_DEFAULT (5) 57 58 #define SUBBAND_DOMAIN_MODE_OFF (0) 59 #define SUBBAND_DOMAIN_MODE_QMF64 (1) 60 #define SUBBAND_DOMAIN_MODE_QMF71 (2) 61 #define SUBBAND_DOMAIN_MODE_STFT256 (3) 62 63 #define QMF64_AUDIO_CODEC_SUBBAND_COUNT (64) 64 #define QMF64_AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR (64) 65 66 #define QMF71_AUDIO_CODEC_SUBBAND_COUNT (71) 67 #define QMF71_AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR (64) 68 69 #define STFT256_AUDIO_CODEC_SUBBAND_COUNT (256) 70 #define STFT256_AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR (256) 71 72 #define TIME_DOMAIN (1) 73 #define SUBBAND_DOMAIN (2) 74 #define SLOPE_FACTOR_DB_TO_LINEAR (0.1151f) /* ln(10) / 20 */ 75 76 #define MAX_DRC_CONFIG_SIZE_EXPECTED (14336) /* 14 KB*/ 77 78 #ifndef MIN 79 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 80 #endif 81 #ifndef MAX 82 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 83 #endif 84