Anonymous

Difference between revisions of "Theory and Practice of Sprixels"

From dankwiki
(One intermediate revision by the same user not shown)
Line 77: Line 77:


==Color quantization==
==Color quantization==
The Kitty protocol accepts arbitrary RGBA 32-bit words in the sRGB color space; our natural internal format is 24bpp RGB plus two bits of alpha, so that's great—our colorspaces match. Sixel is a palette-indexed format. Common sizes are 16-, 256-, and 1024-entry palettes (in XTerm, this is controlled with the <tt>numColorRegisters</tt> X resource). Palettes are independent unless the <tt>privateColorRegisters</tt> resource is enabled). A color quantization step is thus necessary (note that this these quantizations can be performed in perfect parallelism when split across multiple frames/images, but not necessarily within a single frame). There are five essential color quantization algorithms:
The Kitty protocol accepts arbitrary RGBA 32-bit words in the sRGB color space; our natural internal format is 24bpp RGB plus two bits of alpha, so that's great—our colorspaces match. Sixel is a palette-indexed format. Common sizes are 16-, 256-, and 1024-entry palettes (in XTerm, this is controlled with the <tt>numColorRegisters</tt> X resource). Palettes are independent unless the <tt>privateColorRegisters</tt> resource is explicitly set false). A color quantization step is thus necessary (note that this these quantizations can be performed in perfect parallelism when split across multiple frames/images, but not necessarily within a single frame). There are five essential color quantization algorithms:


[[File:Penrosetiling.png|thumb|200px|right|These images throw libsixel for a loop; <tt>img2sixel</tt> chugs along, and then generates no output.]]
[[File:Penrosetiling.png|thumb|200px|right|These images throw libsixel for a loop; <tt>img2sixel</tt> chugs along, and then generates no output.]]
Line 134: Line 134:
* XTerm through 367 doesn't update the pixel counts returned in the <tt>TIOCGWINSZ</tt> <tt>ioctl(2)</tt> when the font changes. I submitted a bug report for this, and it was [https://invisible-island.net/xterm/xterm.log.html#xterm_368 fixed in Patch #368].
* XTerm through 367 doesn't update the pixel counts returned in the <tt>TIOCGWINSZ</tt> <tt>ioctl(2)</tt> when the font changes. I submitted a bug report for this, and it was [https://invisible-island.net/xterm/xterm.log.html#xterm_368 fixed in Patch #368].
* XTerm through at least 366 progressively slows down as Sixels are written in alternate mode, even if they are cleared. I submitted a bug report for this.
* XTerm through at least 366 progressively slows down as Sixels are written in alternate mode, even if they are cleared. I submitted a bug report for this.
* XTerm through at least 368 doesn't clear sixels with <tt>DECERA</tt>, <tt>DECFRA</tt>, etc. I [https://groups.google.com/g/notcurses/c/3ZBjA_v0EvQ submitted a patch for this], which was merged for [https://invisible-island.net/xterm/xterm.log.html#xterm_370 XTerm 370].
* XTerm through 369 doesn't clear sixels with <tt>DECERA</tt>, <tt>DECFRA</tt>, etc. I [https://groups.google.com/g/notcurses/c/3ZBjA_v0EvQ submitted a patch for this], which was merged for [https://invisible-island.net/xterm/xterm.log.html#xterm_370 XTerm 370].
* Mlterm through at least 3.9.0 makes the cursor visible after emitting a Sixel, even if it was hidden before. I [https://github.com/arakiken/mlterm/issues/24 submitted a bug] for this.
* Mlterm through at least 3.9.0 makes the cursor visible after emitting a Sixel, even if it was hidden before. I [https://github.com/arakiken/mlterm/issues/24 submitted a bug] for this.
* MLterm through 3.9.1 inverts the broadly-interpreted sense of DECSDM. I [https://github.com/arakiken/mlterm/pull/23 submitted a PR] for this, which was merged.
* MLterm through 3.9.1 inverts the broadly-interpreted sense of DECSDM. I [https://github.com/arakiken/mlterm/pull/23 submitted a PR] for this, which was merged.