2 * This file is part of FFmpeg.
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef AVUTIL_HALF2FLOAT_H
20 #define AVUTIL_HALF2FLOAT_H
27 typedef struct Half2FloatTables
{
31 uint32_t mantissatable
[3072];
32 uint32_t exponenttable
[64];
33 uint16_t offsettable
[64];
37 void ff_init_half2float_tables(Half2FloatTables
*t
);
39 static inline uint32_t half2float(uint16_t h
, const Half2FloatTables
*t
)
47 return av_float2int(u
.f
);
51 f
= t
->mantissatable
[t
->offsettable
[h
>> 10] + (h
& 0x3ff)] + t
->exponenttable
[h
>> 10];
57 #endif /* AVUTIL_HALF2FLOAT_H */