** New Frontiers in VIC-Hires-Graphics, Part 10

Basic and Machine Language

Moderator: Moderators

User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

VFLI image panning viewer

Post by Mike »

Hi!

I revised the display routine of the original FLI mode, so it is now able to load a full format VFLI image file into RAM and display a window of roughly 1/3 horizontal width of it (72 instead of 208 pixels) in a panning view, on an unmodified VIC-20. A full memory expansion (+32K RAM) is required, though.

I included the Frangipani flowers as an example, but of course any other VFLI image file works as well - here's the viewer for download:

Image
(screenshot - the stripes to the left and right show the border colour as it is updated on each raster)

With the VFLI mod, you can view these images in all their glory, at their full width of 208 pixels - so maybe this demo gives you an incentive to try out the mod. :)

Edit: A small update: I extended the viewer to a slide show, and SJLOAD can be used as option to speed up loading times on JiffyDOS-enabled drives (download):

Code: Select all

10 PRINT"{CLR}USE CRSR LEFT/RIGHT TOPAN IMAGE."
11 PRINT"{DOWN}SPACE: NEXT IMAGE."
12 PRINT"{DOWN}USE SJLOAD? Y/N":DN=PEEK(186)
13 GETA$:IFA$="Y"THENN$="SJ-B000":GOSUB24:SYS45056:GOTO15
14 IFA$<>"N"THEN13
15 N$="CODE":GOSUB24:S=6544:SYSS+3
16 READN$:IFN$=""THENEND
17 SYS57809(N$),DN,0:POKE780,0:POKE781,255:POKE782,86:SYS65493
18 X=0:SYSS+6:SYSS:SYSS+9,X
19 GETA$
20 IFA$=" "THENSYSS+12:GOTO16
21 IFA$="{RIGHT}"ANDX<17THENX=X+1:SYSS+9,X
22 IFA$="{LEFT}"ANDX>0THENX=X-1:SYSS+9,X
23 GOTO19
24 SYS57809(N$),DN,1:POKE780,0:SYS65493:RETURN
25 :
26 DATA "AUTUMN LEAVES","CREEK","DESERT LANDSCAPE","DOCK","FOREST","FOREST FLOWERS"
27 DATA "FRANGIPANI FLOWE","GARDEN","GREEN SEA TURTLE","HUMPBACK WHALE","ORYX ANTELOPE"
28 DATA "TOCO TOUCAN","TREE","WATERFALL","WINTER LEAVES",""
29 :
30 REM ** VFLI PANNING SLIDE SHOW WRITTEN 2013-01-27 BY MICHAEL KIRCHER
RJBowman
Vic 20 Enthusiast
Posts: 198
Joined: Tue Oct 25, 2011 7:50 pm

Re: New Frontiers in VIC-Hires-Graphics Series, Part 10

Post by RJBowman »

How do you decide on the background, border, and auxiliary colors for each row?
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: New Frontiers in VIC-Hires-Graphics Series, Part 10

Post by Mike »

RJBowman wrote:How do you decide on the background, border, and auxiliary colors for each row?
For each row, the quantizer tries out all 2048 combinations of background/border/auxiliary colour and takes the one with the smallest error.
RJBowman
Vic 20 Enthusiast
Posts: 198
Joined: Tue Oct 25, 2011 7:50 pm

Re: ** New Frontiers in VIC-Hires-Graphics, Part 10

Post by RJBowman »

I would have guessed that it was something simpler. Thanks for your response.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: ** New Frontiers in VIC-Hires-Graphics, Part 10

Post by Mike »

RJBowman wrote:I would have guessed that it was something simpler. Thanks for your response.
What did you instead expect?

At least I can tell you, that something like "pre-quantize/dither to the 16 colours of the Vic-20, apply statistics and assign the 3 most frequent colours to back/brd/aux" doesn't work well at all. That method would lose too much information which results in lots of blocky/stripy artifacts.
RJBowman
Vic 20 Enthusiast
Posts: 198
Joined: Tue Oct 25, 2011 7:50 pm

Re: ** New Frontiers in VIC-Hires-Graphics, Part 10

Post by RJBowman »

I imagined that the algorithm would go down the row of pixels, determine the closes match on the VIC palette for each pixel, count occurences of each VIC color, and select the top three, then go back an reprocess the dithering for the row. The actual solution used is better, and I think technically simpler, but very computation intensive.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: ** New Frontiers in VIC-Hires-Graphics, Part 10

Post by Mike »

RJBowman wrote:I imagined that the algorithm would go down the row of pixels, determine the closes match on the VIC palette for each pixel, count occurences of each VIC color, and select the top three, then go back an reprocess the dithering for the row.
... which is exactly what I referred to in my preceding post, and what doesn't work well at all.
The actual solution used is better, and I think technically simpler, but very computation intensive.
As long as only a single row is optimized trying all the possible combinations of back/brd/aux, the computation time is bearable. 208 pixels per row (as needed for a full-format VFLI image) can be processed within 1 second/row on a contemporary PC. That means, optimizing the 3 global colours, optimizing the foreground colour and choice of hires/multi for each of the 26 colour RAM cells (with 1 pixel height) and finally dithering to the assigned-to attribute data (those 3 global colours and 26 colour RAM cells for each raster).

That algorithm quickly gets bogged down, when the foreground attribute data not only spans a single pixel row as is the case here with (V)FLI, but spans 8 or 16 rasters with the standard normal or double height characters or still 4 rasters as with the FCB mode in tlr's fcbpaint. As the foreground attributes 'couple' the raster lines, global attributes would need to be optimized together, resulting in a search space of 2048^4, 2048^8 or 2048^16 combinations. 2048^4 combinations would already take 300 years to optimize for such a raster block, so this is completely out of question (much more so for 8 or 16 pixel high attributes/raster blocks).

For MFLI (where we have 8 pixel high attribute data, but still back/brd/aux per raster) I needed to use another approach. That one fixes the choice to multi-colour only, then a heuristic chooses the foreground colour for each 4x8 pixel tile which results in the minimum error for each tile. The foreground colour is thus fixed for all 26x32 tiles, the 3 global colours can once again be optimized for each raster line, but the choice of the foreground colours is not necessarily optimal, and restricted to multi-colour.
Post Reply