(sixel) Better compression

This commit is contained in:
neauoire 2023-10-29 11:50:06 -07:00
parent f98285b05a
commit 0ca5b39456
4 changed files with 22 additions and 16 deletions

View File

@ -26,7 +26,9 @@ fi
# convert an image to sixels # convert an image to sixels
$ASM icnsix.tal icnsix.rom $ASM icnsix.tal icnsix.rom
uxncli icnsix.rom dafu10x10.icn > dafu.sixels # uxncli icnsix.rom dafu10x10.icn > dafu.sixels
uxncli icnsix.rom test02x02.icn > dafu.sixels
$EMU $DST $ARG $EMU $DST $ARG

View File

@ -1 +1 @@
!41??___ooowww{w!10?{w{wwwooo__!56{?-!31??_oow{{}}~^^nnnvvvzz~x~D!8?|~|z|!5?zvvvvmmm[[[{w{wwoooo__!36{?-!23??__wo{{^^nfvzz||}}!13?~?v!27o~}~}}~}|~|~~}}w!32n?-!16??_ow[}]^nvzx|}}!23^~y?!40~~D!32~?-!10??Cw{{{|!5?}!33~~Ov~~~^~~^~~^~~^!24~~V!34~?-!11??N!21~~^^N~nvvvzzz|z||}|}}}N]BEM~~}~~~}~~}~~!6?}~{|||~z~z!6?~N@!35^?-!13??BN!9?~^nnvz~x}|}!20~~{}]|^~^^^^~^~^^~^~^~^^~~^!12?~g!36~?-!16??@BN~zz{}!7?~^^^nnvnvvzzzxz|||tc`o_OOWOwoyyz~vzv~z~~z~r~~u~}}}~{~||~~b^vNy!36n?-!20??~~~N~vzz|}|}!16?~n~J!6??JLZ~f!22~~nVH|~~~Z!36~?-!19??NuwVw|!5?~^~~^~~~^~^~n~n~n^nin_gOGGGCG{gz~~z^Z\^l^^^nNnVNVFLJX]PQ@AA]~RG?GGO!32~?-!19??A?HPbF^~zjRRfRfbvJFRfjbjbjbj`J@joRop@X@WDCGEGE@NEB_poWwwwwWwowOOG????hG???TA!33R?-!20??@?b_HEd^s???@?B{@?kBCAAe?Ae@Ug@?DY??K!8??OQeBDGDADDABAA@@!6??_]?`CY!35B?-!24??AHO?tg????_ZgWaLGW_[G[cWLe?_{RKOg_W_QOO_O__?_?_?_???_!10??Y@KA!37g?-!28??GRiokQDA@??@@?@?@??@!13??@?@A?A@AA?B?B@AC@CB?@AD@Dr!41@?-!28??_WRRag!23??_?_????_O_!17??o}{ok_gOOO__?_!30W?-!18??c?Ooo[gkq|}]z_M~~}w_!17??_?opwpxqxwwwoo_!9??_?o{NpF!6?~}}}{{|xxpq`AAccCCCGGGOGOO_O___?_?O??-!6??__OGOK_uwz{~[NFrw}!5?~@}~{R!5?~}{woc!11O?VZzqufimeIRix^B!6??@_o{}Fw~~S!14u~NFpw}~~~~]Ebqx{{{{}{{{|{|xyq-GCaappo_O}!7o~d?}!8_~n?!5p~|n!8_~}}wwop_!5p?@@BBAEArBp_O????oo{}~Nvw!16~~^Fp{!5p~Nbw{!14~~^NFB-}!7~~wF!7~~S?n!8~~vG!8~~}~z~n~N!9w~}}{{{wwww~?z_BMw{]~!6~^N^N^!11~~^Foy!5~~^Bw!14~~^FB@?_ow-!9~~}`N!6~~?i!8~~}@!16~~}||ZZFNFFBB@@@?`?p@}BEgD[ww{w{{{{~}!12N~Bx}!6~~V@}!11`~^FB?_o{}~~~~-fN^!8~~{B!5~~QS!9~~Wb~~^NNFNFBFBB@@@!14~?A@LGWC^o?DYf!5~N^N^N!5~^!7~~}!8~~Cx!8~~^FB?_o{}!8~~-@???!8@@?!6@@?!10@@!34??@??@???@!13??!17@@?!9@@???!12@@?- !4~!4F!8_-!16?-!16?-

View File

@ -25,6 +25,7 @@
#00 ;img/width LDA #00 ;img/height LDA #30 SFT2 MUL2 .File/length DEO2 #00 ;img/width LDA #00 ;img/height LDA #30 SFT2 MUL2 .File/length DEO2
;img/data .File/read DEO2 ;img/data .File/read DEO2
<convert> <convert>
#010e DEO
#800f DEO #800f DEO
BRK BRK
@ -40,30 +41,33 @@
@| core ) @| core )
@<convert> ( -- ) @<convert> ( -- )
#0000 #0000 get-sixel #19 DEO
#0a19 DEO
#00 ;img/height LDA #30 SFT2 #0000 #00 ;img/height LDA #30 SFT2 #0000
&v ( -- ) &v ( -- )
STH2k #00 ;img/width LDA #30 SFT2 #0000 STH2k #00 ;img/width LDA #30 SFT2 #0000
&w ( -- ) &w ( -- )
( rle ) ( | rle )
DUP2 STH2kr get-rle DUP2 #0004 LTH2 ?{ DUP2 STH2kr get-rle DUP2 #0003 LTH2 ?{
[ LIT2 "! 18 ] DEO ( rune ) [ LIT2 "! 18 ] DEO
DUP2 INC2 pdec ( dec ) DUP2 pdec
DUP2 STH2kr get-sixel #18 DEO ( sixel ) OVR2 STH2kr get-sixel #18 DEO
ADD2 !& ADD2 !& }
} POP2 POP2 DUP2 STH2kr get-sixel #18 DEO
DUP2 STH2kr get-sixel #18 DEO
INC2 & GTH2k ?&w INC2 & GTH2k ?&w
POP2 POP2 POP2r [ LIT2 "- 18 ] DEO POP2 POP2 POP2r [ LIT2 "- 18 ] DEO
#0006 ADD2 GTH2k ?&v #0006 ADD2 GTH2k ?&v
POP2 POP2 JMP2r POP2 POP2 JMP2r
@get-sixel ( x* y* -- byte ) @get-sixel ( x* y* -- byte )
( x* y* -- byte ) ( acc ) [ LITr 00 ] ,&y STR2
SWP2 ,&x STR2 ,&x STR2
[ LITr 00 ] DUP2 #0006 ADD2 #0006 #0000
&l ( -- ) &l ( -- )
[ LITr 10 ] SFTr [ LIT2 &x $2 ] OVR2 get-pixel STH ORAr #0001 SUB2 LTH2k ?&l ( acc ) [ LITr 10 ] SFTr
( get ) [ LIT2 &x $2 ] OVR2 #0005 SWP2 SUB2 [ LIT2 &y $2 ] ADD2
( res ) get-pixel STH ORAr
( ) INC2 GTH2k ?&l
POP2 POP2 STHr [ LIT "? ] ADD JMP2r POP2 POP2 STHr [ LIT "? ] ADD JMP2r
@get-row ( x* y* -- row* ) @get-row ( x* y* -- row* )
@ -80,7 +84,7 @@
( flag ) #07 STHr SUB SFT #01 AND JMP2r ( flag ) #07 STHr SUB SFT #01 AND JMP2r
@get-rle ( x* y* -- count* ) @get-rle ( x* y* -- count* )
( acc ) [ LIT2r 0000 ] ( acc ) [ LIT2r 0001 ]
( target ) OVR2 OVR2 get-sixel ,&t STR ( target ) OVR2 OVR2 get-sixel ,&t STR
,&y STR2 ,&y STR2
INC2 #00 ;img/width LDA #30 SFT2 SWP2 INC2 #00 ;img/width LDA #30 SFT2 SWP2

BIN
gui/sixels/test02x02.icn Normal file

Binary file not shown.