-
-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
better integrate pixel graphics with render/raster pipeline #1380
Comments
we know we can print over a sixel graphic, but how we do that in the current rendering system is not at all obvious, since the whole thing is based around bringing down a single egc. hrmmm. that's gonna be...tough. erp. for instance, right now you must supply how the hell do you erase one of these things? |
i think a good acceptance criteria for this bug would be, say, |
for quantizing, unless we can find code to do it in oiio/ffmpeg, we could just try building a table, and if we overflow, make a nonlinear or even linear one, and restart the scan with closest match. that succccccccccccccks, but it would work for now. |
resolved the extreme vertical space issue by restricting |
I've implemented a simple, stupid quantization algorithm that at least lets us load things. We can now properly display everything I throw at it, including video =] =] =]. |
(make no mistake--we still want a better quantizer than this baby solution) |
sixel.mp4slow as shit, and the quantizer sucks, but we're way past where we were last night =] |
scaling now works in rendered mode |
scaling now works in direct mode |
I think we're at a point where it's worth committing to some optimization. If we speed up what we have, it's pretty much ready for release.
I bet these three steps will substantially speed things up. A further Tip: try to loosen on the actual squarespace result rather than the rgb source, for a more even distribution. |
I've thus far been able to get a ~70% reduction by overlapping color and data table extraction, not bad at all. It's currently got a bug, and I'm going to go to sleep rather than try to force this tonight. Tomorrow i expect to pick this up, figure out what's going on along the top here, and reap the big perf get. i'd like to get down to about 5% max of the original running time. this is a good start. |
w00t w00t. before: after: that's about a 75% cut by uniting the first two passes |
moved to binary search in before: after: that's about a 40% further decrease, or about 85% down from the original =]. |
with this second iteration of optimization, |
I'd like to add that the Windows console and Windows Terminal (which uses the open source version of the console as the backend for VT) support both the C1 and C0 controls. However discussions there from experts suggests that 7 bits is actually the norm. The comments in this WIndows Terminal PR (and the relevant references including the issues associated and the xterm docs) should help understand more about the support for C0 and C1 controls: microsoft/terminal#7340 (Note, you could probably still support 8 bits if you wanted and do something similar as was done in that PR to default to 7 bits first and then use 8 bits if the 7 bit support isn't there for some reason ex. you're using some legacy DEC terminal, emulated or otherwise, but still want to run notcurses with sixel support on it) |
Sorry, was mixing up private mode 80 and 8452... 80 is for scrolling. You might want to take a look at private mode 8452 too; when enabled, the cursor is left to the right, on the same line as the sixel, instead of on the next line. This is assuming mode 80 is enabled (the default, by the way).
Ah, ok. I assume the black area isn't intended? XTerm looked better, but still not "clean". Should I spend some time looking at the escapes your emitting and see if there's something that needs to be changed? |
optimization notes:
our sixel rendering remains pretty much flat-out unacceptable for rendering even double-digit FPS, which i consider personally embarrassing. here's our current
|
which i haven't even grokked the semantics of yet. i'm taking notes as i build this up at https://nick-black.com/dankwiki/index.php?title=Sixel, since there seems to be no authoritative study anywhere else.
i think this is irrelevant to us, since we do a hard cursor positioning operation after any sprixel emission. though, we will most often admittedly want to be immediately to the (top) right of the sixel (not sure if you mean bottom or top right), so that could potentially save us a but yes, this seems a saner mode of operation. if it can save me some
i'm not sure precisely what you mean here -- i probably need reread your earlier comment. my head is full of optimization thoughts at the moment (also dayjob thoughts, not to mention standard dankhaze), and i was not yet going to open up that can of worms =]. with that said, you clearly know what you're doing, and i fully encourage you to study my code and output, and suggest or even implement fixes, and appreciate all help and wisdom you might provide =]. |
It's not so much about saving some cursor escapes, but more to avoid unwanted terminal content scrolling when the sixel is at the bottom of the screen. With Without 8452, it's as if you hit enter after printing the sixel - the cursor ends up in column 0 on the next line, potentially scrolling all output. Btw, nice performance work! Keeping my fingers crossed and hoping for something that outperforms libsixel... :) |
Turns out the black area is caused by When the prompt is at the bottom of the screen, emitting the sixel requires scrolling the terminal. Scrolled in lines are erased with the current background color (assuming the terminal has the XTerm is doing this as well, but for some reason, the color it's using when scrolling a sixel is different. I haven't figured out why yet. This isn't really specific to the sixel/pixel blitter. But the effect is probably hidden by the fact that other blitters then change, and most importantly, reset, the background color while blitting. |
recording.mp4I tried playing a video file (with ncplayer). Mostly just for kicks. It's pretty slow (see attached screen recording). One thing I noticed was that foot uses much more CPU when decoding the ncplayer output, compared to mpv's A high level comparison of the encoded sixel data shows that both mpv and ncplayer configures roughly the same number of color registers for each frame, but ncplayer emits longer sixel sequences. Looking at the DCS strings sent to the terminal, ncplayer's output isn't that much longer that mpv's. But, after RLE expansion (i.e. the |
fascinating! ok let me run some |
lol,
|
i was able to get it working on my Arch laptop. jeezum crow, yeah, this whips our ass. alright, i've broken out #1391 to address this. at one time, |
I'm closing this issue up; I've expanded it into several other issues to address particular problems. |
With the completion of #1378, our Sixel encoder seems to be working properly. It's now time to better integrate pixel graphics with the render and raster pipelines, so it's useful in Notcurses as something other than a novelty.
cup
after emitting pixel graphics -- i think we're already doing this for rendered modewidth
field correctly (we currently always set it to 1)...though i'm not sure how useful this is,with regards to scaling, currently if i run
./ncplayer -b pixel ../data/worldmap.png -k -q
in a 78x80
xterm
, i get no output. if i run instead./ncplayer -b pixel ../data/worldmap.png -k -q -s none
i get about two empty pages, with the image in the middle, with part of the right chopped off.
stretch
,none
, et. al. ought work forpixel
like they do anything else, and this excess vertical space has got to go. i think the latter comes from creation of a n/6-row plane for n pixels going into the sixel.The text was updated successfully, but these errors were encountered: