Skip to content

Commit 72a1dfd

Browse files
committed
Add fires to light-blue areas
1 parent fcca8fc commit 72a1dfd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

secamiz0r.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ static void copy_pair_as_yuv(struct secamiz0r *self, uint8_t *dst_even, uint8_t
337337
* up difference between two pixels, halving the sum every step (it kinda fades
338338
* away). To make this more chaotic, we also add a random value. Then, if at
339339
* some point the sum is larger than a threshold value, we mark this pixel.
340+
*
341+
* (Addition: also take the blue-ish or cyan-ish areas into the account).
340342
*/
341343
static void prefilter_pair(struct secamiz0r *self, uint8_t *even, uint8_t *odd)
342344
{
@@ -347,8 +349,14 @@ static void prefilter_pair(struct secamiz0r *self, uint8_t *even, uint8_t *odd)
347349
int y_odd_oscillation = self->fire_seed ? umod(r_odd, self->fire_seed) : 0;
348350

349351
for (size_t i = 1; i < self->width; i++) {
350-
y_even_oscillation += abs(even[i * 4 + 0] - even[i * 4 - 4] - umod(r_even, 512));
351-
y_odd_oscillation += abs(odd[i * 4 + 0] - odd[i * 4 - 4] - umod(r_odd, 512));
352+
int even_luma_delta = even[i * 4 + 0] - even[i * 4 - 4];
353+
int odd_luma_delta = odd[i * 4 + 0] - odd[i * 4 - 4];
354+
355+
int even_chroma_delta = 0; // *thinking emoji*
356+
int odd_chroma_delta = (odd[i * 4 + 1] - even[i * 4 + 1]) / 2;
357+
358+
y_even_oscillation += abs(even_luma_delta - odd_chroma_delta - umod(r_even, 512));
359+
y_odd_oscillation += abs(odd_luma_delta - even_chroma_delta - umod(r_odd, 512));
352360

353361
if (y_even_oscillation > self->fire_threshold) {
354362
even[i * 4 + 2] = umod(r_even, 80);

0 commit comments

Comments
 (0)