Author Topic: mViewer - Nspire BMP viewer  (Read 34069 times)

0 Members and 1 Guest are viewing this topic.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: mViewer - Nspire BMP viewer
« Reply #60 on: December 14, 2010, 08:49:51 pm »
What?!?  Does that same link on TI-Bank work for the latest version?

It's just worked for the 1st time a hour ago.
This special version is not pubic for now.
It needs some more testing/debugging.
The internal buffered data was changed from a 4-bits to 16-bits.


But when I release it, the same link is going to work. And you'going to be informed first! :p

And it should even be faster. the screen refresh code is now only copying the screen content 1 time instead of 2, although it still uses buffering.


Guess what... the Nspire is wonderfull!!!
(why did we have to wait 4 years for that?... silly TI!!!)
Let me guess... storing two images at once in the same buffer in the Red and Blue fields, then flipping the RGB/BGR bit in the control register to make more grayscale levels? I could be completely wrong, though. :P
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline critor

  • Editor
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2079
  • Rating: +439/-13
    • View Profile
    • TI-Planet
Re: mViewer - Nspire BMP viewer
« Reply #61 on: December 14, 2010, 09:18:35 pm »
Yes, you're right.
TI-Planet co-admin.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: mViewer - Nspire BMP viewer
« Reply #62 on: December 14, 2010, 09:23:14 pm »
If you want to halve the memory requirements, you could set up the 8-bit palette. You could have the upper and lower nibbles determine the R and B values, or you could even have a value from 0 to 31 look up the correct 16-bit color value automatically
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: mViewer - Nspire BMP viewer
« Reply #63 on: December 14, 2010, 09:52:42 pm »
Forget about mViewer and its 16 grayscale levels (4-bits).

The last build of mViewer is now able to display your bitmaps in not less than 31 different grayscale levels! (8-bits)

And guess what? While viewing the image, it as fast as the last public binary.


It was quite hard to take a photo.



Note: it looks much better without an APN.
Isn't that 5bit grayscale? (2^5=32)
I experimented with that a while ago. Are you using the checker pattern, like what is used for 3 lvl grayscale on the 83/84?

And to make sure I have this straight, the LCD driver is physically incapable of displaying any more that 16 shades of gray, right?
« Last Edit: December 14, 2010, 09:54:45 pm by fb39ca4 »

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: mViewer - Nspire BMP viewer
« Reply #64 on: December 14, 2010, 10:06:09 pm »
critor, while sending new images to my calc today to use with this, I came across one that didn't work. :(

This was made in Paint.NET.


Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: mViewer - Nspire BMP viewer
« Reply #65 on: December 14, 2010, 10:11:00 pm »
Just saw this, and once again, epic job, critor O.O

Gonna download this as soon as I have the time.
« Last Edit: December 14, 2010, 10:11:09 pm by Deep Thought »




Offline critor

  • Editor
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2079
  • Rating: +439/-13
    • View Profile
    • TI-Planet
Re: mViewer - Nspire BMP viewer
« Reply #66 on: December 14, 2010, 11:51:04 pm »
critor, while sending new images to my calc today to use with this, I came across one that didn't work. :(

This was made in Paint.NET.


It works on my calculator.

May be you didn't get the latest binary on TI-Bank.


Anyway, here's my latest build for those who want to test for me.


By default, the image is displayed with 16 grayscale levels.

The 'C' key (like Color or Critor) lets you hot-switch between the 16 and 31 grayscale modes while viewing an image.

The 31 grayscale mode is usefull for images with similar adjacent colors:
This one: http://www.omnimaga.org/index.php?action=dlattach;topic=5712.0;attach=5043;image
Or this one: http://www.omnimaga.org/index.php?action=dlattach;topic=5712.0;attach=4971 (just zoom in on the thumb, and press 'C')


While in  31 grayscale mode, the 'menu' and 'home' keys let you increase/decrease the RGB/BGR invertion delay. (delay is briefly shown on top of the screen)

The quality of the display in 31 grayscale mode seems to be very dependant on that delay.
Please tell me which delay gives you the best display. It might depend upon the image too...

I fear you will all give me different delays... :p

