OLD | NEW |
1 /* libFLAC - Free Lossless Audio Codec library | 1 /* libFLAC - Free Lossless Audio Codec library |
2 * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson | 2 * Copyright (C) 2000-2009 Josh Coalson |
| 3 * Copyright (C) 2011-2014 Xiph.Org Foundation |
3 * | 4 * |
4 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
6 * are met: | 7 * are met: |
7 * | 8 * |
8 * - Redistributions of source code must retain the above copyright | 9 * - Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
10 * | 11 * |
11 * - Redistributions in binary form must reproduce the above copyright | 12 * - Redistributions in binary form must reproduce the above copyright |
12 * notice, this list of conditions and the following disclaimer in the | 13 * notice, this list of conditions and the following disclaimer in the |
13 * documentation and/or other materials provided with the distribution. | 14 * documentation and/or other materials provided with the distribution. |
14 * | 15 * |
15 * - Neither the name of the Xiph.org Foundation nor the names of its | 16 * - Neither the name of the Xiph.org Foundation nor the names of its |
16 * contributors may be used to endorse or promote products derived from | 17 * contributors may be used to endorse or promote products derived from |
17 * this software without specific prior written permission. | 18 * this software without specific prior written permission. |
18 * | 19 * |
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR | 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
27 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 31 */ |
31 | 32 |
32 #ifndef FLAC__PRIVATE__CPU_H | 33 #ifndef FLAC__PRIVATE__STREAM_ENCODER_H |
33 #define FLAC__PRIVATE__CPU_H | 34 #define FLAC__PRIVATE__STREAM_ENCODER_H |
34 | |
35 #include "FLAC/ordinals.h" | |
36 | 35 |
37 #ifdef HAVE_CONFIG_H | 36 #ifdef HAVE_CONFIG_H |
38 #include <config.h> | 37 #include <config.h> |
39 #endif | 38 #endif |
40 | 39 |
41 typedef enum { | 40 /* |
42 » FLAC__CPUINFO_TYPE_IA32, | 41 * This is used to avoid overflow with unusual signals in 32-bit |
43 » FLAC__CPUINFO_TYPE_PPC, | 42 * accumulator in the *precompute_partition_info_sums_* functions. |
44 » FLAC__CPUINFO_TYPE_UNKNOWN | 43 */ |
45 } FLAC__CPUInfo_Type; | 44 #define FLAC__MAX_EXTRA_RESIDUAL_BPS 4 |
46 | 45 |
47 typedef struct { | 46 #if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && defined FLAC__HAS_X8
6INTRIN |
48 » FLAC__bool cpuid; | 47 #include "private/cpu.h" |
49 » FLAC__bool bswap; | 48 #include "FLAC/format.h" |
50 » FLAC__bool cmov; | |
51 » FLAC__bool mmx; | |
52 » FLAC__bool fxsr; | |
53 » FLAC__bool sse; | |
54 » FLAC__bool sse2; | |
55 » FLAC__bool sse3; | |
56 » FLAC__bool ssse3; | |
57 » FLAC__bool _3dnow; | |
58 » FLAC__bool ext3dnow; | |
59 » FLAC__bool extmmx; | |
60 } FLAC__CPUInfo_IA32; | |
61 | 49 |
62 typedef struct { | 50 #ifdef FLAC__SSE2_SUPPORTED |
63 » FLAC__bool altivec; | 51 extern void FLAC__precompute_partition_info_sums_intrin_sse2(const FLAC__int32 r
esidual[], FLAC__uint64 abs_residual_partition_sums[], |
64 » FLAC__bool ppc64; | 52 » » » unsigned residual_samples, unsigned predictor_order, uns
igned min_partition_order, unsigned max_partition_order, unsigned bps); |
65 } FLAC__CPUInfo_PPC; | 53 #endif |
66 | 54 |
67 typedef struct { | 55 #ifdef FLAC__SSSE3_SUPPORTED |
68 » FLAC__bool use_asm; | 56 extern void FLAC__precompute_partition_info_sums_intrin_ssse3(const FLAC__int32
residual[], FLAC__uint64 abs_residual_partition_sums[], |
69 » FLAC__CPUInfo_Type type; | 57 » » » unsigned residual_samples, unsigned predictor_order, uns
igned min_partition_order, unsigned max_partition_order, unsigned bps); |
70 » union { | 58 #endif |
71 » » FLAC__CPUInfo_IA32 ia32; | |
72 » » FLAC__CPUInfo_PPC ppc; | |
73 » } data; | |
74 } FLAC__CPUInfo; | |
75 | 59 |
76 void FLAC__cpu_info(FLAC__CPUInfo *info); | 60 #ifdef FLAC__AVX2_SUPPORTED |
77 | 61 extern void FLAC__precompute_partition_info_sums_intrin_avx2(const FLAC__int32 r
esidual[], FLAC__uint64 abs_residual_partition_sums[], |
78 #ifndef FLAC__NO_ASM | 62 » » » unsigned residual_samples, unsigned predictor_order, uns
igned min_partition_order, unsigned max_partition_order, unsigned bps); |
79 #ifdef FLAC__CPU_IA32 | |
80 #ifdef FLAC__HAS_NASM | |
81 FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32(void); | |
82 void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flag
s_ecx); | |
83 FLAC__uint32 FLAC__cpu_info_extended_amd_asm_ia32(void); | |
84 #endif | |
85 #endif | |
86 #endif | 63 #endif |
87 | 64 |
88 #endif | 65 #endif |
| 66 |
| 67 #endif |
OLD | NEW |