Getting 256 colour images on screen

115 views
Skip to first unread message

Daniel England

unread,
Jan 29, 2018, 1:05:37 PM1/29/18
to MEGA65 Development
Heyas!

I thought I'd post about my progress with getting a 256 colour image on the screen.

Some time ago, I wrote a tool to convert 256 colour images into a format I could use on the M65.  Recently, I've dug it up again but I've had some trouble using it because the specs have since changed.

I've updated my tool now to comply with the new specs and I am in the process of testing it.  I thought I might post what I am doing.

My first test is a nice spectrum image using 356 unique tiles and 245 colours.  I hope you enjoy it!

Its not using any of the particularly fancy things that the VIC-IV can do (like flipping and colour replacing) so my tool can process it successfully.  I have to check the process of colour replacement in my tool now (it does handle the flipping okay).  By this I mean using the colour RAM to specify a foreground colour or flip bits.  I think it may be artificially reducing the colour count when it attempts to use the colour RAM colours.

Here is a screenshot:



My apologies for the dirty screen.  I think I'll clean it before taking any more screen shots!  :)

I'm now onto my next test.


Daniel.
IMAGETST.zip

Daniel England

unread,
Jan 29, 2018, 3:26:56 PM1/29/18
to MEGA65 Development
Okay so I have a more advanced test to get my image processor working a bit more.

The colour RAM foreground colour replacement seems to work.  However, it has a limitation where it only tries to do the replacement with the 31 most commonly used colours instead of trying to determine what those 31 colours should be by best fit (most common _reuse_).  The colour RAM can only reference the first 32 colours from the palette but colour 0 is reserved for the background.

I may revisit my code and try to add the best fit feature but for now, it will do.  It will probably require that I process the image in three passes instead of the two I now I have to do.  As some background, the program used to do only one pass before but to get the common colour counts, I had to do another pass.

The other thing I needed to test was the tile flipping and I have inadvertently created a test for that, too.  Lucky for me because I'd have to otherwise create one.  

Unfortunately, the flipping isn't working.  I'm not sure where the problem is right now.  I don't know if I'm not writing the bits out correctly or if the VIC-IV is not working right.  I'll need to check and confer with Paul.

Anyway, here is the updated disk with the two images on it.  Also a screen shot:




527 tiles, 13 colours.


Enjoy!


Daniel.

IMAGETST.zip

Daniel England

unread,
Jan 29, 2018, 6:14:04 PM1/29/18
to MEGA65 Development
AHH!!

It turns out I'm was writing the flip flag bits incorrectly.  The image now displays correctly.

I've attached an update.


Daniel.
IMAGETST.zip

adtbm

unread,
Jan 30, 2018, 6:01:07 AM1/30/18
to MEGA65 Development

Hi Daniel,

i have just tested the color demo, for whatever reason the screen looks garbeled here. (But i can still see the demo. Looks great !)
I am not sure, i have tested 2 displays, both with the same result.
Have a look here:

Daniel England

unread,
Jan 30, 2018, 6:03:47 AM1/30/18
to MEGA65 Development
You need a quite recent bitstream for it to work.

You'll need the px100MHz branch...

However, if it is a recent bitstream that you have, Paul did make a change just today that might affect it.

Let me know when you got your bitstream and I can investigate.


Daniel.

Daniel England

unread,
Jan 30, 2018, 6:15:41 AM1/30/18
to MEGA65 Development
Well, I've just tested with the most recent bitstream and it works so I'd say yours must be out of date.

You'll need to build one from the px100MHz branch.

It looks to me like you have a pre 800x600 bitstream, now that I look at it.  I had some trouble with the new (px100MHz) bitstreams on a 1200p monitor and even my 1080p one wasn't too happy at all.

Hopefully we can help you get sorted.


Daniel.

Daniel England

unread,
Jan 30, 2018, 7:39:49 PM1/30/18
to MEGA65 Development
Heyas!

I thought I'd post a follow up to the blog post now over at:  http://c65gs.blogspot.com.au/2018/01/displaying-256-colour-images-and-16.html

I must say that in 24bit colour on the proper board, the images are obviously much better than I'm seeing here on the poor Nexys4DDR.

Its very exciting that this has come together now.

Also, I've attached the disk image that Paul was using so you can all have a play.

I'll release the source code after some fix-ups tomorrow or so.

