Ok, I’d like to know what the hell is going on here because it sure ain’t in the code!
It sometimes output to black, other times it works.
The code in question:
#@cli rep_lavander_binary_map: _size_of_arr_by_power_of_two>0,_mode={ -1=custom | 0=and | 1=or | 2=xor },_bin_a,_bin_b,_shift>0,custom_expression
#@cli : Create a texture that does the following steps:
#@cli : 1) Create an array of integer that matches index with size of 2^n.
#@cli : 2) Create another array which is the count of 'bin_a' in binary representation of the previous array.
#@cli : 3) Count sort the array of integer with the count of binary number array.
#@cli : 4) Delete all other array other than the sorted array.
#@cli : 5) Generate a surface with row and column the same size as the primary array, and use formula which takes values from the sorted value, and then find the count of 'bin_b' in binary representation of the found value.
#@cli : - Built-in Macros -
#@cli : flip(v) - Flips the bitwise values of number
#@cli : and(a,b) - a & b
#@cli : or(a,b) - a | b
#@cli : - End of Built-in Macros -
#@cli : Note : The idea comes from Lavander at discord/generative. Based on a Python code.
#@cli : Default values: '_size_of_arr_by_power_of_two=11','_mode=2','_bin_a=01','_bin_b','_shift=0',
+new_rep_lavander_binary_map:
skip ${1=11},${2=2},${3=01},${4=10},${5=0},${6=}
check "$1>0&&($1==int($1))&&(isint($2)||same('-','$2'))"
a6={size('$6')}
shift,length,mode:=int(abs($5)),1<<$1,v=same('-','$2');n=isint($2)?$2:0;v?0:(n>=0?n%3+1:-((abs(n)-1)%3+1))
size_of_arr={int(log2($length+$shift-1))+1}
str_code=n=init_num()
act_arr_sortclass={$mode>-1}
if !$mode&&!$a6 error custom_formula_required fi
$length,1,1,{1+$act_arr_sortclass},>"begin(
const first_binary_to_search=0b$3;
const second_binary_to_search=0b$4;
const size_of_first_binary_to_search=size('$3');
const size_of_second_binary_to_search=size('$4');
);
count=0;
current_value=x;
current_number_of_binary_digits_per_value=(i?int(log2(current_value)))+1;
bit_mask=(1<<current_number_of_binary_digits_per_value)-1;
c?(
binary_to_search=second_binary_to_search;
size_of_binary_to_search=size_of_second_binary_to_search;
):(
binary_to_search=first_binary_to_search;
size_of_binary_to_search=size_of_first_binary_to_search;
);
while(current_number_of_binary_digits_per_value>=size_of_binary_to_search,
test_section=current_value>>(current_number_of_binary_digits_per_value-size_of_binary_to_search);
test_section==binary_to_search?(
++count;
bit_mask>>=size_of_binary_to_search;
current_number_of_binary_digits_per_value-=size_of_binary_to_search;
):(
bit_mask>>=1;
--current_number_of_binary_digits_per_value;
);
current_value&=bit_mask;
);
count;
"
if $act_arr_sortclass
$length,1,1,1,x rv[-2,-1]
+channels. 0 # Create copy as we will preserve the the generated output as lookup table
if $shift -. {im} fi
# Pixel sort integer by count sort
+histogram. 100%
f[-1] >begin(n=0;);i?(v=n;n+=i;v;);
f[-2] >v=i(#-1,i);++i(#-1,i);v;
{w#-2},1,1,1
eval[-3] i(#-1,i)=i(#-5,x);
rm[-5,-3,-2]
a[-2,-1] c
fi
if !$mode str_code..=ix=max_index-x;iy=max_index-y; fi
binary_set_to_search,size_of_binary:=$act_arr_sortclass?[size('$4'),0b$4]:[size('$3'),0b$3]
$length,$length,1,1,:"begin(
const shift_factor=$shift;
const mode=$mode;
const binary_set_to_search=$binary_set_to_search;
const size_of_binary_set=$size_of_binary;
const reference_channel=1+$act_arr_sortclass;
const lookup_table_pos=$act_arr_sortclass;
flip(v)=xor((1<<(int(log2(v))+1))-1,v);
and(a,b)=a&b;
or(a,b)=a|b;
x()=i(#-1,x,0,0,reference_channel,2);
y()=i(#-1,y,0,0,reference_channel,2);
ix()=i(#-1,max_index-x,0,0,reference_channel,2);
iy()=i(#-1,max_index-y,0,0,reference_channel,2);
mode==3?(
init_num()=xor(i(#-1,x,0,0,reference_channel),i(#-1,y,0,0,reference_channel));
):
mode==2?(
init_num()=i(#-1,x,0,0,reference_channel)|i(#-1,y,0,0,reference_channel);
):
mode==1?(
init_num()=i(#-1,x,0,0,reference_channel)&i(#-1,y,0,0,reference_channel);
):
mode==-1?(
shift_factor?(
init_num()=(x+shift_factor)&(y+shift_factor);
):(
init_num()=x&y;
);
):
mode==-2?(
shift_factor?(
init_num()=(x+shift_factor)|(y+shift_factor);
):(
init_num()=x|y;
);
):
mode==-3?(
shift_factor?(
init_num()=xor(x+shift_factor,y+shift_factor);
):(
init_num()=xor(x,y);
);
):(
init_num()=int("$6");
);
);
count=0;
"$str_code";
count=0;
n=abs(n);
!inrange(n,0,w,1,0)?(
num_of_binary_digits_of_n=(n?int(log2(n)))+1;
bit_mask=(1<<num_of_binary_digits_of_n)-1;
while(num_of_binary_digits_of_n>=size_of_binary_set,
test_section=n>>(num_of_binary_digits_of_n-size_of_binary_set);
test_section==binary_set_to_search?(
++count;
bit_mask>>=size_of_binary_set;
num_of_binary_digits_of_n-=size_of_binary_set;
):(
bit_mask>>=1;
--num_of_binary_digits_of_n;
);
n&=bit_mask;
);
count;
):(i(#-1,n,0,0,lookup_table_pos));"
rm..
if !$act_arr_sortclass&&$shift -. {im} fi
Even worse, the GUI filter is all messed up with this new code. Just remove new_ to find that out!
EDIT:
Seems that it has to do with the image before $length,$length,1,1
part. I will investigate it, but it is a weird issue. Ok, I can trace it down to the $length,1,1,{1+$act_arr_sortclass}
, but I see no reason why this should happen. So, I don’t know why, so there is something really wrong here.