Debian Codegraph @

src/filter/pixels0rt/pixels0rt.c

raw symbols SCIP
1 /* pixels0rt.c
2 * Copyright (C) 2026 Asterleen ~ https://asterleen.com
3 * Implements a pixel sorting effect
4 *
5 * This file is a Frei0r plugin.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #include <stdlib.h>
23 #include <assert.h>
24 #include <string.h>
25 #include <stdio.h>
26
27 #include "frei0r.h"cxx . . $ `<file>/include/frei0r.h`/
28
29 #define S0RT_PARAM_THRESHOLDcxx . . $ `src/filter/pixels0rt/pixels0rt.c:29:9`! 0
30 #define S0RT_PARAM_DIRECTIONcxx . . $ `src/filter/pixels0rt/pixels0rt.c:30:9`! 1
31 #define S0RT_PARAM_REVERSEDcxx . . $ `src/filter/pixels0rt/pixels0rt.c:31:9`! 2
32 #define S0RT_PARAM_ALPHA_THRcxx . . $ `src/filter/pixels0rt/pixels0rt.c:32:9`! 3
33
34 typedef enum pixels0rt_directioncxx . . $ pixels0rt_direction#
35 {
36 S0RT_DIRECTION_VER_TOPcxx . . $ S0RT_DIRECTION_VER_TOP., // vertical, from top to bottom
37 S0RT_DIRECTION_VER_BOTTOMcxx . . $ S0RT_DIRECTION_VER_BOTTOM., // vertical, from bottom to top
38 S0RT_DIRECTION_HOR_LEFTcxx . . $ S0RT_DIRECTION_HOR_LEFT., // horizontal, from left to right
39 S0RT_DIRECTION_HOR_RIGHTcxx . . $ S0RT_DIRECTION_HOR_RIGHT., // horizontal, from right to left
40
41 S0RT_DIRECTION_COUNTcxx . . $ S0RT_DIRECTION_COUNT. // total number of possible directions
42
43 } pixels0rt_direction_tcxx . . $ pixels0rt_direction_t#;
44
45
46 typedef struct pixels0rt_instancecxx . . $ pixels0rt_instance#
47 {
48 unsigned int widthcxx . . $ pixels0rt_instance#width.;
49 unsigned int heightcxx . . $ pixels0rt_instance#height.;
50
51 uint8_tcxx . . $ uint8_t# *grayscale_pxcxx . . $ pixels0rt_instance#grayscale_px.; // the frame in grayscale, will be used for radix sort
52
53 float thresholdcxx . . $ pixels0rt_instance#threshold.;
54 float alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold.;
55 short int reversedcxx . . $ pixels0rt_instance#reversed.;
56 pixels0rt_direction_tcxx . . $ pixels0rt_direction_t# directioncxx . . $ pixels0rt_instance#direction.;
57
58 } pixels0rt_instance_tcxx . . $ pixels0rt_instance_t#;
59
60 inline static uint8_tcxx . . $ uint8_t# pixel_grayscalecxx . . $ pixel_grayscale(32407b39b2dfce37).(uint32_tcxx . . $ uint32_t# px)
61 {
62 uint8_tcxx . . $ uint8_t# *pxSplit = (uint8_tcxx . . $ uint8_t# *)&px;
63
64 return ((pxSplit[0] & 0xFF) +
65 (pxSplit[1] & 0xFF) +
66 (pxSplit[2] & 0xFF)) / 3;
67 }
68
69 inline static short pixel_alpha_thresholdcxx . . $ pixel_alpha_threshold(894d65fb28e0460).(uint32_tcxx . . $ uint32_t# px, float threshold)
70 {
71 uint8_tcxx . . $ uint8_t# *pxSplit = (uint8_tcxx . . $ uint8_t# *)&px;
72
73 return pxSplit[3] / 0xFF >= threshold;
74 }
75
76 inline static double pixel_diffcxx . . $ pixel_diff(113c4becdd908a77).(uint32_tcxx . . $ uint32_t# px1, uint32_tcxx . . $ uint32_t# px2)
77 {
78 uint8_tcxx . . $ uint8_t# *px1_split = (uint8_tcxx . . $ uint8_t# *)&px1;
79 uint8_tcxx . . $ uint8_t# *px2_split = (uint8_tcxx . . $ uint8_t# *)&px2;
80
81 return (
82 abscxx . . $ abs(7864480464b09eea).(px1_split[0] - px2_split[0]) +
83 abscxx . . $ abs(7864480464b09eea).(px1_split[1] - px2_split[1]) +
84 abscxx . . $ abs(7864480464b09eea).(px1_split[2] - px2_split[2])
85 ) / 765.0;
86 }
87
88 int f0r_initcxx . . $ f0r_init(b126dc7c1de90089).()
89 {
90 return 1;
91 }
92
93 void f0r_deinitcxx . . $ f0r_deinit(49f6e7a06ebc5aa8).()
94 { /* no initialization required */ }
95
96 void f0r_get_plugin_infocxx . . $ f0r_get_plugin_info(35d753456c0ea59c).(f0r_plugin_info_tcxx . . $ f0r_plugin_info_t#* pixels0rtInfo)
97 {
98 pixels0rtInfo->namecxx . . $ f0r_plugin_info#name. = "pixels0rt";
99 pixels0rtInfo->authorcxx . . $ f0r_plugin_info#author. = "Asterleen";
100 pixels0rtInfo->plugin_typecxx . . $ f0r_plugin_info#plugin_type. = F0R_PLUGIN_TYPE_FILTERcxx . . $ `include/frei0r.h:247:9`!;
101 pixels0rtInfo->color_modelcxx . . $ f0r_plugin_info#color_model. = F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!;
102 pixels0rtInfo->frei0r_versioncxx . . $ f0r_plugin_info#frei0r_version. = FREI0R_MAJOR_VERSIONcxx . . $ `include/frei0r.h:217:9`!;
103 pixels0rtInfo->major_versioncxx . . $ f0r_plugin_info#major_version. = 1;
104 pixels0rtInfo->minor_versioncxx . . $ f0r_plugin_info#minor_version. = 0;
105 pixels0rtInfo->num_paramscxx . . $ f0r_plugin_info#num_params. = 4;
106 pixels0rtInfo->explanationcxx . . $ f0r_plugin_info#explanation. = "Pixel sorting effect";
107 }
108
109 void f0r_get_param_infocxx . . $ f0r_get_param_info(a9f9aa7954cc4a37).(f0r_param_info_tcxx . . $ f0r_param_info_t#* info, int param_index)
110 {
111 switch(param_index) {
112 case S0RT_PARAM_THRESHOLDcxx . . $ `src/filter/pixels0rt/pixels0rt.c:29:9`!:
113 {
114 info->namecxx . . $ f0r_param_info#name. = "Threshold";
115 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!;
116 info->explanationcxx . . $ f0r_param_info#explanation. = "Relative size of the line that will be sorted";
117 break;
118 }
119
120 case S0RT_PARAM_DIRECTIONcxx . . $ `src/filter/pixels0rt/pixels0rt.c:30:9`!:
121 {
122 info->namecxx . . $ f0r_param_info#name. = "Direction";
123 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!;
124 info->explanationcxx . . $ f0r_param_info#explanation. = "Sorting direction";
125 break;
126 }
127
128 case S0RT_PARAM_REVERSEDcxx . . $ `src/filter/pixels0rt/pixels0rt.c:31:9`!:
129 {
130 info->namecxx . . $ f0r_param_info#name. = "Reversed";
131 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_BOOLcxx . . $ `include/frei0r.h:377:9`!;
132 info->explanationcxx . . $ f0r_param_info#explanation. = "Should be pixels sorted in reversed order";
133 break;
134 }
135
136 case S0RT_PARAM_ALPHA_THRcxx . . $ `src/filter/pixels0rt/pixels0rt.c:32:9`!:
137 {
138 info->namecxx . . $ f0r_param_info#name. = "Transparency threshold";
139 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!;
140 info->explanationcxx . . $ f0r_param_info#explanation. = "What transparency level should be bypassed by the filter. 0 processes all pixels, 1 ignores all transparent pixels";
141 break;
142 }
143 }
144 }
145
146 f0r_instance_tcxx . . $ f0r_instance_t# f0r_constructcxx . . $ f0r_construct(da3f471cd007a696).(unsigned int width, unsigned int height)
147 {
148 pixels0rt_instance_tcxx . . $ pixels0rt_instance_t#* inst = (pixels0rt_instance_tcxx . . $ pixels0rt_instance_t#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(*inst));
149 inst->widthcxx . . $ pixels0rt_instance#width. = width;
150 inst->heightcxx . . $ pixels0rt_instance#height. = height;
151 inst->thresholdcxx . . $ pixels0rt_instance#threshold. = 0.3;
152 inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold. = 1.0;
153 inst->directioncxx . . $ pixels0rt_instance#direction. = S0RT_DIRECTION_VER_TOPcxx . . $ S0RT_DIRECTION_VER_TOP.;
154 inst->reversedcxx . . $ pixels0rt_instance#reversed. = 0;
155
156 inst->grayscale_pxcxx . . $ pixels0rt_instance#grayscale_px. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(width * height * sizeof(uint8_tcxx . . $ uint8_t#));
157
158 return (f0r_instance_tcxx . . $ f0r_instance_t#)inst;
159 }
160
161 void f0r_destructcxx . . $ f0r_destruct(5d22bdacc48458e8).(f0r_instance_tcxx . . $ f0r_instance_t# instance)
162 {
163 pixels0rt_instance_tcxx . . $ pixels0rt_instance_t# *inst = (pixels0rt_instance_tcxx . . $ pixels0rt_instance_t#*)instance;
164
165 freecxx . . $ free(5d22bdacc48458e8).(inst->grayscale_pxcxx . . $ pixels0rt_instance#grayscale_px.);
166
167 freecxx . . $ free(5d22bdacc48458e8).(instance);
168 }
169
170 void f0r_set_param_valuecxx . . $ f0r_set_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance,
171 f0r_param_tcxx . . $ f0r_param_t# param, int param_index)
172 {
173 assertcxx . . $ `<external>/4398592474888995393/assert.h:77:11`!(instance);
174 pixels0rt_instance_tcxx . . $ pixels0rt_instance_t# *inst = (pixels0rt_instance_tcxx . . $ pixels0rt_instance_t#*)instance;
175
176 switch (param_index)
177 {
178 case S0RT_PARAM_THRESHOLDcxx . . $ `src/filter/pixels0rt/pixels0rt.c:29:9`!:
179 {
180 inst->thresholdcxx . . $ pixels0rt_instance#threshold. = *((double*)param);
181 break;
182 }
183
184 case S0RT_PARAM_DIRECTIONcxx . . $ `src/filter/pixels0rt/pixels0rt.c:30:9`!:
185 {
186 inst->directioncxx . . $ pixels0rt_instance#direction. = (pixels0rt_direction_tcxx . . $ pixels0rt_direction_t#)(*((double*)param) * S0RT_DIRECTION_COUNTcxx . . $ S0RT_DIRECTION_COUNT.);
187 break;
188 }
189
190 case S0RT_PARAM_REVERSEDcxx . . $ `src/filter/pixels0rt/pixels0rt.c:31:9`!:
191 {
192 inst->reversedcxx . . $ pixels0rt_instance#reversed. = *((double*)param) >= 0.5;
193 break;
194 }
195
196 case S0RT_PARAM_ALPHA_THRcxx . . $ `src/filter/pixels0rt/pixels0rt.c:32:9`!:
197 {
198 inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold. = *((double*)param);
199 break;
200 }
201 }
202 }
203
204 void f0r_get_param_valuecxx . . $ f0r_get_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance,
205 f0r_param_tcxx . . $ f0r_param_t# param, int param_index)
206 {
207
208 assertcxx . . $ `<external>/4398592474888995393/assert.h:77:11`!(instance);
209 pixels0rt_instance_tcxx . . $ pixels0rt_instance_t# *inst = (pixels0rt_instance_tcxx . . $ pixels0rt_instance_t#*)instance;
210
211 switch (param_index)
212 {
213 case S0RT_PARAM_THRESHOLDcxx . . $ `src/filter/pixels0rt/pixels0rt.c:29:9`!:
214 {
215 *((double*)param) = inst->thresholdcxx . . $ pixels0rt_instance#threshold.;
216 break;
217 }
218
219 case S0RT_PARAM_DIRECTIONcxx . . $ `src/filter/pixels0rt/pixels0rt.c:30:9`!:
220 {
221 *((double*)param) = inst->directioncxx . . $ pixels0rt_instance#direction. / S0RT_DIRECTION_COUNTcxx . . $ S0RT_DIRECTION_COUNT.;
222 break;
223 }
224
225 case S0RT_PARAM_REVERSEDcxx . . $ `src/filter/pixels0rt/pixels0rt.c:31:9`!:
226 {
227 *((double*)param) = inst->reversedcxx . . $ pixels0rt_instance#reversed. ? 1. : 0.;
228 break;
229 }
230
231 case S0RT_PARAM_ALPHA_THRcxx . . $ `src/filter/pixels0rt/pixels0rt.c:32:9`!:
232 {
233 *((double*)param) = inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold.;
234 break;
235 }
236 }
237
238 }
239
240 inline static void s0rt_line_horizontalcxx . . $ s0rt_line_horizontal(f5983526e3737c8a).(
241 const uint32_tcxx . . $ uint32_t# *src,
242 uint32_tcxx . . $ uint32_t# *dst,
243 uint8_tcxx . . $ uint8_t# *gray,
244 unsigned int line,
245 unsigned int start,
246 unsigned int end)
247 {
248 unsigned int length = end - start;
249 unsigned int line_start = line + start;
250
251 uint32_tcxx . . $ uint32_t# histogram[256] = {0};
252
253 for (int i = 0; i < length; i++)
254 histogram[gray[line_start + i]]++;
255
256 for (int i = 1; i < 256; i++)
257 histogram[i] += histogram[i - 1];
258
259 for (int i = length; i-- > 0;)
260 {
261 uint8_tcxx . . $ uint8_t# key = gray[line_start + i];
262 dst[line_start + (--histogram[key])] = src[line_start + i];
263 }
264 }
265
266 inline static void s0rt_line_verticalcxx . . $ s0rt_line_vertical(4356fc802f73c610).(
267 const uint32_tcxx . . $ uint32_t# *src,
268 uint32_tcxx . . $ uint32_t# *dst,
269 uint8_tcxx . . $ uint8_t# *gray,
270 unsigned int width,
271 unsigned int column,
272 unsigned int start,
273 unsigned int end)
274 {
275 unsigned int length = end - start;
276
277 uint32_tcxx . . $ uint32_t# histogram[256] = {0};
278
279 for (int i = 0; i < length; i++)
280 histogram[gray[(start + i) * width + column]]++;
281
282 for (int i = 1; i < 256; i++)
283 histogram[i] += histogram[i - 1];
284
285 for (int i = length; i-- > 0;)
286 {
287 uint8_tcxx . . $ uint8_t# key = gray[(start + i) * width + column];
288 dst[(start + (--histogram[key])) * width + column] = src[(start + i) * width + column];
289 }
290 }
291
292
293 void f0r_updatecxx . . $ f0r_update(96cd7b27f2fca8a7).(f0r_instance_tcxx . . $ f0r_instance_t# instance, double time,
294 const uint32_tcxx . . $ uint32_t#* src, uint32_tcxx . . $ uint32_t#* dst)
295 {
296 assertcxx . . $ `<external>/4398592474888995393/assert.h:77:11`!(instance);
297 pixels0rt_instance_tcxx . . $ pixels0rt_instance_t#* inst = (pixels0rt_instance_tcxx . . $ pixels0rt_instance_t#*)instance;
298
299 unsigned int size = inst->widthcxx . . $ pixels0rt_instance#width. * inst->heightcxx . . $ pixels0rt_instance#height.;
300
301 double px_diff = 0.0;
302 unsigned int line_idx;
303 unsigned int next_pos = 0;
304
305 if (inst->reversedcxx . . $ pixels0rt_instance#reversed.) {
306 for (int i = 0; i < size; i++)
307 inst->grayscale_pxcxx . . $ pixels0rt_instance#grayscale_px.[i] = 255 - pixel_grayscalecxx . . $ pixel_grayscale(32407b39b2dfce37).(src[i]);
308 } else {
309 for (int i = 0; i < size; i++)
310 inst->grayscale_pxcxx . . $ pixels0rt_instance#grayscale_px.[i] = pixel_grayscalecxx . . $ pixel_grayscale(32407b39b2dfce37).(src[i]);
311 }
312
313 switch (inst->directioncxx . . $ pixels0rt_instance#direction.) {
314 case S0RT_DIRECTION_VER_TOPcxx . . $ S0RT_DIRECTION_VER_TOP.:
315 {
316 for (int column = 0; column < inst->widthcxx . . $ pixels0rt_instance#width.; column++) {
317 next_pos = 0;
318
319 for (int i = 0; i < inst->heightcxx . . $ pixels0rt_instance#height.; i++) {
320 if (pixel_alpha_thresholdcxx . . $ pixel_alpha_threshold(894d65fb28e0460).(src[i * inst->widthcxx . . $ pixels0rt_instance#width. + column], inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold.)) {
321 px_diff = pixel_diffcxx . . $ pixel_diff(113c4becdd908a77).(src[next_pos * inst->widthcxx . . $ pixels0rt_instance#width. + column], src[i * inst->widthcxx . . $ pixels0rt_instance#width. + column]);
322
323 if (px_diff > inst->thresholdcxx . . $ pixels0rt_instance#threshold. ||
324 (i < inst->heightcxx . . $ pixels0rt_instance#height. - 2 && !pixel_alpha_thresholdcxx . . $ pixel_alpha_threshold(894d65fb28e0460).(src[(i + 1) * inst->widthcxx . . $ pixels0rt_instance#width. + column], inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold.)) ||
325 i == inst->heightcxx . . $ pixels0rt_instance#height. - 1) {
326 s0rt_line_verticalcxx . . $ s0rt_line_vertical(4356fc802f73c610).(src, dst, inst->grayscale_pxcxx . . $ pixels0rt_instance#grayscale_px., inst->widthcxx . . $ pixels0rt_instance#width., column, next_pos, i);
327 next_pos = i;
328 }
329 } else {
330 dst[i * inst->widthcxx . . $ pixels0rt_instance#width. + column] = src[i * inst->widthcxx . . $ pixels0rt_instance#width. + column];
331 next_pos = i;
332 }
333 }
334 }
335
336 break;
337 }
338
339 case S0RT_DIRECTION_VER_BOTTOMcxx . . $ S0RT_DIRECTION_VER_BOTTOM.:
340 {
341 for (int column = 0; column < inst->widthcxx . . $ pixels0rt_instance#width.; column++) {
342 next_pos = inst->heightcxx . . $ pixels0rt_instance#height. - 1;
343
344 for (int i = inst->heightcxx . . $ pixels0rt_instance#height. - 1; i >= 0; i--) {
345
346 if (pixel_alpha_thresholdcxx . . $ pixel_alpha_threshold(894d65fb28e0460).(src[i * inst->widthcxx . . $ pixels0rt_instance#width. + column], inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold.)) {
347 px_diff = pixel_diffcxx . . $ pixel_diff(113c4becdd908a77).(src[next_pos * inst->widthcxx . . $ pixels0rt_instance#width. + column], src[i * inst->widthcxx . . $ pixels0rt_instance#width. + column]);
348
349 if (px_diff > inst->thresholdcxx . . $ pixels0rt_instance#threshold. ||
350 (i > 0 && !pixel_alpha_thresholdcxx . . $ pixel_alpha_threshold(894d65fb28e0460).(src[(i - 1) * inst->widthcxx . . $ pixels0rt_instance#width. + column], inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold.)) ||
351 i == 0) {
352 s0rt_line_verticalcxx . . $ s0rt_line_vertical(4356fc802f73c610).(src, dst, inst->grayscale_pxcxx . . $ pixels0rt_instance#grayscale_px., inst->widthcxx . . $ pixels0rt_instance#width., column, i, next_pos);
353 next_pos = i;
354 }
355 } else {
356 dst[i * inst->widthcxx . . $ pixels0rt_instance#width. + column] = src[i * inst->widthcxx . . $ pixels0rt_instance#width. + column];
357 next_pos = i;
358 }
359 }
360 }
361
362 break;
363 }
364
365
366 case S0RT_DIRECTION_HOR_LEFTcxx . . $ S0RT_DIRECTION_HOR_LEFT.:
367 {
368 for (int line = 0; line < inst->heightcxx . . $ pixels0rt_instance#height.; line++) {
369 next_pos = 0;
370 line_idx = line * inst->widthcxx . . $ pixels0rt_instance#width.;
371
372 for (int i = 0; i < inst->widthcxx . . $ pixels0rt_instance#width.; i++) {
373 if (pixel_alpha_thresholdcxx . . $ pixel_alpha_threshold(894d65fb28e0460).(src[line_idx + i], inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold.)) {
374 px_diff = pixel_diffcxx . . $ pixel_diff(113c4becdd908a77).(src[line_idx + next_pos], src[line_idx + i]);
375
376 if (px_diff > inst->thresholdcxx . . $ pixels0rt_instance#threshold. ||
377 (i < inst->widthcxx . . $ pixels0rt_instance#width. - 2 && !pixel_alpha_thresholdcxx . . $ pixel_alpha_threshold(894d65fb28e0460).(src[line_idx + i + 1], inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold.)) ||
378 i == inst->widthcxx . . $ pixels0rt_instance#width. - 1) {
379 s0rt_line_horizontalcxx . . $ s0rt_line_horizontal(f5983526e3737c8a).(src, dst, inst->grayscale_pxcxx . . $ pixels0rt_instance#grayscale_px., line_idx, next_pos, i);
380 next_pos = i;
381 }
382 } else {
383 dst[line_idx + i] = src[line_idx + i];
384 next_pos = i;
385 }
386 }
387 }
388
389 break;
390 }
391
392 case S0RT_DIRECTION_HOR_RIGHTcxx . . $ S0RT_DIRECTION_HOR_RIGHT.:
393 {
394 for (int line = 0; line < inst->heightcxx . . $ pixels0rt_instance#height.; line++) {
395 next_pos = inst->widthcxx . . $ pixels0rt_instance#width. - 1;
396 line_idx = line * inst->widthcxx . . $ pixels0rt_instance#width.;
397
398 for (int i = inst->widthcxx . . $ pixels0rt_instance#width. - 1; i >= 0; i--) {
399 if (pixel_alpha_thresholdcxx . . $ pixel_alpha_threshold(894d65fb28e0460).(src[line_idx + i], inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold.)) {
400 px_diff = pixel_diffcxx . . $ pixel_diff(113c4becdd908a77).(src[line_idx + next_pos], src[line_idx + i]);
401
402 if (px_diff > inst->thresholdcxx . . $ pixels0rt_instance#threshold. ||
403 (i > 0 && !pixel_alpha_thresholdcxx . . $ pixel_alpha_threshold(894d65fb28e0460).(src[line_idx + i - 1], inst->alpha_thresholdcxx . . $ pixels0rt_instance#alpha_threshold.)) ||
404 i == 0) {
405 s0rt_line_horizontalcxx . . $ s0rt_line_horizontal(f5983526e3737c8a).(src, dst, inst->grayscale_pxcxx . . $ pixels0rt_instance#grayscale_px., line_idx, i, next_pos);
406 next_pos = i;
407 }
408 } else {
409 dst[line_idx + i] = src[line_idx + i];
410 next_pos = i;
411 }
412 }
413 }
414
415 break;
416 }
417 }
418 }