-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvutil_dispatch.h
77 lines (66 loc) · 3.84 KB
/
envutil_dispatch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/************************************************************************/
/* */
/* utility to convert and extract images from 360 degree environments */
/* */
/* Copyright 2024 by Kay F. Jahnke */
/* */
/* The git repository for this software is at */
/* */
/* https://github.com/kfjahnke/envutil */
/* */
/* Please direct questions, bug reports, and contributions to */
/* */
/* [email protected] */
/* */
/* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */
/* copy, modify, merge, publish, distribute, sublicense, and/or */
/* sell copies of the Software, and to permit persons to whom the */
/* Software is furnished to do so, subject to the following */
/* conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the */
/* Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */
/* */
/************************************************************************/
// this header defines class dispatch_base, which is used to dispatch to
// SIMD-ISA-specific code. dispatch_base has a pure virtual member function
// 'payload', ISA-specific derived 'dispatch' classes will define this
// function. When dispatch is called via a dispatch_base pointer, the
// ISA-specific code in the derived class is invoked.
#include "envutil_basic.h" // we use projection_t
#ifndef DISPATCH_BASE
#define DISPATCH_BASE
struct dispatch_base
{
// 'hwy_isa' will hold highway's HWY_TARGET value for
// the given nested namespace.
std::size_t hwy_target ;
std::string hwy_target_name ;
std::string hwy_target_str ;
// next we have pure virtual member function definitions for
// payload code. In this program, we only have one payload
// function.
virtual int payload ( int nchannels ,
int ninputs ,
projection_t projection ) const = 0 ;
} ;
// get_dispatch will yield a dispatch_base pointer to the ISA-specific
// payload code best suited for the CPU currently running the code.
namespace project
{
extern const dispatch_base * const get_dispatch() ;
} ;
#endif