Enjoy!


Daniel.
IMAGETST.zip

adtbm

unread,
Jan 30, 2018, 8:13:37 PM1/30/18
to MEGA65 Development
Amazing ! Nice job Daniel !

Daniel England

unread,
Jan 31, 2018, 7:44:13 AM1/31/18
to MEGA65 Development
After Daniël Mantione's suggestion to use the NeuQuant algorithm, I did and the results are better.  I've attached the resulting image file.

However, it shows up a problem with my tool...  I believe it is the handling of the limitation in foreground colour (colour RAM) selections that I can make in the mode supported at the moment.

There is now another mode I can use but I think I should try to fix it here, first.

It is also interesting to note that this file is 2/3 the size of the equivalent .png file.


Daniel.
beach.v4t.seq.7z

Daniel England

unread,
Jan 31, 2018, 8:14:39 AM1/31/18
to MEGA65 Development
Hmm...  After thinking about it, I probably can't use the current mode for this kind of image.

The current mode only allows for the first 32 colours from the palette to be used as "foreground" colours or colour number $FF in a tile and there is a limitation in that colour zero is the background colour.  In this mode you really are effectively limited to a maximum of 254 colours not 256 and its really only good for much fewer (I still get a problem when using only 255 colours).  So, good for text (you get a whole bunch of interesting effect attributes) but not really good for complex images.

Paul has added another mode.  I think its the better idea to use that mode, instead.

I think I will have to implement it before I release the code.


Daniel.

Daniel England

unread,
Feb 2, 2018, 1:51:43 PM2/2/18
to MEGA65 Development
Heyas!

I have a new version of my ImageToTiles tool and V4TI loader which seem to be "fully" functional now.

However, I have found some strange things when trying to use some of the features.

I will have to postpone the delivery of the code until they are sorted out.  My apologies.

The wait should be worth it though, my stress test is quite interesting.


Daniel.
Message has been deleted

Daniel England

unread,
Feb 3, 2018, 5:16:19 PM2/3/18
to MEGA65 Development
Heyas!

Well, I just tried to post but something went wrong.

In any case, here is another attempt.

While I'm waiting for some clarity on some issues, I've put together another little demo.

Its not really pushing the limits too hard, I had to scale it back on my original expectations and might have gone a little hard.

I got the image from the web.  It was a winner in some competition but I don't know any more than that.

I hope you enjoy it!


Daniel.
PANORAMA.zip

Daniel England

unread,
Feb 3, 2018, 5:18:28 PM2/3/18
to MEGA65 Development
Oh!  I forgot!

You're going to need a bitstream from the 02JAN2018 or later, afaik.


Daniel.

Daniel England

unread,
Feb 3, 2018, 6:52:00 PM2/3/18
to MEGA65 Development
Heyas!

My prior post was incorrect.  That version requires a bitstream from 02FEB2018.  Gosh, its February already.

I thought that it might not be fair to require such a new bitstream since the image _could_ work on older ones if I didn't use the new mode.

So, I rebuilt the image to not use the new mode and took the opportunity to enhance the demo with some music.

The tune is "Sundown" by László Simon (SLD).

This version should work on bitstreams up to a few weeks ago (some time in early January) but perhaps earlier.

I wish I had a PCB version so I could see how it looks in full 24bit colour instead of 12bit...  Never mind!

Enjoy!


Daniel.
PANORAMA1.zip

adtbm

unread,
Feb 4, 2018, 12:38:14 PM2/4/18
to MEGA65 Development
Hi Daniel,

great demo !!

Is it OK with you, if i upload it to youtube (Of course referncing you as the coder) ?

Like you said, the Panorma1 works excellent, the first version shows garbage, probably due to the older bitstream.

But WOW, it looks awesome !!!

Daniel England

unread,
Feb 4, 2018, 3:00:30 PM2/4/18
to MEGA65 Development
Go for it adtbm.

I don't mind if upload any of the demos I do.  Just make sure you make a reference for any music, too.

I thought we should add a reference for the image on this one but I can't even find it again on the web with exactly the same search parameters.  Perhaps just say the image was sourced from the web.

Post the links!  :)


Daniel.

adtbm

unread,
Feb 4, 2018, 8:23:14 PM2/4/18
to MEGA65 Development
Reply all
Reply to author
Forward
0 new messages