English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 25 May 2016, 12:53   #1
Trachu
Registered User
 
Join Date: Dec 2015
Location: Poland
Posts: 189
IFF ILBM Commpression Optimiser

Hello

While doing graphics for Ryggar i have found interesting behaviour which would lead increasing or decreaseing commpressibility of standard AMIGA IFF files.

Lets take standard 16colour palette files.
We could have 16x15x14x13x12x11x10x9x8x7x6x5x4x3x2x1 combinations where each of the colour can be placed in different colour register creating in effect exactly the same picture (lossless) but different bitmap, which in the end lead to better or lower compressability of such picture.
I have included the examples for you to see. There si exactly 4621bytes difference between zip archive contain exactly the same graphics just with different colour registers used.

Such tool could be very usable for 64kB Intro makers, where every bit counts, but in generall use also.

Maybe someone know such tool and if not maybe someone could create one?
Attached Files
File Type: zip alienvspredator640512-4c_output1.zip (54.3 KB, 140 views)
File Type: zip alienvspredator640512-4c_output2.zip (50.6 KB, 131 views)
File Type: zip alienvspredator640512-4c_output3.zip (54.3 KB, 119 views)
File Type: zip alienvspredator640512-4c_output4.zip (54.9 KB, 127 views)
File Type: zip alienvspredator640512-4c_output5.zip (55.1 KB, 122 views)
File Type: zip alienvspredator640512-4c_output6.zip (50.6 KB, 132 views)

Last edited by Trachu; 25 May 2016 at 15:22.
Trachu is offline  
Old 25 May 2016, 22:54   #2
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
yeah! great trick! but how it works?
Mrs Beanbag is offline  
Old 25 May 2016, 23:13   #3
Trachu
Registered User
 
Join Date: Dec 2015
Location: Poland
Posts: 189
its simple. Just swap colour positions:

alienvspredator640512-4c_output2.iff has such colours

0 0 17
68 68 119
204 221 238
119 136 170

alienvspredator640512-4c_output5.iff uses

0 0 17
204 221 238
119 136 170
68 68 119

Different colour positions is creating different 0 and 1 placement hence creating more or less compressible data.
Trachu is offline  
Old 25 May 2016, 23:50   #4
StatMat
Code Fiddler
 
StatMat's Avatar
 
Join Date: Apr 2016
Location: UK
Age: 48
Posts: 81
Interesting idea. Re-ordering the palette such that the RLE can be more effective on the actual bitmap data. Similar behaviour can be observed by re-ordering files in solid archives.
StatMat is offline  
Old 26 May 2016, 11:03   #5
thellier
Registered User
 
Join Date: Sep 2011
Location: Paris/France
Posts: 274
Nice idea

Perhaps the better palette can be predicted (vs try all palettes,pack,compare)
For each pixel count what kind of pixel change (from previous pixel) we have like color0 to color1,etc...

Then
we will obtain solmething like

color0 to color1 : 1300 pixels
color1 to color2 : 20 pixels
color2 to color3 : 400 pixels
color3 to color4 : 500 pixels
etc...

Then if the max occurrence is (say) color3 to color8 ==> adjust palette so that color3 and color8 would only differ on a single bitplane bit


Alain
thellier is offline  
Old 28 May 2016, 13:46   #6
Cylon
Registered User
 
Join Date: Oct 2014
Location: Europe
Posts: 471
Interesting, indeed.
Well, for your own productions you can create an own IFF chunk for optimal compression. just need to adapt import/export plugins for e.g. PersonalPaint.

Last edited by Cylon; 29 May 2016 at 02:51.
Cylon is offline  
Old 28 May 2016, 15:26   #7
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
so ILBM performs run-length encoding separately on each bitplane? interesting...

so what is the algorithm for picking which colours to swap? is there an efficient way or just brute-force?
Mrs Beanbag is offline  
Old 29 May 2016, 08:32   #8
Trachu
Registered User
 
Join Date: Dec 2015
Location: Poland
Posts: 189
Quote:
Originally Posted by thellier View Post
Nice idea

Perhaps the better palette can be predicted (vs try all palettes,pack,compare)
For each pixel count what kind of pixel change (from previous pixel) we have like color0 to color1,etc...

Then
we will obtain solmething like

color0 to color1 : 1300 pixels
color1 to color2 : 20 pixels
color2 to color3 : 400 pixels
color3 to color4 : 500 pixels
etc...

Then if the max occurrence is (say) color3 to color8 ==> adjust palette so that color3 and color8 would only differ on a single bitplane bit


Alain
Well for your information in case of version 2 which is the most compressible the situation looks like this

colour 0 (black) -147197
colour 1 (dark blue) - 89942
colour 2 (brightest blue - almost white) - 31913
colour 3 (middle blue) - 58628

in case of output6 which is almost as compressible

colour 0 (black) -147197
colour 1 (brightest blue - almost white) - 31913
colour 2 (dark blue) - 89942
colour 3 (middle blue) - 58628


i believe what you say is some option for optimisation, but it still depends which pixel is the neighbour of which, but i was thinking about normal PC program where speed is not an issue.

Last edited by Trachu; 28 October 2016 at 19:25.
Trachu is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
OS X Quick Look plugin for IFF ILBM images dalton News 17 01 September 2021 22:24
iff/ilbm on NDOS disk ???? SkulleateR support.Other 10 11 February 2016 18:47
converting pc pictures to iff or ilbm files locksmith Amiga scene 12 14 September 2015 15:54
Slide show Pictures Question - IFF ILBM Peter support.Apps 20 04 December 2012 05:41
IFF/ILBM structures .... freddix Coders. General 7 18 September 2006 09:54

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:08.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08096 seconds with 16 queries