Coverage Report

Created: 2026-04-01 07:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/vvdec/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) 2018-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVdeC 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
#if defined(TARGET_SIMD_X86)  && ENABLE_SIMD_OPT
51
52
#ifdef _WIN32
53
# define WIN32_LEAN_AND_MEAN
54
// wingdi.h breaks compilation (why only on arm?). It defines some
55
// constants like ERROR (included by windows.h, included by simd-everywhere)
56
# define NOGDI
57
#endif
58
59
#  if REAL_TARGET_X86 || REAL_TARGET_WASM
60
#    ifdef _WIN32
61
#      include <intrin.h>
62
#    else
63
#      include <immintrin.h>
64
#    endif
65
#  else    // !REAL_TARGET_X86 && !REAL_TARGET_WASM
66
#    define SIMDE_ENABLE_NATIVE_ALIASES
67
#  endif   // !REAL_TARGET_X86 && !REAL_TARGET_WASM
68
69
#  include "FixMissingIntrin.h"
70
71
#  ifdef USE_AVX512
72
#    define SIMDX86 AVX512
73
#    include <simde/x86/avx512.h>
74
#  elif defined USE_AVX2
75
#    define SIMDX86 AVX2
76
#    include <simde/x86/avx2.h>
77
#  elif defined USE_AVX
78
#    define SIMDX86 AVX
79
#    include <simde/x86/avx.h>
80
#  elif defined USE_SSE42
81
#    define SIMDX86 SSE42
82
#    include <simde/x86/sse4.2.h>
83
#  elif defined USE_SSE41
84
#    define SIMDX86 SSE41
85
#    include <simde/x86/sse4.1.h>
86
#  endif
87
88
#  if defined( REAL_TARGET_X86 ) \
89
    || ( defined( SIMD_EVERYWHERE_EXTENSION_LEVEL_ID ) && SIMD_EVERYWHERE_EXTENSION_LEVEL_ID >= X86_SIMD_AVX2 )
90
#    define ENABLE_AVX2_IMPLEMENTATIONS 1
91
#  else
92
#    define ENABLE_AVX2_IMPLEMENTATIONS 0
93
#  endif
94
95
namespace vvdec
96
{
97
using namespace x86_simd;
98
99
X86_VEXT    read_x86_extension_flags( X86_VEXT request = x86_simd::UNDEFINED );
100
std::string read_x86_extension_name();
101
102
#ifdef USE_AVX2
103
static inline __m128i _mm256_cvtepi32_epi16x( __m256i& v )
104
0
{
105
  return  _mm_packs_epi32( _mm256_castsi256_si128( v ), _mm256_extracti128_si256( v, 1 ) );
106
0
}
Unexecuted instantiation: FilmGrainImpl_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: AdaptiveLoopFilter_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: Buffer_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: InterPred_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: InterpolationFilter_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: IntraPred_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: LoopFilter_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: Picture_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: Quant_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: RdCost_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: SampleAdaptiveOffset_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
Unexecuted instantiation: Trafo_avx2.cpp:vvdec::_mm256_cvtepi32_epi16x(long long __vector(4)&)
107
#endif
108
109
}   // namespace vvdec
110
111
#endif // TARGET_SIMD_X86