![]() |
#31 | ||
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17
Karma: 2600
Join Date: Mar 2012
Device: Kindle 3
|
Quote:
Spoiler:
Quote:
|
||
![]() |
![]() |
![]() |
#32 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
When using "dd" it is a LOT easier and faster to just copy \x00 from /dev/zero (see the "tangle" demo above, which draws both black and white on a K3 eink display). Pure black and white is MUCH faster with smoother animation. I plan to implement a particle animation system (and a Chipmunk Physics port) when I switch to using C for my kindle native mode GUI creations. P.S. I will check out your code later. Busy now... ![]() EDIT: Checkout the "tangle" script a few posts back. I did it for you, as an example of how you can have fast small filled objects to populate occupied grid elements for your gliders (and other "life" constructs). I did triangles just to get an example out there so you can see just how fast it is, but you should modify the midpoint circle algorithm used in "spoxbrane" instead. This example draws both black and white filled areas, for a Kindle 3. And check out PoP's Kindle 3 backport of "rippleweave" to see another example of double-wide pixels like I am using in "tangle". Good luck! ![]() Last edited by geekmaster; 03-21-2012 at 12:34 AM. Reason: severe typophrenia |
|
![]() |
![]() |
![]() |
#33 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17
Karma: 2600
Join Date: Mar 2012
Device: Kindle 3
|
Quote:
Now I'm nearly convinced that I can't come up with any shell script that updates the full 600x800 in a few seconds. |
|
![]() |
![]() |
![]() |
#34 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
When you do a LOT of fast updates, the eink drivers create some interesting time-domain artifacts on the display, as an emergent property of the mix of update algorithms they use to blend speed and quality in an algorithmic sort of way. To get any kind of speed for animation playing in an active window on the screen, I had to make my window about 360x240 pixels (think old-school DivX movies ![]() I found that the best thing to do is use only black and white pixels, with spatial dithering to create perceived grayscale in images. There are trade-offs all around, and it is necessary to adjust your program to compensate for them. Display updates will be a lot more predictable when I can replace the kernel mode eink drivers with my own code that talks directly to the bare eink controller chips (in a custom u-boot image to begin with, and later in a custom linux kernel). I can now run custom u-boot image files with MfgTool, and custom kernel image files with kexec (see other threads). Again, we are only limited by our imaginations. ![]() P.S. On the K3, eips is MUCH slower than on the K4 and Touch, so you should call it only in the outermost loop (perhaps updating the entire screen, in some cases, instead of individual cell updates). You really need to try different update speeds to see which works best. In one of my programs, I examine a timer variable in my main program loop, and only do display updates about 5 to 12 times per second using ioctl() calls on a K3 (whatever gives the most pleasing effect for the amount of screen changes I am using). I have not gotten ioctl() calls to work right on the K4 or touch yet, but eips is MUCH faster on them, so I even call it with system("eips ''); calls from C programs, and I did not get ioctl() calls working right on the newer kindles yet (no urgency). ![]() Last edited by geekmaster; 03-21-2012 at 09:57 AM. Reason: severe typophrenia |
|
![]() |
![]() |
![]() |
#35 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
![]() ![]() vidtest Don't be too discouraged about speed. You can still do some interesting things. Here is something I did called "vidtest", to test video on a K3 back in October of last year (see attached file). This is just a binary executable that runs on a K3. I need to clean up the C source code before I publish it (being a "test framework", it contains much more obsolete "commented out" code than current active code). UPDATE: It has been cleaned up and published as the "sparkle" demo" in another thread for C demo programs. The K4 and Touch have much faster display update algorithms, so I am looking forward to programming them in C with performance as good as or better than how this video test program runs on the K3. When you run this program on a K3, you can see what I was talking about when I mentioned the "time domain artifacts" from the kernel-mode display driver eink update algorithms. Do you see how fast those pixels are being updated in 4-bit (600 pixel wide) mode? I am looking forward to seeing them updated using Conway's Life algorithm! ![]() EDIT: The choice of programming language is rarely the problem. You just need to "think differently" and find a better algorithm. You should read Jon Bentley's nice little "Programming Pearls" books. They are quick reads and wonderful sources of software inspiration! ![]() ![]() Last edited by geekmaster; 05-10-2012 at 09:28 PM. Reason: severe typophrenia |
![]() |
![]() |
![]() |
#36 | ||
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17
Karma: 2600
Join Date: Mar 2012
Device: Kindle 3
|
Quote:
Quote:
It initializes the array with the thresholded framebuffer content. Last edited by kaminkatze; 03-21-2012 at 07:41 PM. |
||
![]() |
![]() |
![]() |
#37 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
"Normal" shell arrays did not work for me, but substrings work.
You can put thousands of chars into a var like I do with the K3 black pixels (or K4/touch white pixels) in $B in the "tangle" script. Then access them with ${B:$((y*width+x)):1} and just use different chars for your data. Or you can make the width :2 instead :1 and double the width for larger array values. EDIT: I only tested the substring access on a touch, and we leaned later that it is not supported on the K3, so the older "echo and cut" method would be needed on a K3. This is not as bad as it would seem because echo and cut are busybox built-ins, and we are already running the busybox shell, so echo and cut would already be memory-resident. At least that way there is no external RAMdisk access using hexdump and/or dd... Of course, no '\x00' inside the string, but it seems to hold other binary data okay. You can use just characters to represent cell states, and use them in a case...esac after extracting them from the storage string. To replace a character at position 100 in the string with a new value in $N, I would do something like: a=${B:1:99}; c=${B:101}; B=$a$N$e ... and you can get the length of $B with ${#B} I just tested this by storing about 2 million chars in my $B, and extracting selected characters. It worked. So just store your "database" in a string var instead of a file on /tmp. At least I would try that and see if it is faster. ![]() I find it fascinating that you can store megabytes in a string var, as long as it contains no NULL chars (\x00). I am going to try storing a whole framebuffer in a string (with \x00 changed to \x01, which is fine for a K4 or touch, but would reduce blacks to dark gray on on K3). And when using a K3, you do not need to call the eips program (but you do for the K4 and touch). Instead, on the K3 and older, you can update the display the "old fashioned" way: echo 1 > /proc/eink_fb/update_display That would save having to call the external eips program as an external process. EDIT: I was just about to examine your "script", but it starts with "ELF" -- so you decided to do C, eh? I just ran it. Considering that you are updating the entire display, 4 to 5 fullscreen updates is all the faster the eink can do. If you change a smaller window on the display, you can get about 12 frames per second updates, on the eink Pearl display (the older DX eink is a lot slower). You are at the limits of the display technology here. If you want more speed you need to reduce the size of your active pixel grid on the display. The size I used on my "vidtest" demo was about the largest I could use on a K3 without slowing down the eink display refresh rate. What I would do is use a smaller update area, but surround that with a nice ornate "picture frame" that does not change and therefore does not slow down the display... ![]() *** Good job! *** I would like to use your source code if you don't mind... Is it available for download somewhere? ![]() ![]() Last edited by geekmaster; 03-23-2012 at 07:43 AM. |
![]() |
![]() |
![]() |
#38 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
But we *are* getting into areas where after prototyping a proof-of-concept in shell script, better performance may require a compiled language. But then again, the eink display is the limiting factor, so perhaps we can make faster shell scripts... Part of the reason for doing this in /bin/sh is to get people involved who may not be ready for a compiled language, and to prove that we CAN do more than we think even with very primitive tools. |
|
![]() |
![]() |
![]() |
#39 | ||
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17
Karma: 2600
Join Date: Mar 2012
Device: Kindle 3
|
Quote:
Needs some polishing before I can post it. Quote:
Update a smaller area means I have to use the ioctl() calls? I'll include it in the next update. |
||
![]() |
![]() |
![]() |
#40 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#41 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
![]()
I need to fix a touchscreen event handing bug, before my touchpaint 2.0 script (with 600x800 multi-touch support) is ready to publish here.
I want my kindle native-mode GUI tutorial scripts as simple as possible, but my newly developing multi-touch support keeps trying to grow on me. I need multi-touch support so I can use two-finger pinch, stretch, and rotate touchscreen gestures to resize and rotate onscreen objects in "real-time", but I also want to keep it as easy and as simple as possible. Simplicity is not easy, and it requires a lot of extra work. My goal is defined by these famous quotations: "Make things as simple as possible, but not simpler." - Albert Einstein "Perfection is achieved when there is nothing more to remove." - Saint-Exupery "I feel very strongly that deep and simple is far more essential than shallow and complex." - Fred Rogers "Do the easiest thing that could possibly work, and then pound it into the simplest thing that could possibly work." - http://c2.com/cgi/wiki?SimplestOrEasiest (@archive.org) EDIT: If you are wondering why I call my work-in-progress "touchpaint 2.0", here is "touchpaint-1.3": ![]() Last edited by geekmaster; 05-27-2016 at 10:27 AM. Reason: add archive.org link |
![]() |
![]() |
![]() |
#42 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17
Karma: 2600
Join Date: Mar 2012
Device: Kindle 3
|
Quote:
Here is a ev[ia]l array style version. eval "v=\$A${x}x$y". I used 4 values. 0/1 for dead 100/101 for living. 1 and 101 are the dirty states wich are rendered with filled circles. Spoiler:
|
|
![]() |
![]() |
![]() |
#43 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
At least dd and hexdump work on everything... I guess to be cross-platform, we need to find something that works on all of them. But for speed on newer kindles we also need newer things. Maybe we just need different scripts for different kindles... For the K3, I guess it's back to $(echo $a|cut -b...)... Calling commands that are built into busybox is not as time-consuming as one would think, because while running in /bin/sh, busybox is already memory-resident along with all its built-in commands. Other busybox commands may well be faster than advanced shell features partially or completely missing from the stripped-down busybox shell. ![]() Last edited by geekmaster; 03-22-2012 at 10:52 PM. |
|
![]() |
![]() |
![]() |
#44 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
I have more complex event processing logic now that handles every possible condition (including "reserved" events), and I am very certain now that the swapped coordinates when you rotate across a 90-degree boundary is caused by a firmware bug. There is nothing more that I can do in my event processing except ignore the "slot" assignment events (that tell which finger the coordinates belong to) and just assign them to the last known finger position that was the closest to the four possible positions when swapping the new X or Y coordinate between finger positions.
This workaround should work fine as long as the distance between fingers is greater than the distance between sample points on a pair of fast-moving fingers. It would be a problem if the values near each other got swapped, but luckily, it is the OTHER coordinate that gets swapped, so this should be a reliable workaround. All I did by rewriting my event handling logic was to become absolutely convinced that it is a firmware bug, even though I cannot find it in the GPL source code (yet)... P.S. I am even handling the touchscreen "relative coordinate" mode (i.e. "mouse" mode) events now, so when I figure out how to switch the driver to relative mode (it looks like it uses a /proc for that), then we can let the driver do it instead of simulating it at the application level. ![]() Last edited by geekmaster; 03-23-2012 at 05:22 PM. |
![]() |
![]() |
![]() |
#45 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17
Karma: 2600
Join Date: Mar 2012
Device: Kindle 3
|
Quote:
This is how far I got (with the eips calls, thus same update speed) ![]() Run it with gameoflife savegame.png The image is loaded via eips -g. The topmost row and leftmost column indicate the field position. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Scripting with epub-meta | averyml | Calibre | 20 | 11-17-2016 10:13 AM |
Bunny + Scripting + Calibre = here | tBunnyMan | Introduce Yourself | 4 | 02-06-2012 12:16 AM |
Possible scripting engine for Sigil | Valloric | Sigil | 48 | 10-17-2009 09:58 AM |
Any NetNewsWire Scripting Pros out there? | adinb | Sony Reader | 0 | 02-25-2007 01:44 AM |