Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-17-2012, 08:18 PM   #91
jmseight
Zealot
jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'
 
Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
One thing I noticed with website is that is doe snot actually flash - as in painting the entire screen black and then white and then repainting, but simply repaints everything in black and white, and then paiting in the grey.


Regarding what geekmaster said about only dithering the video portion, actually it may work. I noticed that not the entire screen is updated, only a selected area.

It should be possible to have an algorithm that initiall paints everything in gray. But if an area is updated 3 or 5 times consecutively, it starts to be dithered.

Thanks,
James
jmseight is offline   Reply With Quote
Old 04-18-2012, 12:05 AM   #92
jmseight
Zealot
jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'
 
Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
One other observation regarding dithering. I opened up a xls file with the VNC. It seems that what appears black is dithered and what appears white is also dithered. If you can set a lower cutoff, below which it is considered black and shown as black and not dithered, and an uppder cutoff, above which it is considered white and shown as white and not dithered, I think it will greatly improve the algorithm.

I wish I can compile c programs to make changes. Unfortunatley I only have an Win 7 system...
jmseight is offline   Reply With Quote
Old 04-18-2012, 01:37 AM   #93
geekmaster
Всё гениальное просто.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 5,070
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
Quote:
Originally Posted by jmseight View Post
One other observation regarding dithering. I opened up a xls file with the VNC. It seems that what appears black is dithered and what appears white is also dithered. If you can set a lower cutoff, below which it is considered black and shown as black and not dithered, and an uppder cutoff, above which it is considered white and shown as white and not dithered, I think it will greatly improve the algorithm.

I wish I can compile c programs to make changes. Unfortunatley I only have an Win 7 system...
You just change the cutoffs in the dither table, so no active code changes. Or, you could scale and offset the numbers before dithering.
geekmaster is offline   Reply With Quote
Old 04-18-2012, 01:45 AM   #94
geekmaster
Всё гениальное просто.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 5,070
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
Quote:
Originally Posted by geekmaster View Post
You just change the cutoffs in the dither table, so no active code changes. Or, you could scale and offset the numbers before dithering.
Dither errors resulting in no pure black or no pure white are usually scaling error. Dither always gives power of two PLUS ONE, or 65 shades of gray (0-64) for an 8x8 table. It is easy to assume 0-63 incorrectly...

Or it could be integer round-off error. When doing fixed-point math, you need to add half the divisor to the numerator before dividing. In dithering a 6-bit value, that would put the "error in the middle (value 32) instead of at white or black.


Last edited by geekmaster; 04-18-2012 at 01:48 AM.
geekmaster is offline   Reply With Quote
Old 04-18-2012, 03:07 AM   #95
geekmaster
Всё гениальное просто.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 5,070
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
(reserved). (information I HAD here needs updating).

Last edited by geekmaster; 04-18-2012 at 03:10 AM.
geekmaster is offline   Reply With Quote
Old 04-18-2012, 09:15 PM   #96
jmseight
Zealot
jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'
 
Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
Hi,

I am not sure this is dithering error. I am not sure that the original Windows screen is pure black or pure white, and this causes dithering to show dots. With cutoffs, this can make the screen look much better.

Thanks,
James
jmseight is offline   Reply With Quote
Old 04-19-2012, 02:46 AM   #97
jmseight
Zealot
jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'
 
Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
Hi,

I am trying to compile the vnc client on tcc in the kindle itself.

I don't have the lua or rfb libraries.

It is OK to comment out the lua, correct?

Do you know where I can get the rfb, and maybe lua?

Thanks,
James
jmseight is offline   Reply With Quote
Old 04-19-2012, 04:20 AM   #98
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,217
Karma: 2124593
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
Yep, the dithering (in this case: halftoning) is not really fit to the input parameters, I think. Thus a few "frackles" are left on pure-white areas (I think, or were it the pure-black areas?). However, this mode isn't really made for reading text. The resolution is _low_. But it was asked for, so I did it (and I was curious, too).

jmseight: It will be OK to comment out Lua, but you won't have input support then.

However there is no way around libvncclient (it brings the set of rfb* functions). It's (ironically) part of libvncserver. http://libvncserver.sourceforge.net/ It will probably a bit of work to compile it with a TCC toolchain, though. Though I could be wrong. I never tried (yet).
hawhill is offline   Reply With Quote
Old 04-19-2012, 05:59 AM   #99
geekmaster
Всё гениальное просто.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 5,070
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
Quote:
Originally Posted by hawhill View Post
Yep, the dithering (in this case: halftoning) is not really fit to the input parameters, I think. Thus a few "frackles" are left on pure-white areas (I think, or were it the pure-black areas?). However, this mode isn't really made for reading text. The resolution is _low_. But it was asked for, so I did it (and I was curious, too).

