/src/vvenc/source/Lib/CommonLib/x86/CommonDefX86.h
Line | Count | Source |
1 | | /* ----------------------------------------------------------------------------- |
2 | | The copyright in this software is being made available under the Clear BSD |
3 | | License, included below. No patent rights, trademark rights and/or |
4 | | other Intellectual Property Rights other than the copyrights concerning |
5 | | the Software are granted under this license. |
6 | | |
7 | | The Clear BSD License |
8 | | |
9 | | Copyright (c) 2019-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVenC Authors. |
10 | | All rights reserved. |
11 | | |
12 | | Redistribution and use in source and binary forms, with or without modification, |
13 | | are permitted (subject to the limitations in the disclaimer below) provided that |
14 | | the following conditions are met: |
15 | | |
16 | | * Redistributions of source code must retain the above copyright notice, |
17 | | this list of conditions and the following disclaimer. |
18 | | |
19 | | * Redistributions in binary form must reproduce the above copyright |
20 | | notice, this list of conditions and the following disclaimer in the |
21 | | documentation and/or other materials provided with the distribution. |
22 | | |
23 | | * Neither the name of the copyright holder nor the names of its |
24 | | contributors may be used to endorse or promote products derived from this |
25 | | software without specific prior written permission. |
26 | | |
27 | | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY |
28 | | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
29 | | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
30 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
31 | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
32 | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
33 | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
34 | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
35 | | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
36 | | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
37 | | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | | POSSIBILITY OF SUCH DAMAGE. |
39 | | |
40 | | |
41 | | ------------------------------------------------------------------------------------------- */ |
42 | | |
43 | | /** \file CommonDefX86.h |
44 | | */ |
45 | | |
46 | | #pragma once |
47 | | |
48 | | #include "CommonDef.h" |
49 | | |
50 | | //! \ingroup CommonLib |
51 | | //! \{ |
52 | | |
53 | | #if defined(TARGET_SIMD_X86) && ENABLE_SIMD_OPT |
54 | | |
55 | | # if REAL_TARGET_X86 || REAL_TARGET_WASM |
56 | | # ifdef _WIN32 |
57 | | # include <intrin.h> |
58 | | # else |
59 | | # include <immintrin.h> |
60 | | # endif |
61 | | # else // !REAL_TARGET_X86 && !REAL_TARGET_WASM |
62 | | # define SIMDE_ENABLE_NATIVE_ALIASES |
63 | | # endif // !REAL_TARGET_X86 && !REAL_TARGET_WASM |
64 | | |
65 | | # include "FixMissingIntrin.h" |
66 | | |
67 | | # ifdef USE_AVX512 |
68 | | # define SIMDX86 AVX512 |
69 | | # include <simde/x86/avx512.h> |
70 | | # elif defined USE_AVX2 |
71 | | # define SIMDX86 AVX2 |
72 | | # include <simde/x86/avx2.h> |
73 | | # elif defined USE_AVX |
74 | | # define SIMDX86 AVX |
75 | | # include <simde/x86/avx.h> |
76 | | # elif defined USE_SSE42 |
77 | | # define SIMDX86 SSE42 |
78 | | # include <simde/x86/sse4.2.h> |
79 | | # elif defined USE_SSE41 |
80 | | # define SIMDX86 SSE41 |
81 | | # include <simde/x86/sse4.1.h> |
82 | | # endif |
83 | | |
84 | | namespace vvenc |
85 | | { |
86 | | |
87 | | using namespace x86_simd; |
88 | | |
89 | | const std::string& x86_vext_to_string( X86_VEXT vext ); |
90 | | X86_VEXT string_to_x86_vext( const std::string& ext_name ); |
91 | | |
92 | | X86_VEXT read_x86_extension_flags( X86_VEXT request = x86_simd::UNDEFINED ); |
93 | | const std::string& read_x86_extension_name(); |
94 | | |
95 | | #if (defined REAL_TARGET_ARM && !defined REAL_TARGET_AARCH64) |
96 | | // _mm_loadl_epi64 / _mm_storel_epi64 could cause memory crash in 32 Bit ARM Architecture |
97 | | #define _vv_loadl_epi64 _mm_loadu_si64 |
98 | | #define _vv_storel_epi64 _mm_storeu_si64 |
99 | | #else |
100 | 0 | #define _vv_loadl_epi64 _mm_loadl_epi64 |
101 | 0 | #define _vv_storel_epi64 _mm_storel_epi64 |
102 | | #endif |
103 | | |
104 | | #ifdef USE_AVX2 |
105 | | |
106 | | static inline __m128i _mm256_cvtepi32_epi16x( __m256i& v ) |
107 | 0 | { |
108 | | return _mm_packs_epi32( _mm256_castsi256_si128( v ), _mm256_extracti128_si256( v, 1 ) ); |
109 | 0 | } Unexecuted instantiation: AdaptiveLoopFilter_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: AffineGradientSearch_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: Buffer_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: DepQuant_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: FGA_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: InterPred_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: InterpolationFilter_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: IntraPred_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: LoopFilter_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: MCTF_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: Quant_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: RdCost_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: SampleAdaptiveOffset_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) Unexecuted instantiation: Trafo_avx2.cpp:vvenc::_mm256_cvtepi32_epi16x(long long __vector(4)&) |
110 | | |
111 | | #endif |
112 | | |
113 | | } // namespace vvenc |
114 | | |
115 | | //! \} |
116 | | |
117 | | #endif // TARGET_SIMD_X86 |
118 | | |