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