jmseight: It will be OK to comment out Lua, but you won't have input support then.

However there is no way around libvncclient (it brings the set of rfb* functions). It's (ironically) part of libvncserver. http://libvncserver.sourceforge.net/ It will probably a bit of work to compile it with a TCC toolchain, though. Though I could be wrong. I never tried (yet).
I have a replacement dither table. When I was developing it, for some reason (I cannot remember why) I added 1 to all the values. The new one removes that and it is correct now.
Spoiler:
PHP Code:
/========================================
// setpx - draw pixel using ordered dither
// x,y: screen coordinates, c: color(0-64).
// (This works on all eink kindle models.)
//----------------------------------------
inline void setpx(int x,int y,int c) {
    static 
int dt[64] = { 0,32,8,40,2,34,10,42,48,16,56,24,50,18,58,26,12,44,4,
    
36,14,46,6,38,60,28,52,20,62,30,54,22,3,35,11,45,1,33,9,41,51,19,59,27,49,
    
17,57,25,15,47,7,39,13,45,5,37,63,31,55,23,61,29,53,21 }; // dither table
    
fb0[pb*x/8+fs*y]=((128&(c-dt[(7&x)+8*(7&y)]))/128*(blk&(240*(1&~x)|
        
15*(1&x)|fb0[pb*x/8+fs*y])))|((128&(dt[(7&x)+8*(7&y)]-c))/128*wht|
        (
blk&((240*(1&x)|15*(1&~x))&fb0[pb*x/8+fs*y]))); // geekmaster formula 42

The rest of the program is here (palpump): http://www.mobileread.com/forums/sho....php?p=2048756

You need to remember when scaling that the range for an 8x8 table is 65, not 64 values. If you have 6-bit values, you will either lose pure black, or you will lose pure white.

You *could* subtract one from all the numbers above 32, sacrificing the 50-percent checkerboard (the best gray). You need to throw away ONE of the shades of gray somewhere in the palette to get 0-63...

I still cannot remember why I thought I needed to add one to all my palette values.


Last edited by geekmaster; 04-19-2012 at 06:27 AM.
geekmaster is offline   Reply With Quote
Old 04-19-2012, 03:16 PM   #100
jmseight
Zealot
jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'
 
Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
Hi,

I was thinking of something like this in the rfb16ToHalftonedFramebuffer4() function.

From:
Code:
			if(c < *mp++) {
				dval |= 0x0F;
			}
To:
Code:
			if(c <= BLK || (c <= WHT && c < *mp++)) {
				dval |= 0x0F;
			}
where BLK and WHT can be read from the command line.

Maybe BLK = 4 and WHT = 11 or something else.

This would allow easy testing instead of changing the dithering table.

I am not sure how to do this in geekmaster's formula...

Thanks,
James

Last edited by jmseight; 04-19-2012 at 03:18 PM.
jmseight is offline   Reply With Quote
Old 04-19-2012, 03:48 PM   #101
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,217
Karma: 2124593
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
Ah, yes, additional cut-offs. That would indeed be interesting. I'll try it :-) Might take a day, though...
hawhill is offline   Reply With Quote
Old 04-19-2012, 05:01 PM   #102
geekmaster
Всё гениальное просто.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 5,070
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
Quote:
Originally Posted by jmseight View Post
Hi,

I was thinking of something like this in the rfb16ToHalftonedFramebuffer4() function.

From:
Code:
			if(c < *mp++) {
				dval |= 0x0F;
			}
To:
Code:
			if(c <= BLK || (c <= WHT && c < *mp++)) {
				dval |= 0x0F;
			}
where BLK and WHT can be read from the command line.

Maybe BLK = 4 and WHT = 11 or something else.

This would allow easy testing instead of changing the dithering table.

I am not sure how to do this in geekmaster's formula...

Thanks,
James
You just replace some of the high and low threshold values in the dither table. For example, change numbers below 16 to 0, and change numbers above 48 to 64. No need for any CODE changes. You could also expand the range of the remaining values, and even adjust the gamma, by replacing numbers in that table. No code changes.

I will make a new 8x8 dither version that uses values in the 0-255 range, adjusting the values in the dither table accordingly. That way we can display 8-bit PNG files without needing to rescale the pixel values to 0-64. In fact, I already tested this without changing the dither table by adding a little extra code (for testing).

You can adjust brightness, contrast, gamma, invert (negative), and clamping (forcing values NEAR black or white to pure black or white), all by replacing numbers in the dither table. I am thinking of having multiple pre-computed dither tables, and you select which table you want when you call the setpx() function.

I need a function that COMPUTES a dither table during one-time initialization, or any time you adjust display settings (brightness, contrast, gamma, etc.).

It is nice when ALL the adjustments can be done by precomputing the dither table.


Last edited by geekmaster; 04-19-2012 at 05:12 PM.
geekmaster is offline   Reply With Quote
Old 04-19-2012, 08:41 PM   #103
jmseight
Zealot
jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'
 
Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
Yep, I tried to replace the value in the table with your palpump demo.

I think the ability to generate dither table based on set of parameter will be very interesting.

Thanks,
James
jmseight is offline   Reply With Quote
Old 04-20-2012, 12:20 AM   #104
geekmaster
Всё гениальное просто.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 5,070
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
Quote:
Originally Posted by jmseight View Post
Yep, I tried to replace the value in the table with your palpump demo.

I think the ability to generate dither table based on set of parameter will be very interesting.

Thanks,
James
Hmm... I just tried changing the values in the dither table for palpump as suggested above, and it did not behave as expected. But I have a "gut feeling" that this will work as suggested, so I just need to burn some more brain cells to figure it all out.

I suppose I should publish a "Theory of Operation" for "Geekmaster Formula 42" at some point too. It took a few sleepless nights laying awake thinking about it, in order to figure it out in the first place.


Last edited by geekmaster; 04-20-2012 at 12:41 AM.
geekmaster is offline   Reply With Quote
Old 04-20-2012, 12:41 AM   #105
geekmaster
Всё гениальное просто.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 5,070
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
AHA! EUREKA! (whatever) -- Clipping boundary values to limits DOES work, except you replace all values below 16 with 16 (not 0), and you replace all values above 48 with 48 (not 64). It all makes sense now. Any, I want to add sliders to my dithermatron (controlled by touch or 5-way pad) to adjust brightness, contrast, gamma, and high and low clipping pedestals in real-time, while it is running the animation.

Here is my 16-48 clipped dither table:
PHP Code:
    static int dt[64] = { 16,32,16,40,16,34,16,42,48,16,48,24,48,18,48,26,16,44,16,
    
36,16,46,16,38,48,28,48,20,48,30,48,22,16,35,16,45,16,33,16,41,48,19,48,27,48,
    
17,48,25,16,47,16,39,16,45,16,37,48,31,48,23,48,29,48,21 }; // dither table 
If you try this dither table in palpump, you will see that it works correctly now that the first 17 values are black, and the last 15 values are white. We could adjust those cutoff points at even row boundaries if we wanted to. Something similar to this should fit your needs as described in previous posts.

EDIT: Clipping the entire first row to all black really shows how BAD the ghosting is after individual black pixels are changed to white and then back to black again. The result is that pure black pixels only look dark gray. White on black background does not work acceptably for animation, IMHO. So we need to avoid black backgrounds when possible.

Because the electric field that controls pixels affects neighboring pixels, you really need to change large areas to solid white or solid black to do a proper "reset" on the pixels to restore their full contrast range. A full flash erase assures that there are no edge pixels that get partial electric field crossover at high contrast boundaries on the display.



Last edited by geekmaster; 04-20-2012 at 12:54 AM.
geekmaster is offline   Reply With Quote
Reply

Tags
application, kindle, source, viewer, vnc

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free (GPLv2) Translation Dictionaries Elleo Amazon Kindle 3 01-11-2011 11:57 PM
Calibre native app on iphone for reading news? bigreat Calibre 2 07-22-2010 12:50 AM
Android Android App: VNC leo315 enTourage Archive 4 05-13-2010 07:06 PM
Android VNC viewer (use your PC from the eDGe!) devseev enTourage Archive 2 04-11-2010 02:21 AM
PalmPDF - native PDF Viewer for Palm OS 5.x Colin Dunstan Reading and Management 2 11-23-2005 03:09 PM


All times are GMT -4. The time now is 07:00 AM.


MobileRead.com is a privately owned, operated and funded community.