(if there wasn't that problem, I would probably have set the 31 grayscale mode as a default)
« Last Edit: December 14, 2010, 11:54:14 pm by critor »
TI-Planet co-admin.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: mViewer - Nspire BMP viewer
« Reply #67 on: December 15, 2010, 12:04:08 am »
Woah 31 colors is awesome! I was sure such thing could be possible, because of how good 16 level GS looks like. Do you use the same method as on the TI-83 Plus series, kinda? On the 83+, flashing between black and white to get gray causes some static and flickering to happen. To make the eye think it's flickerless, we simply use a checkered pattern that changes rapidly, creating an illusion of flickerless gray due to the pixels being small. Here's an attachment below

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: mViewer - Nspire BMP viewer
« Reply #68 on: December 15, 2010, 12:09:08 am »
I think you can actually check to see if a frame has completed. Wait for bit 2 of 0xC0000020 to become set, then write 4 to 0xC0000028 to clear the bit. Perhaps that will work for good synchronization?
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline critor

  • Editor
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2079
  • Rating: +439/-13
    • View Profile
    • TI-Planet
Re: mViewer - Nspire BMP viewer
« Reply #69 on: December 15, 2010, 12:11:32 am »
It's similar.

I'm flashing between 2 consecutive gray values among the 16 standard ones, in order to get 15 intermediate grey values.

I just hide the 2nde value for each pixel in the blue color bits, and then alternatively swith between RGB and BGR color modes.
So nothing is copied or calculated.
« Last Edit: December 15, 2010, 12:12:06 am by critor »
TI-Planet co-admin.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: mViewer - Nspire BMP viewer
« Reply #70 on: December 15, 2010, 03:10:34 am »
Very nice! hooray for 31 colors! ;D

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: mViewer - Nspire BMP viewer
« Reply #71 on: December 15, 2010, 04:01:47 am »
I see Critor. Is there a checkered pattern? That said, even with none, I don't think the flickering would be noticeable, though, since the difference between grays isn't too large. Could it be used inside games?

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: mViewer - Nspire BMP viewer
« Reply #72 on: December 15, 2010, 03:57:34 pm »
Yeah, it would work fine for games as long as the rgb/bgr bit was flipped fast enough. If you used interrupts to sync it with the screen refresh rate, you wouldn't have to bother flipping the bit throughout the code, and the pattern would not slow down even if each frame took a while to render.

Offline critor

  • Editor
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2079
  • Rating: +439/-13
    • View Profile
    • TI-Planet
Re: mViewer - Nspire BMP viewer
« Reply #73 on: December 15, 2010, 10:46:02 pm »
Here is my latest build of mviewer2.
It's not an alpha version any more: i've promoted it to a beta now! :)


* All graphic functions are now supporting both the standard 4-bits mode (16 grayscale), and the super 16-bits mode (31 grayscale).

* The 31 grayscale mode delay has been set to 40 (40ms very approximatively). This seems to produce the best display on both tested Nspire (a basic and a CAS ClickPad), because the screen must be done refreshing the previous "action".

* No data copy any more to refresh the screen. I'm using 2 identical buffers: onscreen and offscreen. I update the screen when needed just by setting the SCREEN_BASE_ADDR to the start of the offscreen buffer. The 2 buffers roles are switched this way: onscreen is becoming offscreen, and offscreen is becoming onscreen.

* New emergency key to immediatly turn the screen off, if you were about to be caught viewing something forbidden.

* The '"non-centered zoom" bug has been fixed. There is another minor zoom bug.


The 31 grayscale mode doesn't allways give you a better image. It depends upon the image. Images with areas including very similar adjacent grey levels are going to be wonderfull. You'll have the impression of not being able to count the grey levels in those areas any more.

In 31 grayscale mode, if you look carefully you'll guess which are the new 15 levels. Their display is not perfect. This seems to be related to the way the screen refreshes itself.


Here are the keys not mentionned in the readme from the stable link:
- 'C': switch between 16 grayscale mode and 31 grayscale mode
- 'Home' and 'Menu': increase or decrease the 31 grayscale mode delay (if you've got a "bad" display with the default delay - might be removed in the future, depending upon the tests results)
- 'Ctrl': turn the screen on/off




Future tests:
------------

The 31 grayscale mode is obtained by switching the color encoding from RGB to BGR alternatively.
The 2 different gray levels are stored in the R and B bits and then mixed on the screen, producing a new gray level.
There is another way to produce the new grey levels.
It is to have 2 screen buffers containing the different grey levels, and to change the SCREEN_BASE_ADDRESS alternatively between the starts of those buffers.
I wonder if this method would produce better/worse results...

By combining both methods, we could get (in theory) something like 48/64/... grayscale levels. I wonder how it would look like.
64 levels will be hard (propably impossible), because the total refreshing cycle would need something like 120ms. And the human eye is able to detect a 120ms delay.
With a 80ms delay, 48 levels is "limit" but might give something interesting.


Future features:
----------------
* If the tests are good (but don't be too optimistic), more grayscale levels.
* Going back to 8-bit data to spare some more memory.
* Supporting other image files: PNG/JPG/GIF.
« Last Edit: December 15, 2010, 10:50:22 pm by critor »
TI-Planet co-admin.

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: mViewer - Nspire BMP viewer
« Reply #74 on: December 15, 2010, 10:53:04 pm »
As an idea, could you add in a loading bar or something like that. I have a few large images that I like to open that take a while and I'd like to have an approximation of the remaining time. (Like a 5 MB pic that takes about two minutes to open) :P

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...