1 /* 2 * Copyright (C) 2010 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 // This file is automagically generated by hashgen, do not edit 18 19 /** \file IID_to_MPH.c Interface ID to MPH mapping */ 20 21 #include <SLES/OpenSLES.h> 22 #include "MPH.h" 23 #include <assert.h> 24 #include <string.h> 25 26 extern const struct SLInterfaceID_ SL_IID_array[MPH_MAX]; 27 28 /** \brief Map SLInterfaceID to its minimal perfect hash (MPH), or -1 if unknown */ 29 30 int IID_to_MPH(const SLInterfaceID iid) 31 { 32 #define MAX_HASH_VALUE 180 33 static const unsigned char asso_values[] = 34 { 35 35, 20, 79, 99, 181, 181, 74, 181, 181, 181, 36 181, 181, 181, 181, 84, 181, 79, 59, 181, 181, 37 181, 181, 54, 181, 69, 39, 181, 181, 29, 181, 38 181, 85, 5, 181, 181, 181, 181, 181, 49, 181, 39 24, 181, 181, 181, 14, 181, 117, 181, 181, 181, 40 181, 181, 9, 181, 181, 181, 181, 181, 14, 100, 41 181, 9, 24, 181, 50, 181, 181, 181, 181, 127, 42 181, 181, 107, 85, 181, 181, 181, 181, 181, 181, 43 181, 181, 181, 181, 181, 181, 127, 181, 19, 181, 44 181, 181, 9, 181, 181, 181, 25, 122, 14, 107, 45 181, 181, 181, 181, 181, 181, 181, 4, 181, 102, 46 181, 181, 0, 181, 4, 97, 122, 181, 72, 45, 47 181, 181, 105, 181, 181, 181, 87, 181, 30, 181, 48 181, 181, 181, 181, 181, 107, 125, 181, 181, 181, 49 181, 181, 80, 82, 181, 77, 181, 120, 181, 181, 50 181, 181, 181, 97, 181, 181, 87, 181, 181, 65, 51 5, 181, 57, 181, 181, 82, 115, 181, 181, 52, 52 181, 72, 55, 181, 181, 62, 181, 45, 181, 181, 53 181, 181, 32, 181, 32, 30, 181, 181, 181, 181, 54 181, 181, 0, 181, 181, 181, 110, 47, 181, 181, 55 181, 181, 181, 181, 181, 181, 120, 181, 181, 181, 56 100, 47, 181, 181, 181, 37, 181, 181, 2, 181, 57 181, 181, 181, 27, 10, 181, 181, 27, 181, 181, 58 181, 181, 181, 181, 22, 181, 75, 181, 181, 181, 59 10, 12, 181, 181, 70, 181, 7, 7, 181, 181, 60 181, 105, 2, 125, 181, 181 61 }; 62 static const signed char hash_to_MPH[] = { 63 MPH_ANDROIDEFFECTSEND, 64 -1, 65 MPH_XADYNAMICINTERFACEMANAGEMENT, 66 -1, 67 MPH_XAAUDIODECODERCAPABILITIES, 68 MPH_XALED, 69 -1, 70 MPH_BASSBOOST, 71 -1, 72 MPH_XAOUTPUTMIX, 73 MPH_MIDITIME, 74 -1, 75 MPH_RECORD, 76 -1, 77 MPH_AUDIOIODEVICECAPABILITIES, 78 MPH_MUTESOLO, 79 -1, 80 MPH_VOLUME, 81 -1, 82 MPH_ANDROIDCONFIGURATION, 83 MPH_XASNAPSHOT, 84 -1, 85 MPH_XAIMAGECONTROLS, 86 -1, 87 MPH_SEEK, 88 MPH_3DLOCATION, 89 -1, 90 MPH_XATHREADSYNC, 91 -1, 92 MPH_XAIMAGEDECODERCAPABILITIES, 93 MPH_XACAMERACAPABILITIES, 94 -1, 95 MPH_XAVOLUME, 96 -1, 97 MPH_VIBRA, 98 MPH_XAIMAGEEFFECTS, 99 -1, 100 MPH_XAPLAY, 101 -1, 102 MPH_PRESETREVERB, 103 MPH_XAOBJECT, 104 -1, 105 MPH_XACONFIGEXTENSION, 106 -1, 107 MPH_EQUALIZER, 108 MPH_XAVIBRA, 109 -1, 110 MPH_3DMACROSCOPIC, 111 -1, 112 MPH_PITCH, 113 MPH_ENGINECAPABILITIES, 114 -1, 115 MPH_XAMETADATAEXTRACTION, 116 -1, 117 MPH_3DDOPPLER, 118 MPH_XAVIDEODECODERCAPABILITIES, 119 -1, 120 MPH_RATEPITCH, 121 -1, 122 MPH_ANDROIDAUTOMATICGAINCONTROL, 123 MPH_AUDIODECODERCAPABILITIES, 124 -1, 125 MPH_XARADIO, 126 -1, 127 MPH_OUTPUTMIXEXT, 128 MPH_ENVIRONMENTALREVERB, 129 -1, 130 MPH_XAVIDEOPOSTPROCESSING, 131 -1, 132 MPH_3DCOMMIT, 133 MPH_OUTPUTMIX, 134 -1, 135 MPH_METADATATRAVERSAL, 136 -1, 137 MPH_XASEEK, 138 MPH_XASTREAMINFORMATION, 139 -1, 140 MPH_DEVICEVOLUME, 141 -1, 142 MPH_OBJECT, 143 MPH_VIRTUALIZER, 144 -1, 145 MPH_XARDS, 146 -1, 147 MPH_XAVIDEOENCODER, 148 MPH_PLAY, 149 -1, 150 MPH_XADYNAMICSOURCE, 151 -1, 152 MPH_3DGROUPING, 153 MPH_XAVIDEOENCODERCAPABILITIES, 154 -1, 155 MPH_XAPREFETCHSTATUS, 156 -1, 157 MPH_XAMETADATATRAVERSAL, 158 MPH_XAEQUALIZER, 159 -1, 160 MPH_BUFFERQUEUE, 161 -1, 162 MPH_ANDROIDBUFFERQUEUESOURCE, 163 MPH_XARECORD, 164 -1, 165 MPH_XAMETADATAINSERTION, 166 -1, 167 MPH_XADEVICEVOLUME, 168 MPH_ANDROIDNOISESUPPRESSION, 169 -1, 170 MPH_ENGINE, 171 -1, 172 MPH_MIDIMUTESOLO, 173 MPH_METADATAEXTRACTION, 174 -1, 175 MPH_XACAMERA, 176 -1, 177 -1, 178 MPH_PREFETCHSTATUS, 179 -1, 180 MPH_LED, 181 -1, 182 -1, 183 MPH_XAAUDIOENCODER, 184 -1, 185 MPH_XAENGINE, 186 -1, 187 -1, 188 MPH_ANDROIDEFFECTCAPABILITIES, 189 -1, 190 MPH_MIDIMESSAGE, 191 -1, 192 -1, 193 MPH_VISUALIZATION, 194 -1, 195 MPH_3DSOURCE, 196 -1, 197 -1, 198 MPH_PLAYBACKRATE, 199 -1, 200 MPH_XAAUDIOENCODERCAPABILITIES, 201 -1, 202 -1, 203 MPH_EFFECTSEND, 204 -1, 205 MPH_XAAUDIOIODEVICECAPABILITIES, 206 -1, 207 -1, 208 MPH_NULL, 209 -1, 210 MPH_ANDROIDACOUSTICECHOCANCELLATION, 211 -1, 212 -1, 213 MPH_XAIMAGEENCODERCAPABILITIES, 214 -1, 215 MPH_ANDROIDEFFECT, 216 -1, 217 -1, 218 MPH_MIDITEMPO, 219 -1, 220 MPH_XAPLAYBACKRATE, 221 -1, 222 -1, 223 MPH_DYNAMICINTERFACEMANAGEMENT, 224 -1, 225 MPH_DYNAMICSOURCE, 226 -1, 227 -1, 228 MPH_ANDROIDSIMPLEBUFFERQUEUE, 229 -1, 230 MPH_THREADSYNC, 231 -1, 232 -1, 233 MPH_AUDIOENCODERCAPABILITIES, 234 -1, 235 -1, 236 -1, 237 -1, 238 MPH_XAIMAGEENCODER, 239 -1, 240 -1, 241 -1, 242 -1, 243 MPH_AUDIOENCODER 244 }; 245 if (&SL_IID_array[0] <= iid && &SL_IID_array[MPH_MAX] > iid) 246 return iid - &SL_IID_array[0]; 247 if (NULL != iid) { 248 unsigned key = asso_values[((unsigned char *)iid)[8]] + 249 asso_values[((unsigned char *)iid)[0]]; 250 if (key <= MAX_HASH_VALUE) { 251 int MPH = hash_to_MPH[key]; 252 if (MPH >= 0) { 253 assert(MPH < MPH_MAX); 254 SLInterfaceID trial = &SL_IID_array[MPH]; 255 if (!memcmp(iid, trial, sizeof(struct SLInterfaceID_))) 256 return MPH; 257 } 258 } 259 } 260 return -1; 261 } 262