| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
now I know why overloading dealloc felt wrong
|
|
|
|
|
|
|
| |
Makes it slightly easier to debug image output.
Also, we stop sending dimension headers, and no longer check for the
scheme env var to make CLI invocation a bit less annoying.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since getColor's color assignment eagerly fills in holes with the
nearest neighbor of the first such observed node, it is prone to falling
into a local minimum where dithering ends up switching between a few
very wrong colors.
Ensure this doesn't happen by always allocating at least 4 nodes of the
octree branch. (Allocating all 7 seems to result in a heavy performance
hit; just 4 means at worst 4096 extra nodes, but likely a lot less, and
I don't see a difference in either output or performance.)
|
|
|
|
|
|
|
| |
* don't set transparency when raster attributes suffice - it seems
terminals don't background-fill in that case either.
* fix transparency in encoder standalone mode
* update comments
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This splits out sftp into a separate binary that *does* depend on
libcurl. However, ftp now uses the same socket code as gopher.
ftps is dropped, because I've never even tested it. Maybe I'll add
it back when we have working OpenSSL bindings.
This is still "doing the easy part first", now I have no clue how to
handle sftp because my initial plan ("just use the sftp binary") doesn't
work - sftp batch mode doesn't accept passwords. libssh2 remains the
sole candidate, but that's what libcurl wraps anyway.
|
| |
|
|
|
|
|
| |
This lets us send the transparency bit as a header, and also halves the
number of header parsers in loader.
|
|
|
|
|
|
|
|
| |
I'm thinking of making libcurl entirely optional; let's start with the
easiest part.
I've added a SOCKS5 client for ALL_PROXY support; I know curl supported
others too, but whatever.
|
|
|
|
|
|
| |
* allow string values for public errors
* remove unused errors
* update naming
|
|
|
|
| |
this was causing weird artifacts
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sixel can only represent transparency for fully transparent (alpha
= 0) and fully opaque (alpha = 255) pixels, i.e. we would have to
do blending ourselves to do this "properly". But what do you even
blend? Background color? Images? Clearly you can't do text...
So instead of going down the blending route, we now just approximate
the 8-bit channel with Sixel's 1-bit channel and then patch it up with
dither. It does look a bit weird, but it's not *that* bad, especially
compared to the previous strategy of "blend with some color which
hopefully happens to be the background color" (it rarely was).
Note that this requires us to handle transparent images specially
in term. That is, for opaque ones, we can leave out the "clear cells
affected by image" part, but for transparent ones, we must clear the
entire image every time.
|
|
|
|
|
|
|
|
|
|
|
|
| |
std/selectors uses OS-specific selector APIs, which sounds good in
theory (faster than poll!), but sucks for portability in practice.
Sure, you can fix portability bugs, but who knows how many there are
on untested platforms... poll is standard, so if it works on one
computer it should work on all other ones. (I hope.)
As a bonus, I rewrote the timeout API for poll, which incidentally
fixes setTimeout across forks. Also, SIGWINCH should now work on all
platforms (as we self-pipe instead of signalfd/kqueue magic).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* refactor parseHeader
* optimize response blob()
* add direct "to cache" mode for loader requests which sets stdout to a
file, and use it for image processing
* move image resizing into a separate process
* mmap cache files in between processing steps when possible
At last, resize is no longer a part of image decoding. Also, it feels
much nicer to keep encoded image data in the same cache as everything
else.
The mmap operations *should* be more efficient than copying the whole
RGBA data through a pipe. In practice, it only makes a difference for
loading (well, now just mmapping) the encoded image into the pager,
where it singlehandedly speeds up image display by 10x on my test image.
For the other steps, the unfortunate fact that "tocache" must delay the
next fork/exec in the pipeline until the entire image is processed seems
to equal out any wins we might have gotten from skipping a single raw
RGBA copy.
I have tried moving the delay before the exec (it's possible with yet
another pipe), but it didn't help much and made the code much
uglier. (Not that tocache didn't, but I can live with this...)
|
|
|
|
|
| |
I've moved most image logic to adapter, so it doesn't really make
sense to have this subdir anymore.
|
|
|
|
|
|
|
|
|
| |
Turns out this isn't actually needed. Which makes sense, as transparency
doesn't have a color register at all - it's just the default state of
pixels.
Also, skip octree-based quantization with palette <= 2; unsurprisingly,
monochrome gives much better results.
|
| |
|
|
|
|
|
|
|
|
| |
* Reduce unnecessary branch allocation even more
* Use linked lists to represent sixel bands
Also inlined octree-based getColor for clarity, although the compiler
was already doing that.
|
|
|
|
|
|
|
|
|
|
|
| |
Reduce eager allocation of whole branches for leaves; now it's done
only after the first conflict (or repeated color). This makes
quantization ~2x faster for images without large runs of the same color
and ~2x slower for images with a lot of those. No noticeable loss in
quality.
I also disabled refc for the octree and turned the nodes into tagged
unions, which again resulted in a ~2x speedup.
|
| |
|
|
|
|
|
|
| |
For large palettes, looping over the entire chunk list is quite
slow. Store the list of active chunks in a separate sequence so we can
skip the unused ones.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* round down to number divisible by 6 for height
* make pager's dispw match term's dispw even after width clamping
* make *BE procs actually emit/consume big-endian (lol)
* fix borked sixel set raster attributes & control string
I mixed up SRA with the device control string's parameters, so instead
of toggling transparency in the DCS, I was setting the second SRA
parameter to 0. Which, by the way, defines the aspect ratio's
denominator, and has nothing to do with transparency. Whoops.
|
|
|
|
|
|
|
| |
Until recently, glibc used to implement it as fstatat. So don't trap
for fstatat (and for consistency, fstat), but return EPERM.
Just to be sure, rewrite sixel & stbi to never call fread.
|
|
|
|
|
| |
* fix whitespace-surrounded asterisk turning into emphasis
* slightly refactor parseInline (it's still quite ugly...)
|
|
|
|
|
|
| |
See comment for details.
(Also, set the palette size based on quality for toBlob.)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* stream: and passFd is now client-based, and accessible for buffers
* Bitmap's width & height is now int, not uint64
* no more non-network Bitmap special case in the pager for canvas
I just shoehorned it into the static image model, so it still doesn't
render changes after page load. But at least now it doesn't crash the
browser.
|
|
|
|
| |
whoops
|
|
|
|
|
|
|
|
| |
* expand allowed color range somewhat
* update maximum sixel size on window resize
* fix kitty image cropping
* use faster algorithm for sixel compression (also produces less
wasteful output)
|
|
|
|
| |
+ update todo, readme
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
uses floyd-steinberg - I originally tried atkinson, but liked the
results with fs a bit more.
also, I got rid of the half hearted attempt to skip tree traversals for
color lookups, as it performs horribly with dithering. it *did* work if
I set Y as the key, but it still felt wrong - well, as it turns out,
octree traversal is faster anyway, so just do that.
it works out nicely because we can fill in holes (from dithering) with
a linear search for the nearest match as we go.
|
|
|
|
|
|
|
|
|
|
|
| |
ok, of course if you search for the nearest entry after setting blue
as the lowest index bits the search will be biased towards blue...
let's just skip the trouble of reconstructing closest color relations
by storing hashes in the octree - this way, I can ensure that the final
merged colors are present in the buckets that getColor then looks at
(while we're at it, also fix the color run merging code in quantize.)
|
|
|
|
|
|
| |
* don't emit transparency request when we don't need it
* add lookup table for missing hash entries
* write(2)'ize
|
|
|
|
| |
& clean up outputSixelImage in general
|
|
|
|
|
|
|
|
| |
just use an octree. works fine afaict, though obviously somewhat slower
than the static method (encoding is 2-pass now) & still has banding
issues with many colors (will need dithering)
also, fixed a bug that caused initial masks of bands to get misplaced
|
|
|
|
|
|
|
|
| |
glibc likes to do weird things (such as calling stat) when you use
fread(3) and friends, so try to use functions that are more likely to
just do a single syscall.
Also, copy over some more paranoid read/write procedures to http.
|
|
|
|
|
|
|
|
| |
This caches sixel output. Works best when the line height is a multiple
of 6px, but should still be faster than the previous solution everywhere
else too (simply by virtue of encoding separate images in parallel).
Next step: actual color quantization
|
|
|
|
| |
also, move the ln command to make all
|
|
|
|
| |
like sr.ht does
|
|
|
|
|
|
|
| |
data URIs can get megabytes long; however, you can only stuff so many
bytes into the envp. (This was thwarting my efforts to view pandoc-
generated standalone HTML in Chawan.) So put `data:' back into the
loader process.
|
|
|
|
|
|
|
|
|
| |
* buffer, pager, config: add meta-refresh value, which makes it possible
to follow http-equiv=refresh META tags.
* config: clean up redundant format mode parser
* timeout: accept varargs for params to pass on to functions
* pager: add "options" dict to JS gotoURL
* twtstr: remove redundant startsWithNoCase
|
|
|
|
|
|
| |
SRCtype and DSTtype were mixed up.
See https://todo.sr.ht/~bptato/chawan/14
|
|
|
|
|
|
|
|
|
|
| |
It works fine AFAICT, just missing VP8 deblocking filters, so lossy
WebP images don't look great.
I have extended the API a bit to allow reading from stdin, not just
paths. Otherwise, it's the same as matanui159/jebp.
TODO: add loop filters
|
|
|
|
| |
clang complains about this
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Saves bandwidth; it's especially useful over SSH. Still not sure if this
is the right solution, since it now needs two select cycles instead
of one, and it does yet another copy of the image. (Unnecessarily,
because stbi cannot stream its output, and stbiw cannot stream its
input.)
Also, to save memory, we now discard decoded images of buffers that are
not being viewed.
|
|
|
|
| |
;_;
|