Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Add sixel_decode_raw_rgba, fix decoding of high-color SIXEL's#23

Open
ctrlcctrlv wants to merge 1 commit intomasterfrom
decode_rgba
Open

Add sixel_decode_raw_rgba, fix decoding of high-color SIXEL's#23
ctrlcctrlv wants to merge 1 commit intomasterfrom
decode_rgba

Conversation

@ctrlcctrlv
Copy link
Copy Markdown
Collaborator

@ctrlcctrlv ctrlcctrlv commented Jun 16, 2021

Closes #15.
Closes #16.
Closes saitoha#149.
Closes saitoha#28.
Closes saitoha#61.

This PR fixes both problems at once. It does so by adding a new decode
function, and using it by default in img2sixel.

This function returns to the user RGBA data instead of palette'd data.
This sidesteps the many issues I found when considering raising the
maximum size of a palette to 255*255*255*255. For one thing, I already
knew I needed at some point for Kitty project something like this so I
wouldn't need to allocate my own, which is needless effort when the
decoder can do it.

This is ready for review. @dankamongmen may have time. I'll leave it for
a while as I go back to working on Kitty. If no one has time to review,
I'll merge it in ~4 days or so.

Closes #15.
Closes #16.
Closes saitoha#149.
Closes saitoha#28.
Closes saitoha#61.

This PR fixes both problems at once. It does so by adding a new decode
function, and using it by default in `img2sixel`.

This function returns to the user RGBA data instead of palette'd data.
This sidesteps the many issues I found when considering raising the
maximum size of a palette to 255*255*255*255. For one thing, I already
knew I needed at some point for Kitty project something like this so I
wouldn't need to allocate my own, which is needless effort when the
decoder can do it.

This is ready for review. @dankamongmen may have time. I'll leave it for
a while as I go back to working on Kitty. If no one has time to review,
I'll merge it in ~4 days or so.
@ctrlcctrlv
Copy link
Copy Markdown
Collaborator Author

Let's hold off on reviewing and merging this. I need to support encoding as well, although I was considering #24 a separate issue. On the plus side, decoding does work. Here's some proof (I've intentionally used fuchsia as my background to prove that it works):

image

You can see that the transparent pixels are showing through in this simple Sixel file, where before they'd be black (or sometimes another random color due to weird behavior of bgindex):

[fred@laptop kitty]$ cat ../libsixel/images/map8.six | xxd
00000000: 1b50 7122 313b 313b 3933 3b31 3423 303b  .Pq"1;1;93;14#0;
00000010: 323b 3630 3b30 3b30 2331 3b32 3b30 3b36  2;60;0;0#1;2;0;6
00000020: 363b 3023 323b 323b 3536 3b36 303b 3023  6;0#2;2;56;60;0#
00000030: 333b 323b 3437 3b33 383b 3937 2334 3b32  3;2;47;38;97#4;2
00000040: 3b37 323b 303b 3639 2335 3b32 3b30 3b36  ;72;0;69#5;2;0;6
00000050: 363b 3732 2336 3b32 3b37 323b 3732 3b37  6;72#6;2;72;72;7
00000060: 3223 373b 323b 303b 303b 3023 3021 3131  2#7;2;0;0;0#0!11
00000070: 7e23 3121 3132 7e23 3221 3132 7e23 3321  ~#1!12~#2!12~#3!
00000080: 3132 7e23 3421 3132 7e23 3521 3132 7e23  12~#4!12~#5!12~#
00000090: 3621 3132 7e23 3721 3130 7e2d 2330 2131  6!12~#7!10~-#0!1
000000a0: 317e 2331 2131 327e 2332 2131 327e 2333  1~#1!12~#2!12~#3
000000b0: 2131 327e 2334 2131 3240 2335 2131 3261  !12~#4!12@#5!12a
000000c0: 2336 2131 327e 2337 2131 307e 2d23 3021  #6!12~#7!10~-#0!
000000d0: 3131 4223 3121 3132 4223 3221 3132 4223  11B#1!12B#2!12B#
000000e0: 3321 3132 4223 3421 3132 4223 3521 3132  3!12B#4!12B#5!12
000000f0: 4223 3621 3132 4223 3721 3130 421b 5c0a  B#6!12B#7!10B.\.

@WSLUser
Copy link
Copy Markdown

WSLUser commented Oct 5, 2021

Can you update tests to resolve conflict and get the CI to run again? I'd love to see this merged in.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

2 participants