Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
skcms_Transform.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#pragma once
9
10#include <stddef.h>
11#include <stdint.h>
12
13// skcms_Transform.h contains skcms implementation details.
14// Please don't use this header from outside the skcms repo.
15
16namespace skcms_private {
17
18/** All transform ops */
19
20#define SKCMS_WORK_OPS(M) \
21 M(load_a8) \
22 M(load_g8) \
23 M(load_4444) \
24 M(load_565) \
25 M(load_888) \
26 M(load_8888) \
27 M(load_1010102) \
28 M(load_101010x_XR) \
29 M(load_161616LE) \
30 M(load_16161616LE) \
31 M(load_161616BE) \
32 M(load_16161616BE) \
33 M(load_hhh) \
34 M(load_hhhh) \
35 M(load_fff) \
36 M(load_ffff) \
37 \
38 M(swap_rb) \
39 M(clamp) \
40 M(invert) \
41 M(force_opaque) \
42 M(premul) \
43 M(unpremul) \
44 M(matrix_3x3) \
45 M(matrix_3x4) \
46 \
47 M(lab_to_xyz) \
48 M(xyz_to_lab) \
49 \
50 M(gamma_r) \
51 M(gamma_g) \
52 M(gamma_b) \
53 M(gamma_a) \
54 M(gamma_rgb) \
55 \
56 M(tf_r) \
57 M(tf_g) \
58 M(tf_b) \
59 M(tf_a) \
60 M(tf_rgb) \
61 \
62 M(pq_r) \
63 M(pq_g) \
64 M(pq_b) \
65 M(pq_a) \
66 M(pq_rgb) \
67 \
68 M(hlg_r) \
69 M(hlg_g) \
70 M(hlg_b) \
71 M(hlg_a) \
72 M(hlg_rgb) \
73 \
74 M(hlginv_r) \
75 M(hlginv_g) \
76 M(hlginv_b) \
77 M(hlginv_a) \
78 M(hlginv_rgb) \
79 \
80 M(table_r) \
81 M(table_g) \
82 M(table_b) \
83 M(table_a) \
84 \
85 M(clut_A2B) \
86 M(clut_B2A)
87
88#define SKCMS_STORE_OPS(M) \
89 M(store_a8) \
90 M(store_g8) \
91 M(store_4444) \
92 M(store_565) \
93 M(store_888) \
94 M(store_8888) \
95 M(store_1010102) \
96 M(store_161616LE) \
97 M(store_16161616LE) \
98 M(store_161616BE) \
99 M(store_16161616BE) \
100 M(store_101010x_XR) \
101 M(store_hhh) \
102 M(store_hhhh) \
103 M(store_fff) \
104 M(store_ffff)
105
106enum class Op : int {
107#define M(op) op,
110#undef M
111};
112
113/** Constants */
114
115#if defined(__clang__) || defined(__GNUC__)
116 static constexpr float INFINITY_ = __builtin_inff();
117#else
118 static const union {
119 uint32_t bits;
120 float f;
121 } inf_ = { 0x7f800000 };
122 #define INFINITY_ inf_.f
123#endif
124
125/** Vector type */
126
127#if defined(__clang__)
128 template <int N, typename T> using Vec = T __attribute__((ext_vector_type(N)));
129#elif defined(__GNUC__)
130 // Unfortunately, GCC does not allow us to omit the struct. This will not compile:
131 // template <int N, typename T> using Vec = T __attribute__((vector_size(N*sizeof(T))));
132 template <int N, typename T> struct VecHelper {
133 typedef T __attribute__((vector_size(N * sizeof(T)))) V;
134 };
135 template <int N, typename T> using Vec = typename VecHelper<N, T>::V;
136#endif
137
138/** Interface */
139
140namespace baseline {
141
142void run_program(const Op* program, const void** contexts, ptrdiff_t programSize,
143 const char* src, char* dst, int n,
144 const size_t src_bpp, const size_t dst_bpp);
145
146}
147namespace hsw {
148
149void run_program(const Op* program, const void** contexts, ptrdiff_t programSize,
150 const char* src, char* dst, int n,
151 const size_t src_bpp, const size_t dst_bpp);
152
153}
154namespace skx {
155
156void run_program(const Op* program, const void** contexts, ptrdiff_t programSize,
157 const char* src, char* dst, int n,
158 const size_t src_bpp, const size_t dst_bpp);
159
160}
161} // namespace skcms_private
#define N
Definition beziers.cpp:19
__attribute__((visibility("default"))) int RunBenchmarks(int argc
void run_program(const Op *program, const void **contexts, ptrdiff_t programSize, const char *src, char *dst, int n, const size_t src_bpp, const size_t dst_bpp)
void run_program(const Op *program, const void **contexts, ptrdiff_t programSize, const char *src, char *dst, int n, const size_t src_bpp, const size_t dst_bpp)
void run_program(const Op *program, const void **contexts, ptrdiff_t programSize, const char *src, char *dst, int n, const size_t src_bpp, const size_t dst_bpp)
static const union skcms_private::@307 inf_
#define T
#define V(name)
Definition raw_object.h:124
#define SKCMS_STORE_OPS(M)
#define INFINITY_
#define SKCMS_WORK_OPS(M)