Coverage Report

Created: 2026-04-09 07:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/Simd/src/Simd/SimdSse41SynetPermute.cpp
Line
Count
Source
1
/*
2
* Simd Library (http://ermig1979.github.io/Simd).
3
*
4
* Copyright (c) 2011-2023 Yermalayeu Ihar.
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to deal
8
* in the Software without restriction, including without limitation the rights
9
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
* copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in
14
* all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
* SOFTWARE.
23
*/
24
#include "Simd/SimdTransform.h"
25
#include "Simd/SimdSynetPermute.h"
26
27
namespace Simd
28
{
29
#ifdef SIMD_SSE41_ENABLE    
30
    namespace Sse41
31
    {
32
        template<class T> void Permute2(const uint8_t* src, const Base::Shape& shape, const Base::Shape& stride, uint8_t* dst)
33
0
        {
34
0
            static ImageTransforms transforms = ImageTransforms();
35
36
0
            transforms.TransformImage(src, shape[0] * sizeof(T), shape[0], shape[1], sizeof(T), SimdTransformTransposeRotate0, dst, shape[1] * sizeof(T));
37
0
        }
Unexecuted instantiation: void Simd::Sse41::Permute2<unsigned int>(unsigned char const*, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, unsigned char*)
Unexecuted instantiation: void Simd::Sse41::Permute2<unsigned char>(unsigned char const*, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, unsigned char*)
Unexecuted instantiation: void Simd::Sse41::Permute2<unsigned short>(unsigned char const*, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > const&, unsigned char*)
38
39
        //-------------------------------------------------------------------------------------------------
40
41
        SynetPermute::SynetPermute(const Base::PermuteParam& param)
42
0
            : Base::SynetPermute(param)
43
0
        {
44
0
            if (_count == 2)
45
0
            {            
46
0
                switch (_param.type)
47
0
                {
48
0
                case SimdTensorData32f:
49
0
                case SimdTensorData32i:
50
0
                    _permute = Permute2<uint32_t>;
51
0
                    break;
52
0
                case SimdTensorData8i:
53
0
                case SimdTensorData8u:
54
0
                    _permute = Permute2<uint8_t>;
55
0
                    break;
56
0
                case SimdTensorData16b:
57
0
                case SimdTensorData16f:
58
0
                    _permute = Permute2<uint16_t>;
59
0
                    break;
60
0
                default:
61
0
                    assert(0);
62
0
                }
63
0
            }
64
0
        }
65
66
        //-------------------------------------------------------------------------------------------------
67
68
        void* SynetPermuteInit(const size_t* shape, const size_t* order, size_t count, SimdTensorDataType type)
69
0
        {
70
0
            Base::PermuteParam param(shape, order, count, type, A);
71
0
            if (!param.Valid())
72
0
                return NULL;
73
0
            return new SynetPermute(param);
74
0
        }
75
    }
76
#endif
77
}