Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user megasoftargentina ! (Registered 2024-04-16) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Converting animation into lossy charset - how ?
2015-07-12 12:14
Oswald

Registered: Apr 2002
Posts: 5017
Converting animation into lossy charset - how ?

I've always wondered how an algorithm decides how far is a char from another. any pointers ?
 
... 38 posts hidden. Click here to view all posts....
 
2015-07-13 17:52
chatGPZ

Registered: Dec 2001
Posts: 11090
indeed indeed. i always explicitly try to find code examples, the math nerds at wikipedia even manage to make simple stuff like projectile parabola look super complicated =)
2015-07-13 19:11
Oswald

Registered: Apr 2002
Posts: 5017
also tried to google for code but no luck.. best was some mathlab stuff which seemed to rely too much on built in functions
2015-07-13 20:47
Trash

Registered: Jan 2002
Posts: 122
Quote: also tried to google for code but no luck.. best was some mathlab stuff which seemed to rely too much on built in functions

I got curious of this thread and decided to look for samplecode but took another route on finding it i think. There are a great deal of ASCII-demos out there with sourcecode that generates 320x200 images and converts them to ASCII-art according to a friend. I am still looking but I guess (hoping) its the same stuff you are curious about (both math and codewise)...
2015-07-13 21:20
Oswald

Registered: Apr 2002
Posts: 5017
so how about a pattern matching compo? I'm wondering how much better a more sophisticate algo does than my naive one. Anyone can show his? (penis:)

I've added that each pixel checks its surroundings and weighing (which doesnt seem do shit), only slightly better than counting non matching pixesl.



imho it missreads a lot of features of the original like the inverse ( on the head etc. there's a lot

original pic:

2015-07-13 21:24
algorithm

Registered: May 2002
Posts: 702
just some basics here

select 256 random 8x8 char blocks from the source image/frames

for each block in the original, find the closest match in the 256 random entries and place these together. repeat until all blocks are read

merge the entries. repeat the above steps a few times.

The above is the basics of LBG. Now what you will find more than likely are orphan codebooks where the blocks in the source did not pair up. ELBG solves this issue by reassignment.

Another alternative after this process is to refine the entries after the lbg via hill climbing/genetic methods (as used in CSAM)

This also operates in quarter block and half block regions mapping over to the closest edges of a codebook (instead of forcing to merge the whole block)

Weighting is a must where specific source areas of the image/frames are focused on more/less than others.

There was a good point from Marq where he mentioned shifting some entries before comparison. For example a negative chequerboard and positive one look identical, but when performing a distance check, it would give the worst error ratio. Alternates to the shifting method is to transform the blocks via DCT/FFT and compare

Overall, its not really a nice way of packing data but it is certainly VERY ideal for the c64's tile mode (very fast)

Preprocessing of the animation frames also helps via attempting to keep slightly variated blocks static or some blurring of hard edges.

If ram space is limited, can transform each codevector in many ways xflip,yflip, luminance adjust, although it would use more ram for the buffer (and operate in bitmap mode usually) but speedups can be gained by adjusting only blocks that changed since the last update to that buffer (by keeping the reference recreated lookups)

if dealing with non quantized data, use slightly higher codebook entries (280 etc) as Christopher jam mentioned (this would then more than likely be reduced with some duplicates due to quantization. Alternatively quantize the data first, although mileage may vary and the merging is also less efficient.
2015-07-13 21:34
Oswald

Registered: Apr 2002
Posts: 5017
thanks, ATMO I'm concentrating on pattern matching, anything on that? can you do a fast CSAM with rom cset on the pic above? :)
2015-07-13 21:36
Marq

Registered: Sep 2011
Posts: 47
PETSCII editor's brutal built-in converter (just simple pixel matching IIRC):



Kinda lousy, but it's there as a semi-useless add-on anyway :)
2015-07-13 21:46
algorithm

Registered: May 2002
Posts: 702
Via predefined blocks, it gets much more easy to do this. The hard part is generating custom blocks that represent the image as accurately as possible.

I have a tool here on CSDB (BmpToPET) that does this,

Bmp2pet

maybe you can try it with some settings

using CSAM and custom charset I get the below

2015-07-13 23:23
Shadow
Account closed

Registered: Apr 2002
Posts: 355


Using the converter I wrote when I did my PETSCII version of the Amigaball challenge we had here on the forums a while ago.
Can probably be improved a lot, as it is now it just counts pixels. Will see if I have time to play with it a bit more.
2015-07-14 05:58
Oswald

Registered: Apr 2002
Posts: 5017
atmo I concentrate on pattern matching, its quite interesting to see how good an algo can match the rom cset against pics :)

will try cross correlation and probably FFT too.
Previous - 1 | 2 | 3 | 4 | 5 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
MCM/ONSLAUGHT
kbs/Pht/Lxt
Guests online: 79
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 S!R  (9.9)
3 Mr Zero Page  (9.8)
4 Antitrack  (9.8)
5 OTD  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.049 sec.