flat assembler
Message board for the users of flat assembler.

Index > Heap > How to Display 24 bit Image on an 8-bit graphics screen?

Author
Thread Post new topic Reply to topic
prostyle4444



Joined: 28 Jun 2013
Posts: 22
Location: Bootsector
prostyle4444
I`d made a program in asm to display 8-bit bitmap images. I just wanted to display 24-bit bitmap image on an 8-bit graphic screen. Can anybody please help me in doing this?
Post 15 Feb 2014, 10:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17253
Location: In your JS exploiting you and your system
revolution
The first thing you need to read about is colouring schemes and how to reduce a 24-bit colour set into an 8-bit palette. There are a number of possible algorithms and methods that might be appropriate depending upon what precisely you need to achieve and what limitations you have in your 8-bit system.
Post 15 Feb 2014, 14:07
View user's profile Send private message Visit poster's website Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
We were discussing this on another thread, where I just posted an example. The thread is http://board.flatassembler.net/topic.php?p=167320#167320
Post 15 Feb 2014, 23:01
View user's profile Send private message Reply with quote
prostyle4444



Joined: 28 Jun 2013
Posts: 22
Location: Bootsector
prostyle4444
I have decided to use the color quantization method. It will take a some time to code but i will finally be able to display 24 bit bitmap on an 8-bit graphic screen. Thanks for all your help.
Post 18 Feb 2014, 03:58
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
Quote:
I have decided to use the color quantization method

There are many such methods, all with different run time and memory complexities. What method are you using?
Post 18 Feb 2014, 08:02
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
> How to Display 24 bit Image on an 8-bit graphics screen?

There are only 2 methods:

- FIXED PALETTE - set up your palette at program start and then reduce your 24 bpp image to it

- VARIABLE PALETTE - reduce your 24 bpp image to a palette best suited for it, and then write it to the palette registers, you will have to exchange the palette for every image you display, and you may have trouble putting other stuff (text, rat arrow, ...) on the screen

If you use dithering, make sure to do this with GAMMA CORRECTED (linear) colours, otherwise the result is semi-crap at best.
Post 19 Feb 2014, 14:56
View user's profile Send private message Reply with quote
prostyle4444



Joined: 28 Jun 2013
Posts: 22
Location: Bootsector
prostyle4444
tthsqe: I have decided to use the median-cut quantization method as I found it compartively easier to code than the other color quantization methods and also it provides a decent output. Thanks a lot for your help. Very Happy

DOS386: Variable palette method is bit too complex as it involves frequent changing of palette for which i have to incorporate a major change in my bitmap viewer. So i guess i`ll just stick on to the fixed palette method. Thanks a lot for answering. Very Happy
Post 04 Mar 2014, 08:21
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
the palette registers can be modified every refresh of the screen (vsync) but should be made in the early times of the vsync routine. ones your vsync bit signals you the vertical retrace, you can refresh the palette, and then, the framebuffer. otherwise, you will see undesired flickers.

Code:
refresh:dd node,@f-$-4   ;refresh the screen display, run from last to first
        dd .timer ;reset timer  last step
        dd .clear ;clear the buffer far more faster/better than the backbox used as background.
        dd .mcopy ;transfert the buffer to video memory
        dd .palette ;update the palette
        dd .vsync ;wait for vsync signal first step
        @@: 
    
Post 04 Mar 2014, 08:53
View user's profile Send private message Visit poster's website Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
prostyle,
Could you post some results of your quantizer? I was actually impressed with the quality of the results of my quantizer; the only downside was that it was very slow. I imagine a b-split method would be fast, but produce results of questionable quality. Please post some results if you can...
Post 04 Mar 2014, 11:01
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.