Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #@gui JFIF Effects 2: fx_jfif_2, fx_jfif_2_preview(0)
- #@gui : note = note("<small>Poorly-implemented JPEG encoder. Low block dimensions will destroy the CPU!</small>")
- #@gui : 1. Quality Threshold (%) = float(50,0,100)
- #@gui : 2. Quality Mode = choice(2,"Rectangle 1","Rectangle 2","Diagonal 1","Diagonal 2")
- #@gui : 3. Detail Regain = float(2.5,0,10)
- #@gui : 4. Reverse Transform = bool(0)
- #@gui : 5. Block Width = int(8,1,32)
- #@gui : 6. Block Height = int(8,1,32)
- #@gui : 7. Colour Space = choice(14,"RGB","sRGB","HSV8","HSV","HSL8","HSL","HSI8","HSI","LCH8","LCH","Lab8","Lab","YCbCr","YCbCrGLIC","YCbCrJPEG","YIQ8","YIQ","YUV8","YUV","HCY","XYZ8","XYZ","CMY")
- #@gui : 8. Mirror = choice("None","X","Y","XY")
- #@gui : 9. Rotate = choice("None,"90 clockwise","180","90 anticlockwise")
- #@gui : 10. Mirror Blocks = choice("Off","X","Y","XY")
- #@gui : sep = separator()
- #@gui : note = note("Subsampling")
- #@gui : 11. Channel 0 = choice(0,"None","X","Y","XY")
- #@gui : 12. Channel 1 = choice(3,"None","X","Y","XY")
- #@gui : 13. Channel 2 = choice(3,"None","X","Y","XY")
- #@gui : sep = separator()
- #@gui : note = note("Glitch")
- #@gui : 14. Power = float(0,0,10)
- #@gui : 15. Colour Distortion = float(1,0,2)
- #@gui : 16. Max Glitch Length = int(5,2,10)
- #@gui : 17. Max Value Errors Per Tile = int(5,0,10)
- #@gui : 18. Error Strength = float(3,0,8)
- #@gui : 19. Persistent Value Errors Power = float(0.25,0,1)
- #@gui : 20. Error Bias = float(0.5,0,1)
- #@gui : 21. Tile Shift Power = float(0.25,0,1)
- fx_jfif_2:
- cd={$15^2.5}
- gl=$16
- ve=$17
- es=$18
- ste=$19
- bias={2^(6-($20*12))}
- ts={$21^2}
- q=$1/100
- con=$3
- bw=$5
- bh=$6
- cs=$7
- csswap 0,1,0,$cs
- sub0=$11
- sub1=$12
- sub2=$13
- if {$8==1}
- mirror x
- elif {$8==2}
- mirror y
- elif {$8==3}
- mirror xy
- fi
- if $9
- rotate {$9*90},0
- fi
- repeat $! l[$>]
- gp={(0.25^((10-$14)*log(wh(#0)*$bw*$bh)/(30*64)))*$14/10}
- iw={w}
- ih={h}
- s c
- i[G] {w(#0)},{h(#0)},1,1 f[$G] ">begin(chance = "$gp"; tlmax="$gl"; tt=-1; val=0; sticky="$ste";bw="$bw";bh="$bh";);
- if (!(x%(bh*2)) && !(y%(bh*2)),for (l = 0, l<2, ++l, for (k = 0, k<2, ++k, (u<=chance?((val=1);tt=round(u(1,tlmax))):tt>=0?(val=0;--tt):(u<=sticky?(val=-2):val=-1)); j(k*8,l*8)=val)),0)"
- repeat 3 l[$>,$G]
- cbw=$bw
- cbh=$bh
- if {${sub$>}==1}
- cbw*=2
- elif {${sub$>}==2}
- cbh*=2
- elif {${sub$>}==3}
- cbw*=2
- cbh*=2
- fi
- nw={w(#0)+(-w(#0)%$cbw)}
- nh={h(#0)+(-h(#0)%$cbh)}
- r {$nw},{$nh},1,100%,0,3
- l[^$G] split_tiles {-$cbw},{-$cbh} endl
- if $4 idct[^$G] else dct[^$G] fi
- f[^$G] "begin(q="$q";mode="$2";bw="$bw";bh="$bh";con=("$con"^2)/10);
- mode==0?val=round(i,100^(max(1+(max(x,y))-q*(max(bw,bh)),0))):
- mode==1?val=round(i,100^(max(1+(max(x/bw,y/bh)*max(bw,bh))-q*(max(bw,bh)),0))):
- mode==2?val=round(i,100^(max(1+(x+y)-q*(bw+bh),0))):
- mode==3?val=round(i,100^(max(1+((x/bw+y/bh)*max(bw,bh))-q*(2*max(bw,bh)),0)));
- val=val*(1+((max(x,y))^con)*con);
- round(val,10000*((1-q)^6))
- "
- f[^$G] "((x>"$bw")||y>"$bh")?0:i"
- if $4 dct[^$G] else idct[^$G] fi
- if {$10==1} mirror[^$G] x elif {$10==2} mirror[^$G] y elif {$10==3} mirror[^$G] xy fi
- append_tiles[^$G] {$nw/$cbw},{$nh/$cbh}
- endl done
- rm[$G]
- a c
- r {$iw},{$ih},1,100%,0,3
- endl
- done
- if $9
- rotate {$9*-90},0
- fi
- if {$8==1}
- mirror x
- elif {$8==2}
- mirror y
- elif {$8==3}
- mirror xy
- fi
- csswap $cs,1,0,0
- fx_jfif_2_preview:
- fx_jfif_2 $*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement