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