Debian Codegraph @

src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp

raw symbols SCIP
1 /*
2 * kaleid0sc0pe.cpp
3 * Copyright (C) 2020-2023 Brendan Hack ([email protected])
4 * This file is part of a Frei0r plugin that applies a kaleidoscope
5 * effect.
6 * Version 1.1 july 2023
7 *
8 * The kaleidoscope class implementation.
9 *
10 * This source code is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This source code is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please refer
18 * to the GNU Public License for more details.
19 *
20 * You should have received a copy of the GNU Public License along
21 * with this source code; if not, write to: Free Software Foundation,
22 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 */
25 #include "kaleid0sc0pe.h"cxx . . $ `<file>/src/filter/kaleid0sc0pe/kaleid0sc0pe.h`/
26 #include "frei0r/math.h"cxx . . $ `<file>/include/frei0r/math.h`/
27 #include <memory>
28 #include <cstring>
29 #ifndef NO_FUTURE
30 #include <future>
31 #endif
32
33 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
34 #define USE_SSE2cxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:34:9`!
35 #include "sse_mathfun_extension.h"cxx . . $ `<file>/src/filter/kaleid0sc0pe/sse_mathfun_extension.h`/
36 #undef USE_SSE2cxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:34:9`!
37 #ifdef HAS_INTEL_INTRINSICScxx . . $ `<built-in>:452:9`!
38 #include <immintrin.h>
39 #endif
40 #ifdef HAS_SIN_INTRINSIC
41 #define _mm_call_sin_ps _mm_sin_ps
42 #else
43 #define _mm_call_sin_pscxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:43:9`! sin_ps
44 #endif
45 #ifdef HAS_COS_INTRINSIC
46 #define _mm_call_cos_ps _mm_cos_ps
47 #else
48 #define _mm_call_cos_pscxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:48:9`! cos_ps
49 #endif
50 #ifdef HAS_ATAN2_INTRINSIC
51 #define _mm_call_atan2_ps _mm_atan2_ps
52 #else
53 #define _mm_call_atan2_pscxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:53:9`! atan2_ps
54 #endif
55 #endif
56
57 #ifndef M_PIcxx . . $ `<external>/11263917310783833665/math.h:1289:10`!
58 #define M_PI 3.14159265358979323846
59 #endif
60 #ifndef M_2PI
61 #define M_2PIcxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:61:9`! 6.28318530717958647693
62 #endif
63 #ifndef MF_PI
64 #define MF_PIcxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:64:9`! 3.14159265358979323846f
65 #endif
66 #ifndef MF_2PI
67 #define MF_2PIcxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:67:9`! 6.28318530717958647693f
68 #endif
69
70 namespace stdcxx . . $ std/
71 {
72
73 void default_deletecxx . . $ std/default_delete#<libkaleid0sc0pe::IKaleid0sc0pe>::operatorcxx . . $ std/default_delete#`operator()`(7c097689af2f81c5).()(libkaleid0sc0pecxx . . $ libkaleid0sc0pe/::IKaleid0sc0pecxx . . $ libkaleid0sc0pe/IKaleid0sc0pe# *p)
74 {
75 delete p;
76 }
77
78 } // namespace std
79
80 namespace libkaleid0sc0pecxx . . $ libkaleid0sc0pe/ {
81
82 IKaleid0sc0pecxx . . $ libkaleid0sc0pe/IKaleid0sc0pe# *IKaleid0sc0pecxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#::createcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#create(8b09b43ea4db254).(stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# width, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# height, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# component_size, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# num_components, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# stride)
83 {
84 return new Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#(width, height, component_size, num_components, stride);
85 }
86
87 Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Kaleid0sc0pe(a9b0a938867453dc).(stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# width, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# height, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# component_size, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# num_components, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# stride):
88 m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width.(width),
89 m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height.(height),
90 m_component_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_component_size.(component_size),
91 m_num_componentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_num_components.(num_components),
92 m_stridecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_stride.(stride ? stride : width * component_size * num_components),
93 m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.(component_size * num_components),
94 m_aspectcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_aspect.(width/static_cast<float>(height)),
95 m_origin_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_x.(0.5f),
96 m_origin_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_y.(0.5f),
97 m_origin_native_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_native_x.(m_origin_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_x. * width),
98 m_origin_native_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_native_y.(m_origin_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_y. * height),
99 m_segmentationcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segmentation.(16),
100 m_segment_directioncxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segment_direction.(Directioncxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#::NONEcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#NONE.),
101 m_preferred_cornercxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_preferred_corner.(Cornercxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner#::BRcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner#BR.),
102 m_preferred_search_dircxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_preferred_search_dir.(Directioncxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#::CLOCKWISEcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#CLOCKWISE.),
103 m_edge_reflectcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_reflect.(true),
104 m_background_colourcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_background_colour.(nullptr),
105 m_edge_thresholdcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_threshold.(0),
106 m_source_segment_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_source_segment_angle.(-1),
107 m_n_segmentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_segments.(0),
108 m_start_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_start_angle.(0),
109 m_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segment_width.(0),
110 m_n_threadscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_threads.(0)
111 {
112 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
113 m_sse_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_width. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(static_cast<float>(m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width.));
114 m_sse_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_height. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(static_cast<float>(m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height.));
115 m_sse_aspectcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_aspect. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width. / static_cast<float>(m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height.));
116 m_sse_ps_0cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_0. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(0.0f);
117 m_sse_ps_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_1. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(1.0f);
118 m_sse_ps_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_1. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(1.0f);
119 m_sse_ps_2cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_2. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(2.0f);
120 m_sse_epi32_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_epi32_1. = _mm_set1_epi32cxx . . $ _mm_set1_epi32(5a61b7d581f996c2).(1);
121 m_sse_epi32_2cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_epi32_2. = _mm_set1_epi32cxx . . $ _mm_set1_epi32(5a61b7d581f996c2).(2);
122 m_sse_shift_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_shift_1. = _mm_cvtsi32_si128cxx . . $ _mm_cvtsi32_si128(5a61b7d581f996c2).(1);
123 #endif
124 }
125
126 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::set_origincxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#set_origin(d492eb986ab7f0ea).(float x, float y)
127 {
128 if (x < 0 || y < 0 || x > 1 || y > 1) {
129 return -2;
130 }
131 m_origin_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_x. = x;
132 m_origin_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_y. = y;
133
134 m_origin_native_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_native_x. = m_origin_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_x. * m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width.;
135 m_origin_native_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_native_y. = m_origin_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_y. * m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height.;
136
137 m_n_segmentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_segments. = 0;
138
139 return 0;
140 }
141
142 float Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_origin_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_origin_x(5036dfe8d4170af2).() const
143 {
144 return m_origin_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_x.;
145 }
146
147 float Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_origin_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_origin_y(5036dfe8d4170af2).() const
148 {
149 return m_origin_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_y.;
150 }
151
152 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::set_segmentationcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#set_segmentation(4c679297bf94b9eb).(stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# segmentation)
153 {
154 if (segmentation == 0) {
155 return -2;
156 }
157 m_segmentationcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segmentation. = segmentation;
158 m_n_segmentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_segments. = 0;
159
160 return 0;
161 }
162
163 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_segmentationcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_segmentation(ddd8539a2fcdd4ce).() const
164 {
165 return m_segmentationcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segmentation.;
166 }
167
168 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::set_edge_thresholdcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#set_edge_threshold(4c679297bf94b9eb).(stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# threshold)
169 {
170 m_edge_thresholdcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_threshold. = threshold;
171 return 0;
172 }
173
174 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_edge_thresholdcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_edge_threshold(ddd8539a2fcdd4ce).() const
175 {
176 return m_edge_thresholdcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_threshold.;
177 }
178
179 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::set_preferred_cornercxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#set_preferred_corner(60b45789d1567f5a).(Cornercxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner# corner)
180 {
181 m_preferred_cornercxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_preferred_corner. = corner;
182 m_n_segmentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_segments. = 0;
183 return 0;
184 }
185
186 Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::Cornercxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_preferred_cornercxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_preferred_corner(9be458cf2f8c5004).() const
187 {
188 return m_preferred_cornercxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_preferred_corner.;
189 }
190
191 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::set_preferred_corner_search_directioncxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#set_preferred_corner_search_direction(353f52a649f12cd9).(Directioncxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction# direction)
192 {
193 if (direction == Directioncxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#::NONEcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#NONE.) {
194 return -2;
195 }
196 m_preferred_search_dircxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_preferred_search_dir. = direction;
197 m_n_segmentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_segments. = 0;
198 return 0;
199 }
200
201 Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::Directioncxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_preferred_corner_search_directioncxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_preferred_corner_search_direction(8f08a92890f4a76).() const
202 {
203 return m_preferred_search_dircxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_preferred_search_dir.;
204 }
205
206 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::set_reflect_edgescxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#set_reflect_edges(73da94e76e6bd037).(bool reflect)
207 {
208 m_edge_reflectcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_reflect. = reflect;
209 return 0;
210 }
211
212 bool Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_reflect_edgescxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_reflect_edges(50ce9a9e25b4a850).() const
213 {
214 return m_edge_reflectcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_reflect.;
215 }
216
217 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::set_background_colourcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#set_background_colour(dedf1e9b1c614a07).(void* colour)
218 {
219 m_background_colourcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_background_colour. = colour;
220 return 0;
221 }
222
223 void* Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_background_colourcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_background_colour(45a5c5ac6be858a8).() const
224 {
225 return m_background_colourcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_background_colour.;
226 }
227
228 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::set_source_segmentcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#set_source_segment(1bb0578f3efdc255).(float angle)
229 {
230 m_source_segment_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_source_segment_angle. = angle;
231 return 0;
232 }
233
234 float Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_source_segmentcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_source_segment(5036dfe8d4170af2).() const
235 {
236 return m_source_segment_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_source_segment_angle.;
237 }
238
239 static double distance_sqcxx . . $ libkaleid0sc0pe/distance_sq(6ba6c9f826937c6e).(double x1, double y1, double x2, double y2)
240 {
241 return stdcxx . . $ std/::pow(x1 - x2, 2) + stdcxx . . $ std/::pow(y1 - y2, 2);
242 }
243
244 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# inc_idxcxx . . $ libkaleid0sc0pe/inc_idx(2326284602b0bb2d).(stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# start_idx, stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# inc, stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# max)
245 {
246 start_idx += inc;
247 return (start_idx < 0) ? max - 1 : start_idx % max;
248 }
249
250 void Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::initcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#init(49f6e7a06ebc5aa8).()
251 {
252 m_n_segmentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_segments. = m_segmentationcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segmentation. * 2;
253 m_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segment_width. = MF_PIcxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:64:9`! * 2 / m_n_segmentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_segments.;
254
255 if (m_source_segment_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_source_segment_angle. < 0) {
256 // find origin rotation
257 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# corners[4][2] = {
258 { 0, 0 },
259 { 1, 0 },
260 { 1, 1 },
261 { 0, 1 }
262 };
263 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# start_idx(0);
264 switch (m_preferred_cornercxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_preferred_corner.) {
265 case Cornercxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner#::TLcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner#TL.: start_idx = 0; break;
266 case Cornercxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner#::TRcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner#TR.: start_idx = 1; break;
267 case Cornercxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner#::BRcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner#BR.: start_idx = 2; break;
268 case Cornercxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner#::BLcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Corner#BL.: start_idx = 3; break;
269 }
270 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# dir = m_preferred_search_dircxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_preferred_search_dir. == Directioncxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#::CLOCKWISEcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#CLOCKWISE. ? 1 : -1;
271 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# idx = start_idx;
272 float origin_x = m_origin_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_x.;
273 float origin_y = m_origin_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_y.;
274 double dist = distance_sqcxx . . $ libkaleid0sc0pe/distance_sq(6ba6c9f826937c6e).(origin_x, origin_y, corners[idx][0], corners[idx][1]);
275 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# corner = idx;
276 idx = inc_idxcxx . . $ libkaleid0sc0pe/inc_idx(2326284602b0bb2d).(idx, dir, 4);
277 while (idx != start_idx) {
278 double d = distance_sqcxx . . $ libkaleid0sc0pe/distance_sq(6ba6c9f826937c6e).(origin_x, origin_y, corners[idx][0], corners[idx][1]);
279 if (d > dist) {
280 dist = d;
281 corner = idx;
282 }
283 idx = inc_idxcxx . . $ libkaleid0sc0pe/inc_idx(2326284602b0bb2d).(idx, dir, 4);
284 }
285
286 float start_line_x = corners[corner][0] - origin_x;
287 float start_line_y = corners[corner][1] - origin_y;
288 m_start_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_start_angle. = stdcxx . . $ std/::atan2(start_line_y, start_line_x) - (m_segment_directioncxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segment_direction. == Directioncxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#::NONEcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#NONE. ?
289 0 :
290 (m_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segment_width. / (m_segment_directioncxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segment_direction. == Directioncxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#::CLOCKWISEcxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction#CLOCKWISE. ? -2 : 2)));
291 } else {
292 m_start_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_start_angle. = -m_source_segment_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_source_segment_angle.;
293 }
294 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
295 m_sse_origin_native_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_origin_native_x. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(m_origin_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_x. * m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width.);
296 m_sse_origin_native_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_origin_native_y. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(m_origin_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_origin_y. * m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height.);
297 m_sse_start_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_start_angle. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(m_start_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_start_angle.);
298 m_sse_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_segment_width. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(m_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segment_width.);
299 m_sse_half_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_half_segment_width. = _mm_set1_pscxx . . $ _mm_set1_ps(975dd02a9c095bb9).(m_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segment_width./2);
300 #endif
301 }
302
303 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
304 Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::Reflect_infocxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::calculate_reflect_infocxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#calculate_reflect_info(e35bad55186135e).(__m128icxx . . $ __m128i#* x, __m128icxx . . $ __m128i#* y)
305 {
306 Reflect_infocxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info# info;
307
308 to_screencxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#to_screen(cc60a2613d21fc81).(&info.screen_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#screen_x., &info.screen_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#screen_y., x, y);
309
310 info.anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#angle. = _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(_mm_call_atan2_pscxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:53:9`!(info.screen_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#screen_y., info.screen_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#screen_x.), m_sse_start_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_start_angle.);
311 info.reference_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#reference_angle. = _mm_add_pscxx . . $ _mm_add_ps(359170f1c294161a).(_mm_and_pscxx . . $ _mm_and_ps(359170f1c294161a).(info.anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#angle., *(v4sfcxx . . $ v4sf#*)_ps_inv_sign_maskcxx . . $ _ps_inv_sign_mask.), m_sse_half_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_half_segment_width.);
312 // we do a max with 0 since atan2_ps will return nan for atan2(0,0) which ends up with a negative reference angle.
313 info.segment_number_icxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#segment_number_i. = _mm_cvttps_epi32cxx . . $ _mm_cvttps_epi32(a63b6699cf1b06c3).(_mm_max_pscxx . . $ _mm_max_ps(359170f1c294161a).(_mm_div_pscxx . . $ _mm_div_ps(359170f1c294161a).(info.reference_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#reference_angle., m_sse_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_segment_width.), m_sse_ps_0cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_0.));
314 info.segment_numbercxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#segment_number. = _mm_cvtepi32_pscxx . . $ _mm_cvtepi32_ps(9be10ac41b2a5a4c).(info.segment_number_icxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#segment_number_i.);
315
316 return info;
317 }
318
319 void Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::to_screencxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#to_screen(cc60a2613d21fc81).(__m128cxx . . $ __m128#* x, __m128cxx . . $ __m128#* y, __m128icxx . . $ __m128i#* sx, __m128icxx . . $ __m128i#* sy)
320 {
321 *x = _mm_cvtepi32_pscxx . . $ _mm_cvtepi32_ps(9be10ac41b2a5a4c).(*sx);
322 *x = _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(*x, m_sse_origin_native_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_origin_native_x.);
323 *y = _mm_cvtepi32_pscxx . . $ _mm_cvtepi32_ps(9be10ac41b2a5a4c).(*sy);
324 *y = _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(*y, m_sse_origin_native_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_origin_native_y.);
325 *y = _mm_mul_pscxx . . $ _mm_mul_ps(359170f1c294161a).(*y, m_sse_aspectcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_aspect.);
326 }
327
328 void Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::from_screencxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#from_screen(31aeed7ee3ef8ddb).(__m128cxx . . $ __m128#* x, __m128cxx . . $ __m128#* y)
329 {
330 *x = _mm_add_pscxx . . $ _mm_add_ps(359170f1c294161a).(*x, m_sse_origin_native_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_origin_native_x.);
331 *y = _mm_div_pscxx . . $ _mm_div_ps(359170f1c294161a).(*y, m_sse_aspectcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_aspect.);
332 *y = _mm_add_pscxx . . $ _mm_add_ps(359170f1c294161a).(*y, m_sse_origin_native_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_origin_native_y.);
333 }
334
335 void Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::rotatecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#rotate(f1982a1c1b010a3b).(int x, int y, __m128cxx . . $ __m128# *source_x, __m128cxx . . $ __m128# *source_y)
336 {
337 ALIGN16_BEGcxx . . $ `src/filter/kaleid0sc0pe/sse_mathfun.h:40:10`! int ALIGN16_ENDcxx . . $ `src/filter/kaleid0sc0pe/sse_mathfun.h:41:10`! mx[4] = { x, x + 1, x + 2, x + 3 };
338 ALIGN16_BEGcxx . . $ `src/filter/kaleid0sc0pe/sse_mathfun.h:40:10`! int ALIGN16_ENDcxx . . $ `src/filter/kaleid0sc0pe/sse_mathfun.h:41:10`! my[4] = { y, y, y, y };
339
340 Reflect_infocxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info# info = calculate_reflect_infocxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#calculate_reflect_info(e35bad55186135e).((__m128icxx . . $ __m128i#*)mx, (__m128icxx . . $ __m128i#*)my);
341
342 __m128cxx . . $ __m128# reflection_angle = _mm_mul_pscxx . . $ _mm_mul_ps(359170f1c294161a).(info.segment_numbercxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#segment_number., m_sse_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_segment_width.);
343
344 __m128icxx . . $ __m128i# segi_p1 = _mm_add_epi32cxx . . $ _mm_add_epi32(e79ab442e937dade).(info.segment_number_icxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#segment_number_i., m_sse_epi32_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_epi32_1.);
345 __m128cxx . . $ __m128# refl_factor = _mm_cvtepi32_pscxx . . $ _mm_cvtepi32_ps(9be10ac41b2a5a4c).(_mm_sub_epi32cxx . . $ _mm_sub_epi32(e79ab442e937dade).(_mm_srl_epi32cxx . . $ _mm_srl_epi32(e79ab442e937dade).(segi_p1, m_sse_shift_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_shift_1.), _mm_srl_epi32cxx . . $ _mm_srl_epi32(e79ab442e937dade).(info.segment_number_icxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#segment_number_i., m_sse_shift_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_shift_1.)));
346
347 reflection_angle = _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(reflection_angle, _mm_mul_pscxx . . $ _mm_mul_ps(359170f1c294161a).(refl_factor, _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(m_sse_segment_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_segment_width., _mm_mul_pscxx . . $ _mm_mul_ps(359170f1c294161a).(m_sse_ps_2cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_2., _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(info.reference_anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#reference_angle., reflection_angle)))));
348
349 reflection_angle = _mm_mul_pscxx . . $ _mm_mul_ps(359170f1c294161a).(reflection_angle, _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(m_sse_ps_0cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_0., _mm_or_pscxx . . $ _mm_or_ps(359170f1c294161a).(_mm_and_pscxx . . $ _mm_and_ps(359170f1c294161a).(info.anglecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#angle., *(v4sfcxx . . $ v4sf#*)_ps_sign_maskcxx . . $ _ps_sign_mask.), m_sse_ps_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_1.)));
350
351 reflection_angle = _mm_mul_pscxx . . $ _mm_mul_ps(359170f1c294161a).(reflection_angle, _mm_and_pscxx . . $ _mm_and_ps(359170f1c294161a).(_mm_cmpge_pscxx . . $ _mm_cmpge_ps(359170f1c294161a).(info.segment_numbercxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#segment_number., m_sse_ps_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_1.), m_sse_ps_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_1.));
352
353 __m128cxx . . $ __m128# cos_angle = _mm_call_cos_pscxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:48:9`!(reflection_angle);
354 __m128cxx . . $ __m128# sin_angle = _mm_call_sin_pscxx . . $ `src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp:43:9`!(reflection_angle);
355 *source_x = _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(_mm_mul_pscxx . . $ _mm_mul_ps(359170f1c294161a).(info.screen_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#screen_x., cos_angle), _mm_mul_pscxx . . $ _mm_mul_ps(359170f1c294161a).(info.screen_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#screen_y., sin_angle));
356 *source_y = _mm_add_pscxx . . $ _mm_add_ps(359170f1c294161a).(_mm_mul_pscxx . . $ _mm_mul_ps(359170f1c294161a).(info.screen_ycxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#screen_y., cos_angle), _mm_mul_pscxx . . $ _mm_mul_ps(359170f1c294161a).(info.screen_xcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#screen_x., sin_angle));
357
358 from_screencxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#from_screen(31aeed7ee3ef8ddb).(source_x, source_y);
359 }
360
361 #else
362 Kaleid0sc0pe::Reflect_info Kaleid0sc0pe::calculate_reflect_info(std::uint32_t x, std::uint32_t y)
363 {
364 Reflect_info info;
365
366 to_screen(&(info.screen_x), &(info.screen_y), x, y);
367
368 info.angle = std::atan2(info.screen_y, info.screen_x) - m_start_angle;
369 info.reference_angle = std::fabs(info.angle) + m_segment_width / 2;
370 info.segment_number = std::uint32_t(info.reference_angle / m_segment_width);
371
372 return info;
373 }
374 void Kaleid0sc0pe::to_screen(float *x, float *y, std::uint32_t sx, std::uint32_t sy)
375 {
376 *x = sx - m_origin_native_x;
377 *y = (sy - m_origin_native_y) * m_aspect;
378 }
379
380 void Kaleid0sc0pe::from_screen(float *x, float *y)
381 {
382 *x = *x + m_origin_native_x;
383 *y = *y / m_aspect + m_origin_native_y;
384 }
385 #endif
386
387 const stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# *Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::lookupcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#lookup(4728f6a7e5f4cbd9).(const stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#* p, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# x, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# y)
388 {
389 return p + m_stridecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_stride. * static_cast<stdcxx . . $ std/::size_tcxx . . $ std/size_t#>(y) + m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size. * static_cast<stdcxx . . $ std/::size_tcxx . . $ std/size_t#>(x);
390 }
391
392 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#* Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::lookupcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#lookup(75cab8e1ec3de26e).(stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#* p, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# x, stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# y)
393 {
394 return p + m_stridecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_stride. * static_cast<stdcxx . . $ std/::size_tcxx . . $ std/size_t#>(y) + m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size. * static_cast<stdcxx . . $ std/::size_tcxx . . $ std/size_t#>(x);
395 }
396
397 void Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::process_bgcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_bg(cc4440d4a424271d).(float x, float y, const stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#* in, stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#* out)
398 {
399 if (x < 0 && -x <= m_edge_thresholdcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_threshold.) {
400 x = 0;
401 }
402 else if (x >= m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width. && x < m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width. + m_edge_thresholdcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_threshold.) {
403 x = m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width. - 1.0f;
404 }
405 if (y < 0 && -y <= m_edge_thresholdcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_threshold.) {
406 y = 0;
407 }
408 else if (y >= m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height. && y < m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height. + m_edge_thresholdcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_threshold.) {
409 y = m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height. - 1.0f;
410 }
411 if (static_cast<stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t#>(x) >= 0 && static_cast<stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t#>(x) < m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width. &&
412 static_cast<stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t#>(y) >= 0 && static_cast<stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t#>(y) < m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height.) {
413 stdcxx . . $ std/::memcpy(out, lookupcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#lookup(4728f6a7e5f4cbd9).(in, static_cast<stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t#>(x), static_cast<stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t#>(y)), m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.);
414 }
415 else if (m_background_colourcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_background_colour.) {
416 stdcxx . . $ std/::memcpy(out, reinterpret_cast<const stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#*>(m_background_colourcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_background_colour.), m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.);
417 }
418 }
419
420 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
421 void Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::process_blockcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_block(5fadc98ed64482aa).(Blockcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#* block)
422 {
423 for (stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# y = block->y_startcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#y_start.; y <= static_cast<stdcxx . . $ std/::int32_tcxx . . $ std/int32_t#>(block->y_endcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#y_end.); ++y) {
424 for (stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# x = block->x_startcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#x_start.; x <= static_cast<stdcxx . . $ std/::int32_tcxx . . $ std/int32_t#>(block->x_endcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#x_end.); x += 4) {
425 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#* out = lookupcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#lookup(75cab8e1ec3de26e).(block->out_framecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#out_frame., x, y);
426 __m128cxx . . $ __m128# source_x;
427 __m128cxx . . $ __m128# source_y;
428
429 // rotate points to source_x,source_y
430 rotatecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#rotate(f1982a1c1b010a3b).(x, y, &source_x, &source_y);
431
432 // reflect back into image if necessary
433
434 source_x = _mm_and_pscxx . . $ _mm_and_ps(359170f1c294161a).(source_x, *(v4sfcxx . . $ v4sf#*)_ps_inv_sign_maskcxx . . $ _ps_inv_sign_mask.);
435 __m128cxx . . $ __m128# ge_width = _mm_cmpge_pscxx . . $ _mm_cmpge_ps(359170f1c294161a).(source_x, m_sse_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_width.);
436 source_x = _mm_or_pscxx . . $ _mm_or_ps(359170f1c294161a).(_mm_and_pscxx . . $ _mm_and_ps(359170f1c294161a).(_mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(m_sse_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_width., _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(source_x, m_sse_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_width.)), ge_width), _mm_andnot_pscxx . . $ _mm_andnot_ps(359170f1c294161a).(ge_width, source_x));
437
438 // same for y
439 source_y = _mm_and_pscxx . . $ _mm_and_ps(359170f1c294161a).(source_y, *(v4sfcxx . . $ v4sf#*)_ps_inv_sign_maskcxx . . $ _ps_inv_sign_mask.);
440 __m128cxx . . $ __m128# ge_height = _mm_cmpge_pscxx . . $ _mm_cmpge_ps(359170f1c294161a).(source_y, m_sse_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_height.);
441 source_y = _mm_or_pscxx . . $ _mm_or_ps(359170f1c294161a).(_mm_and_pscxx . . $ _mm_and_ps(359170f1c294161a).(_mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(m_sse_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_height., _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(source_y, m_sse_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_height.)), ge_height), _mm_andnot_pscxx . . $ _mm_andnot_ps(359170f1c294161a).(ge_height,source_y));
442
443 __m128icxx . . $ __m128i# source_xi = _mm_cvttps_epi32cxx . . $ _mm_cvttps_epi32(a63b6699cf1b06c3).(_mm_min_pscxx . . $ _mm_min_ps(359170f1c294161a).(_mm_max_pscxx . . $ _mm_max_ps(359170f1c294161a).(source_x, _mm_setzero_pscxx . . $ _mm_setzero_ps(6f56d86985015e33).()), _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(m_sse_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_width., m_sse_ps_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_1.)));
444 __m128icxx . . $ __m128i# source_yi = _mm_cvttps_epi32cxx . . $ _mm_cvttps_epi32(a63b6699cf1b06c3).(_mm_min_pscxx . . $ _mm_min_ps(359170f1c294161a).(_mm_max_pscxx . . $ _mm_max_ps(359170f1c294161a).(source_y, _mm_setzero_pscxx . . $ _mm_setzero_ps(6f56d86985015e33).()), _mm_sub_pscxx . . $ _mm_sub_ps(359170f1c294161a).(m_sse_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_height., m_sse_ps_1cxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_sse_ps_1.)));
445
446 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t#* sx = reinterpret_cast<stdcxx . . $ std/::int32_tcxx . . $ std/int32_t#*>(&source_xi);
447 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t#* sy = reinterpret_cast<stdcxx . . $ std/::int32_tcxx . . $ std/int32_t#*>(&source_yi);
448
449 for (int i = 0; i < 4; ++i) {
450 sx[i] = CLAMPcxx . . $ `include/frei0r/math.h:48:9`!(sx[i], 0, static_cast<std::int32_t>(m_width) - 1);
451 sy[i] = CLAMPcxx . . $ `include/frei0r/math.h:48:9`!(sy[i], 0, static_cast<std::int32_t>(m_height) - 1);
452 }
453
454 stdcxx . . $ std/::memcpy(out, lookupcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#lookup(4728f6a7e5f4cbd9).(block->in_framecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#in_frame., sx[0], sy[0]), m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.);
455 out += m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.;
456 stdcxx . . $ std/::memcpy(out, lookupcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#lookup(4728f6a7e5f4cbd9).(block->in_framecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#in_frame., sx[1], sy[1]), m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.);
457 out += m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.;
458 stdcxx . . $ std/::memcpy(out, lookupcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#lookup(4728f6a7e5f4cbd9).(block->in_framecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#in_frame., sx[2], sy[2]), m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.);
459 out += m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.;
460 stdcxx . . $ std/::memcpy(out, lookupcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#lookup(4728f6a7e5f4cbd9).(block->in_framecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#in_frame., sx[3], sy[3]), m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.);
461 }
462 }
463 }
464
465 void Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::process_block_bgcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_block_bg(5fadc98ed64482aa).(Blockcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#* block)
466 {
467 for (stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# y = block->y_startcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#y_start.; y <= static_cast<stdcxx . . $ std/::int32_tcxx . . $ std/int32_t#>(block->y_endcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#y_end.); ++y) {
468 for (stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# x = block->x_startcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#x_start.; x <= static_cast<stdcxx . . $ std/::int32_tcxx . . $ std/int32_t#>(block->x_endcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#x_end.); x += 4) {
469 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#* out = lookupcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#lookup(75cab8e1ec3de26e).(block->out_framecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#out_frame., x, y);
470 __m128cxx . . $ __m128# source_x;
471 __m128cxx . . $ __m128# source_y;
472
473 // rotate points to source_x,source_y
474 rotatecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#rotate(f1982a1c1b010a3b).(x, y, &source_x, &source_y);
475
476 float* sx = reinterpret_cast<float*>(&source_x);
477 float* sy = reinterpret_cast<float*>(&source_y);
478 process_bgcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_bg(cc4440d4a424271d).(sx[0], sy[0], block->in_framecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#in_frame., out);
479 out += m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.;
480 process_bgcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_bg(cc4440d4a424271d).(sx[1], sy[1], block->in_framecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#in_frame., out);
481 out += m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.;
482 process_bgcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_bg(cc4440d4a424271d).(sx[2], sy[2], block->in_framecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#in_frame., out);
483 out += m_pixel_sizecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_pixel_size.;
484 process_bgcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_bg(cc4440d4a424271d).(sx[3], sy[3], block->in_framecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#in_frame., out);
485 }
486 }
487 }
488
489
490 #else
491 void Kaleid0sc0pe::process_block(Block *block)
492 {
493 for (std::uint32_t y = block->y_start; y <= block->y_end; ++y) {
494 for (std::uint32_t x = block->x_start; x <= block->x_end; ++x) {
495 std::uint8_t* out = lookup(block->out_frame, x, y);
496
497 Reflect_info info = calculate_reflect_info(x, y);
498
499 if (info.segment_number) {
500 float reflection_angle = (info.segment_number * m_segment_width);
501 reflection_angle -= info.segment_number % 2 ? (m_segment_width - 2 * (info.reference_angle - reflection_angle)) : 0;
502
503 reflection_angle *= std::signbit(info.angle) ? 1 : -1;
504 float cos_angle = std::cos(reflection_angle);
505 float sin_angle = std::sin(reflection_angle);
506 float source_x = info.screen_x * cos_angle - info.screen_y * sin_angle;
507 float source_y = info.screen_y * cos_angle + info.screen_x * sin_angle;
508
509 from_screen(&source_x, &source_y);
510
511 if (m_edge_reflect) {
512 if (source_x < 0) {
513 source_x = -source_x;
514 } else if (source_x > m_width - 10e-4f) {
515 source_x = m_width - (source_x - m_width + 10e-4f);
516 } if (source_y < 0) {
517 source_y = -source_y;
518 } else if (source_y > m_height - 10e-4f) {
519 source_y = m_height - (source_y - m_height + 10e-4f);
520 }
521 source_x = CLAMP(source_x, 0.0f, static_cast<float>(m_width - 1));
522 source_y = CLAMP(source_y, 0.0f, static_cast<float>(m_height - 1));
523 std::memcpy(out, lookup(block->in_frame, static_cast<std::uint32_t>(source_x), static_cast<std::uint32_t>(source_y)), m_pixel_size);
524 } else {
525 process_bg(source_x, source_y, block->in_frame, out);
526 }
527 } else {
528 std::memcpy(out, lookup(block->in_frame, x, y), m_pixel_size);
529 }
530 }
531 }
532 }
533 #endif
534
535 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# colourscxx . . $ libkaleid0sc0pe/colours.[63][3] = {
536 { 0x00, 0xFF, 0x00 },
537 { 0x00, 0x00, 0xFF },
538 { 0xFF, 0x00, 0x00 },
539 { 0x01, 0xFF, 0xFE },
540 { 0xFF, 0xA6, 0xFE },
541 { 0xFF, 0xDB, 0x66 },
542 { 0x00, 0x64, 0x01 },
543 { 0x01, 0x00, 0x67 },
544 { 0x95, 0x00, 0x3A },
545 { 0x00, 0x7D, 0xB5 },
546 { 0xFF, 0x00, 0xF6 },
547 { 0xFF, 0xEE, 0xE8 },
548 { 0x77, 0x4D, 0x00 },
549 { 0x90, 0xFB, 0x92 },
550 { 0x00, 0x76, 0xFF },
551 { 0xD5, 0xFF, 0x00 },
552 { 0xFF, 0x93, 0x7E },
553 { 0x6A, 0x82, 0x6C },
554 { 0xFF, 0x02, 0x9D },
555 { 0xFE, 0x89, 0x00 },
556 { 0x7A, 0x47, 0x82 },
557 { 0x7E, 0x2D, 0xD2 },
558 { 0x85, 0xA9, 0x00 },
559 { 0xFF, 0x00, 0x56 },
560 { 0xA4, 0x24, 0x00 },
561 { 0x00, 0xAE, 0x7E },
562 { 0x68, 0x3D, 0x3B },
563 { 0xBD, 0xC6, 0xFF },
564 { 0x26, 0x34, 0x00 },
565 { 0xBD, 0xD3, 0x93 },
566 { 0x00, 0xB9, 0x17 },
567 { 0x9E, 0x00, 0x8E },
568 { 0x00, 0x15, 0x44 },
569 { 0xC2, 0x8C, 0x9F },
570 { 0xFF, 0x74, 0xA3 },
571 { 0x01, 0xD0, 0xFF },
572 { 0x00, 0x47, 0x54 },
573 { 0xE5, 0x6F, 0xFE },
574 { 0x78, 0x82, 0x31 },
575 { 0x0E, 0x4C, 0xA1 },
576 { 0x91, 0xD0, 0xCB },
577 { 0xBE, 0x99, 0x70 },
578 { 0x96, 0x8A, 0xE8 },
579 { 0xBB, 0x88, 0x00 },
580 { 0x43, 0x00, 0x2C },
581 { 0xDE, 0xFF, 0x74 },
582 { 0x00, 0xFF, 0xC6 },
583 { 0xFF, 0xE5, 0x02 },
584 { 0x62, 0x0E, 0x00 },
585 { 0x00, 0x8F, 0x9C },
586 { 0x98, 0xFF, 0x52 },
587 { 0x75, 0x44, 0xB1 },
588 { 0xB5, 0x00, 0xFF },
589 { 0x00, 0xFF, 0x78 },
590 { 0xFF, 0x6E, 0x41 },
591 { 0x00, 0x5F, 0x39 },
592 { 0x6B, 0x68, 0x82 },
593 { 0x5F, 0xAD, 0x4E },
594 { 0xA7, 0x57, 0x40 },
595 { 0xA5, 0xFF, 0xD2 },
596 { 0xFF, 0xB1, 0x67 },
597 { 0x00, 0x9B, 0xFF },
598 { 0xE8, 0x5E, 0xBE }
599 };
600
601 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::set_segment_directioncxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#set_segment_direction(353f52a649f12cd9).(Directioncxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction# direction)
602 {
603 m_segment_directioncxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segment_direction. = direction;
604 m_n_segmentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_segments. = 0;
605 return 0;
606 }
607
608 libkaleid0sc0pecxx . . $ libkaleid0sc0pe/::Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::Directioncxx . . $ libkaleid0sc0pe/IKaleid0sc0pe#Direction# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_segment_directioncxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_segment_direction(8f08a92890f4a76).() const
609 {
610 return m_segment_directioncxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_segment_direction.;
611 }
612
613 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::processcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process(6232915893069c98).(const void* in_frame, void* out_frame)
614 {
615 if (in_frame == nullptr || out_frame == nullptr) {
616 return -2;
617 }
618 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
619 if (m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width. % 4 != 0) {
620 return -2;
621 }
622 #endif
623 if (m_n_segmentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_segments. == 0) {
624 initcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#init(49f6e7a06ebc5aa8).();
625 }
626 #ifdef NO_FUTURE
627 Block block(reinterpret_cast<const std::uint8_t*>(in_frame),
628 reinterpret_cast<std::uint8_t*>(out_frame),
629 0, 0,
630 m_width - 1, m_height - 1);
631 #ifdef __SSE2__
632 if (m_edge_reflect) {
633 process_block(&block);
634 } else {
635 process_block_bg(&block);
636 }
637 #else
638 process_block(&block);
639 #endif
640 #else
641 if (m_n_threadscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_threads. == 1) {
642 Blockcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block# blockcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#Block(c358b011fdb35479).(reinterpret_cast<const stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#*>(in_frame),
643 reinterpret_cast<stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#*>(out_frame),
644 0, 0,
645 m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width. - 1, m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height. - 1);
646 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
647 if (m_edge_reflectcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_reflect.) {
648 process_blockcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_block(5fadc98ed64482aa).(&block);
649 } else {
650 process_block_bgcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_block_bg(5fadc98ed64482aa).(&block);
651 }
652 #else
653 process_block(&block);
654 #endif
655 } else {
656 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# n_threads = m_n_threadscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_threads. == 0 ? stdcxx . . $ std/::threadcxx . . $ std/thread#::hardware_concurrencycxx . . $ std/thread#hardware_concurrency(db52760e79bf9054).() : m_n_threadscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_threads.;
657
658 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::futurecxx . . $ std/future#<void>> futurescxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
659 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<Blockcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#>> blockscxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
660
661 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# block_height = m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height. / n_threads;
662 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# y_start = 0;
663 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# y_end = m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height. - block_height * (n_threads - 1) - 1;
664
665 for (stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# i = 0; i < n_threads; ++i) {
666 blocks.emplace_backcxx . . $ std/vector#emplace_back(b3d147e3bb711c35).(new Blockcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Block#(
667 reinterpret_cast<const stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#*>(in_frame),
668 reinterpret_cast<stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#*>(out_frame),
669 0, y_start,
670 m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width. - 1, y_end));
671
672 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
673 futures.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::asynccxx . . $ std/async(198f4be7f5e581d8).(stdcxx . . $ std/::launchcxx . . $ std/launch#::asynccxx . . $ std/launch#async., m_edge_reflectcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_edge_reflect. ? &Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::process_blockcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_block(5fadc98ed64482aa). : &Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::process_block_bgcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#process_block_bg(5fadc98ed64482aa)., this, blocks[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).()));
674 #else
675 futures.push_back(std::async(std::launch::async, &Kaleid0sc0pe::process_block, this, blocks[i].get()));
676 #endif
677 y_start = y_end + 1;
678 y_end += block_height;
679 }
680 for (auto& f : futures) {
681 f.waitcxx . . $ std/__basic_future#wait(83f5f38750778ac8).();
682 }
683 }
684 #endif
685
686 return 0;
687 }
688
689 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::set_threadingcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#set_threading(4c679297bf94b9eb).(stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# threading)
690 {
691 m_n_threadscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_threads. = threading;
692 return 0;
693 }
694
695 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::get_threadingcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#get_threading(ddd8539a2fcdd4ce).() const
696 {
697 return m_n_threadscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_threads.;
698 }
699
700 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t# Kaleid0sc0pecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#::visualisecxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#visualise(dedf1e9b1c614a07).(void* out_frame)
701 {
702 if (out_frame == nullptr) {
703 return -2;
704 }
705 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
706 if (m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width. % 4 != 0) {
707 return -2;
708 }
709 #endif
710 if (m_n_segmentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_n_segments. == 0) {
711 initcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#init(49f6e7a06ebc5aa8).();
712 }
713
714 for (stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# y = 0; y < m_heightcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_height.; ++y) {
715 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
716 for (stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# x = 0; x < m_widthcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_width.; x+=4) {
717 #else
718 for (std::uint32_t x = 0; x < m_width; ++x) {
719 #endif
720 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#* out = lookupcxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#lookup(75cab8e1ec3de26e).(reinterpret_cast<stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#*>(out_frame), x, y);
721 #ifdef __SSE2__cxx . . $ `<built-in>:422:9`!
722 ALIGN16_BEGcxx . . $ `src/filter/kaleid0sc0pe/sse_mathfun.h:40:10`! int ALIGN16_ENDcxx . . $ `src/filter/kaleid0sc0pe/sse_mathfun.h:41:10`! mx[4] = { static_cast<int>(x), static_cast<int>(x) + 1, static_cast<int>(x) + 2, static_cast<int>(x) + 3};
723 ALIGN16_BEGcxx . . $ `src/filter/kaleid0sc0pe/sse_mathfun.h:40:10`! int ALIGN16_ENDcxx . . $ `src/filter/kaleid0sc0pe/sse_mathfun.h:41:10`! my[4] = { static_cast<int>(y), static_cast<int>(y), static_cast<int>(y), static_cast<int>(y) };
724
725 Reflect_infocxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info# info = calculate_reflect_infocxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#calculate_reflect_info(e35bad55186135e).((__m128icxx . . $ __m128i#*)mx, (__m128icxx . . $ __m128i#*)my);
726 //float* segment_number = reinterpret_cast<float*>(&info.segment_number);
727 stdcxx . . $ std/::int32_tcxx . . $ std/int32_t#* segment_number = reinterpret_cast<stdcxx . . $ std/::int32_tcxx . . $ std/int32_t#*>(&info.segment_number_icxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#Reflect_info#segment_number_i.);
728 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# col_idx = (*segment_number) % 63;
729 out[0] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][0];
730 out[1] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][1];
731 out[2] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][2];
732 if (m_num_componentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_num_components. > 3) {
733 out[3] = 0xff;
734 out++;
735 }
736 segment_number++;
737 out += 3;
738
739 col_idx = (*segment_number) % 63;
740 out[0] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][0];
741 out[1] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][1];
742 out[2] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][2];
743 if (m_num_componentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_num_components. > 3) {
744 out[3] = 0xff;
745 out++;
746 }
747 segment_number++;
748 out += 3;
749
750 col_idx = (*segment_number) % 63;
751 out[0] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][0];
752 out[1] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][1];
753 out[2] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][2];
754 if (m_num_componentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_num_components. > 3) {
755 out[3] = 0xff;
756 out++;
757 }
758 segment_number++;
759 out += 3;
760
761 col_idx = (*segment_number) % 63;
762 out[0] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][0];
763 out[1] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][1];
764 out[2] = colourscxx . . $ libkaleid0sc0pe/colours.[col_idx][2];
765 if (m_num_componentscxx . . $ libkaleid0sc0pe/Kaleid0sc0pe#m_num_components. > 3) {
766 out[3] = 0xff;
767 out++;
768 }
769
770 #else
771 Reflect_info info = calculate_reflect_info(x, y);
772 std::uint32_t col_idx = info.segment_number % 63;
773 out[0] = colours[col_idx][0];
774 out[1] = colours[col_idx][1];
775 out[2] = colours[col_idx][2];
776 if (m_num_components > 3) {
777 out[3] = 0xff;
778 }
779 #endif
780
781 }
782 }
783 return 0;
784 }
785
786 } // namespace libkaleid0sc0pe