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 NUM_QMF_BANDS (64) 23 #define MAX_HYBRID_BANDS (71) 24 25 #define MAX_INPUT_CHANNELS (6) 26 #define MAX_OUTPUT_CHANNELS (2) 27 #define PARAMETER_BANDS (20) 28 29 #define MAX_QMF_BANDS_TO_HYBRID (7) 30 #define MAX_HYBRID_ONLY_BANDS_PER_QMF (16) 31 #define PROTO_LEN (13) 32 #define BUFFER_LEN_LF (PROTO_LEN - 1 + MAX_TIME_SLOTS) 33 34 #define BUFFER_LEN_HF ((PROTO_LEN - 1) / 2) 35 36 #define MAX_BUFFER_SIZE (2048) 37 #define HYBRID_FILTER_DELAY (6) 38 #define QMF_FILTER_STATE_SYN_SIZE (640) 39 #define NUM_QMF_BANDS_TO_LF (3) 40 41 #define MPS_MAX_FRAME_LENGTH (4096) 42 #define MAX_SAMPLING_RATE (48000) 43 #define NUM_QMF_BANDS (64) 44 #define MAX_QMF_BANDS (128) 45 46 #define MAX_ANA_TIME_SLOT (192) 47 #define MAX_HYBRID_BAND (MAX_QMF_BANDS) 48 #define MAX_FRAME_TIME_SLOT (128) 49 #define MAX_HYBRID_STATIC_SLOT (96) 50 #define IXHEAACE_MPS_MAX_NUM_BOXES (1) 51 #define IXHEAACE_MPS_MAX_INPUT_CHANNELS (2) 52 #define IXHEAACE_MPS_MAX_OUTPUT_CHANNELS (1) 53 54 #define EPSILON (1e-9f) 55 #define PI_FLT (3.1415926535897931f) 56 #define ALPHA (0.0001f) 57 58 #define MAX_DELAY_INPUT (1024) 59 #define MAX_DELAY_OUTPUT (4096) 60 #define MAX_DELAY_SURROUND_ANALYSIS (20) 61 #define MAX_BITSTREAM_DELAY (4) 62 #define MAX_MPEGS_BYTES (1 << 14) 63 #define MAX_SSC_BYTES (1 << 6) 64 #define MAX_MPS_BS_PAYLOAD_SIZE 10000 65 #define MAX_SPACE_TREE_CHANNELS (2) 66 #define NUM_KEEP_WINDOWS (3) 67 68 #define WIN_ACTIV (1) 69 #define MAX_KEEP_FRAMECOUNT (100) 70 71 #define LEFT_CH (0) 72 #define RIGHT_CH (1) 73 74 #define SPACE_ONSET_THRESHOLD (3.0) 75 #define SPACE_ONSET_THRESHOLD_SQUARE_FLT ((1.0 / (SPACE_ONSET_THRESHOLD * SPACE_ONSET_THRESHOLD))) 76 #define MAX_NUM_TRANS (MAX_NUM_PARAMS / 2) 77 78 #define MAX_FREQ_RES_INDEX (8) 79 #define MAX_SAMPLING_FREQUENCY_INDEX (13) 80 #define SAMPLING_FREQUENCY_INDEX_ESCAPE (15) 81 82 #define IXHEAACE_MPS_SAC_VAR_HOLD (0) 83 #define IXHEAACE_MPS_SAC_VAR_ISOLATE (1) 84 #define IXHEAACE_MPS_FRAME_WINDOWING_INTP (0) 85 #define IXHEAACE_MPS_FRAME_WINDOWING_HOLD (1) 86 87 #define IXHEAACE_MPS_SAC_MAX_FREQ_BANDS (MAX_NUM_BINS) 88 89 #define IXHEAACE_MPS_MAX_CLD_QUANT_FINE (31) 90 #define IXHEAACE_MPS_MAX_CLD_QUANT_COARSE (15) 91 #define IXHEAACE_MPS_OFFSET_CLD_QUANT_COARSE (7) 92 #define IXHEAACE_MPS_OFFSET_CLD_QUANT_FINE (15) 93 94 #define IXHEAACE_MPS_MAX_ICC_QUANT_COARSE (4) 95 #define IXHEAACE_MPS_MAX_ICC_QUANT_FINE (8) 96 #define IXHEAACE_MPS_OFFSET_ICC_QUANT_COARSE (0) 97 #define IXHEAACE_MPS_OFFSET_ICC_QUANT_FINE (0) 98 99 #define MAX_NUM_PARAM_BANDS (56) 100 101 #define IXHEAACE_MPS_TREE_5151 (0) 102 #define IXHEAACE_MPS_TREE_5152 (1) 103 #define IXHEAACE_MPS_TREE_525 (2) 104 #define IXHEAACE_MPS_TREE_212 (7) 105 #define IXHEAACE_MPS_FIXED_GAIN_DMX_INVALID (-1) 106 #define IXHEAACE_MPS_MAX_FIXED_GAIN_DMX (7) 107 108 #define IXHEAACE_MPS_DECORR_INVALID (-1) 109 #define IXHEAACE_MPS_DECORR_QMFSPLIT0 (0) 110 #define IXHEAACE_MPS_DECORR_QMFSPLIT1 (1) 111 #define IXHEAACE_MPS_DECORR_QMFSPLIT2 (2) 112 113 #define IXHEAACE_MPS_DATA_MODE_DEFAULT (0) 114 #define IXHEAACE_MPS_DATA_MODE_KEEP (1) 115 #define IXHEAACE_MPS_DATA_MODE_INTERPOLATE (2) 116 #define IXHEAACE_MPS_DATA_MODE_FINECOARSE (3) 117 118 #define MAX_NUM_BOXES (5) 119 #define MAX_AAC_SHORTWINDOWGROUPS (4) 120 #define MAX_AAC_MDCT (1024) 121 #define MAX_AAC_FRAMES (2) 122 123 #define NUM_DATATYPES (3) 124 125 #define DELAY_COMPENSATION (352) 126 127 #define LOG10_2_10 (3.01029995664f) 128 #define INV_LN_10_10 (4.3429448190325182765112891891661f) 129 130 #define IXHEAACE_MPS_SAC_MODE_INVALID (0) 131 #define IXHEAACE_MPS_DMX_GAIN_DEFAULT (2) 132 #define IXHEAACE_MPS_SAC_BANDS_INVALID (0) 133 #define IXHEAACE_MPS_SAC_BANDS_ld (15) 134 #define IXHEAACE_MPS_SAC_BANDS_usac (28) 135 136 #define IXHEAACE_MPS_QUANTMODE_INVALID (-1) 137 #define IXHEAACE_MPS_QUANTMODE_FINE (0) 138 #define IXHEAACE_MPS_QUANTMODE_EBQ1 (1) 139 #define IXHEAACE_MPS_QUANTMODE_EBQ2 (2) 140 #define IXHEAACE_MPS_QUANTMODE_RSVD3 (3) 141 142 #define IXHEAACE_MPS_INPUT_BUFFER_IDX (0) 143 #define IXHEAACE_MPS_OUTUT_BUFFER_IDX (0) 144 #define IXHEAACE_MPS_BITSTREAM_BUFFER_IDX (1) 145 146 #define QMF_FILTER_PROTOTYPE_SIZE 640 147 #define QMF_NO_POLY 5 148 #define QMF640_PFT_TABLE_SIZE (640 / 2 + QMF_NO_POLY) 149 #define QMF320_MPSLDFB_PFT_TABLE_SIZE (320) 150 #define QMF640_MPSLDFB_PFT_TABLE_SIZE (640) 151 #define QMF_MPSLDFB_PFT_SCALE 1 152 153 #define MAX_MPEGS_BYTES (1 << 14) 154 #define MAX_SSC_BYTES (1 << 6) 155 #define MAX_HYBRID_BAND_OFFSET (64) 156 157 #define SQUARE_ROOT_TWO (1.41421356237f) 158 #define MPS_PAYLOAD_SIZE (1024) 159 #define ONE_BY_LN_TWO (1.44269504089f) 160 161 #define PBC_MIN_BANDS 5 162 #define MAXBANDS 56 163 164 #define MAX_FACTORS 23 165 #define MAX_PERM 209 166 #define NFACTOR 11 167 #ifndef M_PI 168 #define M_PI 3.14159265358979323846264338327950288 169 #endif 170 #define SIN_60 0.86602540378443865 171 #define COS_72 0.30901699437494742 172 #define SIN_72 0.95105651629515357 173 #define COS_22_5 (0.92387953251129f) 174 #define COS_67_5 (0.38268343236509f) 175 #define SIN_67_5 (0.92387953251129f) 176 #define SIN_22_5 (0.38268343236509f) 177 #define INV_SQRT_2 (0.70710678118655f) 178 179 #define MPS_COS_PI_BY_16 (0.980785280403230f) 180 #define MPS_SIN_PI_BY_16 (0.195090322016128f) 181 #define MPS_COS_3_PI_BY_16 (0.831469612302545f) 182 #define MPS_SIN_3_PI_BY_16 (0.555570233019602f) 183 #define MPS_COS_6_PI_BY_16 (0.923879532511287f) 184 #define MPS_SIN_6_PI_BY_16 (0.382683432365090f) 185 #define MPS_INV_SQRT2 (7.071067811865475e-1f) 186 #define MPS_COS_PI_DIV8 (9.238795325112867e-1f) 187 #define MPS_COS_3PI_DIV8 (3.826834323650898e-1f) 188 #define MPS_SQRT2PLUS1 (2.414213562373095f) 189 #define MPS_SQRT2MINUS1 (4.142135623730952e-1f) 190