1 /** 2 * Copyright (C) 2022 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 /*------------------------------------------------------------------------------ 17 * 18 * All table definitions used for the quantizer. 19 * 20 *----------------------------------------------------------------------------*/ 21 22 #ifndef APTXTABLES_H 23 #define APTXTABLES_H 24 25 #include "AptxParameters.h" 26 27 /* Quantisation threshold, logDelta increment and dither tables for 2-bit codes 28 */ 29 static const int32_t dq2bit16_sl1[3] = { 30 -194080, 31 194080, 32 890562, 33 }; 34 35 static const int32_t q2incr16[3] = { 36 0, 37 -33, 38 136, 39 }; 40 41 static const int32_t dq2dith16_sf1[3] = { 42 194080, 43 194080, 44 502402, 45 }; 46 47 static const int32_t dq2mLamb16[2] = { 48 0, 49 -77081, 50 }; 51 52 /* Quantisation threshold, logDelta increment and dither tables for 3-bit codes 53 */ 54 static const int32_t dq3bit16_sl1[5] = { 55 -163006, 163006, 542708, 1120554, 2669238, 56 }; 57 58 static const int32_t q3incr16[5] = { 59 0, -8, 33, 95, 262, 60 }; 61 62 static const int32_t dq3dith16_sf1[5] = { 63 163006, 163006, 216698, 361148, 1187538, 64 }; 65 66 static const int32_t dq3mLamb16[4] = { 67 0, 68 -13423, 69 -36113, 70 -206598, 71 }; 72 73 /* Quantisation threshold, logDelta increment and dither tables for 4-bit codes 74 */ 75 static const int32_t dq4bit16_sl1[9] = { 76 -89806, 89806, 278502, 494338, 759442, 1113112, 1652322, 2720256, 5190186, 77 }; 78 79 static const int32_t q4incr16[9] = { 80 0, -14, 6, 29, 58, 96, 154, 270, 521, 81 }; 82 83 static const int32_t dq4dith16_sf1[9] = { 84 89806, 89806, 98890, 116946, 148158, 205512, 333698, 734236, 1735696, 85 }; 86 87 static const int32_t dq4mLamb16[8] = { 88 0, -2271, -4514, -7803, -14339, -32047, -100135, -250365, 89 }; 90 91 /* Quantisation threshold, logDelta increment and dither tables for 7-bit codes 92 */ 93 static const int32_t dq7bit16_sl1[65] = { 94 -9948, 9948, 29860, 49808, 69822, 89926, 110144, 130502, 95 151026, 171738, 192666, 213832, 235264, 256982, 279014, 301384, 96 324118, 347244, 370790, 394782, 419250, 444226, 469742, 495832, 97 522536, 549890, 577936, 606720, 636290, 666700, 698006, 730270, 98 763562, 797958, 833538, 870398, 908640, 948376, 989740, 1032874, 99 1077948, 1125150, 1174700, 1226850, 1281900, 1340196, 1402156, 1468282, 100 1539182, 1615610, 1698514, 1789098, 1888944, 2000168, 2125700, 2269750, 101 2438670, 2642660, 2899462, 3243240, 3746078, 4535138, 5664098, 7102424, 102 8897462, 103 }; 104 105 static const int32_t q7incr16[65] = { 106 0, -21, -19, -17, -15, -12, -10, -8, -6, -4, -1, 1, 3, 107 6, 8, 10, 13, 15, 18, 20, 23, 26, 29, 31, 34, 37, 108 40, 43, 47, 50, 53, 57, 60, 64, 68, 72, 76, 80, 85, 109 89, 94, 99, 105, 110, 116, 123, 129, 136, 144, 152, 161, 171, 110 182, 194, 207, 223, 241, 263, 291, 328, 382, 467, 522, 522, 522, 111 }; 112 113 static const int32_t dq7dith16_sf1[65] = { 114 9948, 9948, 9962, 9988, 10026, 10078, 10142, 10218, 10306, 115 10408, 10520, 10646, 10784, 10934, 11098, 11274, 11462, 11664, 116 11880, 12112, 12358, 12618, 12898, 13194, 13510, 13844, 14202, 117 14582, 14988, 15422, 15884, 16380, 16912, 17484, 18098, 18762, 118 19480, 20258, 21106, 22030, 23044, 24158, 25390, 26760, 28290, 119 30008, 31954, 34172, 36728, 39700, 43202, 47382, 52462, 58762, 120 66770, 77280, 91642, 112348, 144452, 199326, 303512, 485546, 643414, 121 794914, 1000124, 122 }; 123 124 static const int32_t dq7mLamb16[65] = { 125 0, -4, -7, -10, -13, -16, -19, -22, -26, -28, 126 -32, -35, -38, -41, -44, -47, -51, -54, -58, -62, 127 -65, -70, -74, -79, -84, -90, -95, -102, -109, -116, 128 -124, -133, -143, -154, -166, -180, -195, -212, -231, -254, 129 -279, -308, -343, -383, -430, -487, -555, -639, -743, -876, 130 -1045, -1270, -1575, -2002, -2628, -3591, -5177, -8026, -13719, -26047, 131 -45509, -39467, -37875, -51303, 0, 132 }; 133 134 /* Array of structures containing subband parameters. */ 135 static const SubbandParameters subbandParameters[NUMSUBBANDS] = { 136 /* LL band */ 137 {0, dq7bit16_sl1, 0, dq7dith16_sf1, dq7mLamb16, q7incr16, 7, (18 * 256) - 1, 138 -20, 24}, 139 140 /* LH band */ 141 {0, dq4bit16_sl1, 0, dq4dith16_sf1, dq4mLamb16, q4incr16, 4, (21 * 256) - 1, 142 -23, 12}, 143 144 /* HL band */ 145 {0, dq2bit16_sl1, 0, dq2dith16_sf1, dq2mLamb16, q2incr16, 2, (23 * 256) - 1, 146 -25, 6}, 147 148 /* HH band */ 149 {0, dq3bit16_sl1, 0, dq3dith16_sf1, dq3mLamb16, q3incr16, 3, (22 * 256) - 1, 150 -24, 12}}; 151 152 #endif // APTXTABLES_H 153