| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
;_;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* resize images with stb_image_resize
* use tee for output handle redirection (redirectToFile blocks)
* cache original image files
* accept lseek in sandbox
* misc stbi fixes
For now, I just pulled in stb_image_resize v1. v2 is an extra 150K in
size, not sure if it's worth the cost. (Either way, we can always switch
later if needed, since the API is almost the same.)
Next step: move sixel/kitty encoders to CGI, and cache their output in
memory instead of the intermediate RGBA representation.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Now we have decoders for gif, jpeg, bmp. Also, the in-house PNG decoder
has been replaced in favor of the stbi implementation; this means we
no longer depend on zlib, since stbi comes with a built in inflate
implementation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* multi-processed and sandboxed PNG decoding & encoding (through local
CGI)
* improved request body passing (including support for output id as
response body)
* simplified & faster blob()/text() - now every request starts
suspended, and OngoingData.buf has been replaced with loader's
buffering capability
* image caching: we no longer pull bitmaps from the container after
every single getLines call
Next steps: replace our bespoke PNG decoder with something more usable,
add other decoders, and make them stream.
|
|
|
|
| |
Operation "modularize Chawan somewhat" part 3
|
|
|
|
|
|
|
| |
It's easier to just use nested seqs here.
(This also fixes reverse-search highlighting the last capture group
instead of the whole match.)
|
| |
|
|
|
|
| |
We have a markdown converter, so why not use it?
|
| |
|
| |
|
|
|
|
|
| |
* update naming
* do not send status code (it was always 200 anyway)
|
|
|
|
|
|
|
| |
* prefix to-be-separated modules with js
* remove dynstreams dependency
* untangle from EmptyPromise
* move typeptr into tojs
|
|
|
|
|
|
|
| |
Equivalent to curl --insecure.
Note: unfortunately this does not help if the server is using unsafe
legacy renegotiation, you have to allow that in the OpenSSL config.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
std's version is known to be broken on versions we still support, and it
makes no sense to use different decoders anyway.
(This does introduce a bit of a dependency hell, because js/base64
depends on js/javascript which tries to bring in the entire QuickJS
runtime. So we move that out into twtstr, and manually convert a
Result[string, string] to DOMException in js/base64.)
|
|
|
|
|
|
|
|
|
| |
glibc apparently calls fstat from fread, and we didn't allow it in
seccomp. So:
* allow fstat in the sandbox; no reason not to, and it seems too big of
a footgun to assume we never call fread
* use read(2) in http; no need for buffered i/o here
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
pledge is a bit more fine-grained than Capsicum's capability mode,
so the buffer & http ("network") sandboxes are now split up into
two parts.
I applied the same hack as in FreeBSD for overriding the buffer
selector kqueue, because a) I didn't want to request sysctl promise
b) I'm not sure if it would even work and c) if it breaks on OpenBSD,
then it's broken on FreeBSD too, so there's a greater chance of
discovering the bug.
|
| |
|