Ever since I made the HD Picture Viewer for the TI-84 Plus CE, I've wondered if I could make a similar program in pure TI-Basic that was at least better than TI's built-in image converter. A recent post finally gave me the motivation to make one this weekend.

Download: Cemetech | GitHub


Left: TI | Right: SD Picture Viewer

Let's delve into the trade-offs:

There's no doubt TI's picture has better colors. However, given that SD Picture Viewer only has access to 15 colors, I'm still impressed with the result. The decent colors are primarily from using dithering which was suggested by twisted_nematic57.

SD Picture Viewer's resolution (265x165) is twice as good as TI's picture variables (about 132x82). Fortunately SD Picture Viewer files are 45kb which is only twice the size of TI's files rather than 4 times the size!

TI picture variables have a major win when it comes to render time. Despite my optimizations reducing the time down from 30 minutes, SD Picture Viewer still takes 7 minutes to draw on a hardware revision M calculator. (fun fact: it takes a minimum of 76 seconds to fill the whole graph screen with pxl-on() ) Once it's rendered though, you can store the result to a picture variable file to recall later. If you want to golf the code, be my guest: Source

A slight win for SD Picture Viewer is the number of images you can keep on the calculator.

A better approach in the future would be to create a TI picture variable directly from my computer converter. You'd get instant render times and better colors. That didn't sound as fun to me though. Laughing
A neat idea and the results look great!

Have you thought about adding some compression to the data?
Yes! I considered using some form of compression but with the performance already being so slow and my limited time this weekend, I opted to omit it.
I spent some time trying all sorts of optimizations that went nowhere at first, but I finally made a breakthrough!

I thought the expr() command was the main bottleneck so I added all sorts of methods of calling it as little as possible. These optimizations might actually work well if the pictures were mostly contiguous colors but with the dithering, it just didn't improve performance and often degraded it (up to 90 minutes on one attempt).

I did make one minor optimization where I replaced the expr() command with inString() which improved performance by roughly 3 minutes

After staring at the rendering for the thousandth time, I finally noticed the rendering started fast, but gradually slowed to a crawl. When the next string of data was loaded, the drawing became quick again. This means it was actually the sub() command bogging down trying to pick out a character from a 9999 character string!

I modified the code to load data from the strings in small chunks ~500 characters at a time. This ensures the sub() command keeps running at peak speed, and there's not too much time wasted loading each chunk. This was a HUGE optimization that dropped render times from 24 minutes to 9.5 minutes! (pre-revision M calculators dropped from an hour to 30 minutes).

I haven't updated the converter yet but I've added a new tab to the source coder project with the updated code: Code

Over the past few weeks I've been slowly rewriting the converter to Python so I could utilize the tivars library and directly export .8x files. The converter now also exports the data in the form of a list instead of a string. This is primarily to avoid the bottleneck caused by the sub() command. This means I also had to rewrite the calculator program to read the data from a list.

This dropped render times from 9.5 minutes to 7 minutes! It's not too much faster but the code is a lot less complex. There's probably some code golfing to be done but I'm pretty happy with the speed: Code (SDLIST tab)

Unfortunately I don't care for the python dithering algorithm as much as the C# one. It appears more grainy to me. Thankfully this could be changed pretty easily in the future with a different algorithm.


Old - New

If you want to convert your own image, I've pushed out a new release! https://github.com/TheLastMillennial/SDPictureViewerConverter/releases/tag/v2.0.0
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement