flat assembler
Message board for the users of flat assembler.

Index > Heap > m3ntal's Diary: Code, Macros, Previews

Goto page Previous  1, 2, 3, 4  Next
Author
Thread Post new topic Reply to topic
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
HaHa, let us set this as your project. Please make a 64 bit dll that can convert a bitmap file to pgn. It is ok if both the bmp and png are in memory. Something like this
LPVOID BmpToPng(
_In_ LPVOID BmpBuffer ,
_In_ DWORD BmpFileSize
);
I could try to save some disk space when making videos (like http://www.youtube.com/watch?v=huSGEbhKA9o&list=PLU2m6RRABwPiJ_uXJXFC4uxIUvrq45tqB )
Post 12 Feb 2014, 03:08
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 18:14; edited 2 times in total
Post 12 Feb 2014, 03:57
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
HaHaAnonymous wrote:
It will take a few days, if not weeks.
There is no rush. IMO it is better to have it useful and working than have it submitted faster and be broken and useless.
Post 12 Feb 2014, 04:24
View user's profile Send private message Visit poster's website Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal
Quote:
Is the Linux support already working?
Not yet, just a list of system calls.
Quote:
For pictures of real scenes, or dithered computer generated content, things like GIF/PNG (non-lossy) and JPEG (lossy) are usually a better choice
I know. I7 is designed for images containing a low number of unique colors: fonts, logos, icons, textures, animations, binary/monochrome masks/matrix, etc. GIF is more effective for sequences. FASM includes an example that loads the old GIF87A and Tomasz posted a LZW encoder/decoder here.

tthsqe: Excellent. I've seen some of your videos and I gave thumbs up on every one of them.
Post 12 Feb 2014, 10:49
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal
My Dream Project: Z Development Studio: The "MAME" of All Compilers+Assemblers:

Image

Each system icon is a NAME.TXT that sets parameters when selected. Language+library are user-defined "plugins"/components that users can create and share. Ancient CPUs (6502, 68000, Z80, etc) will only have the assembler, and if I get time, a disassembler+emulator for each one. Example NAME.TXT:
Code:
Icon=I32W
Device=PC
CPU=Intel
BITS=32
Model=SSE1, SSE2, Pentium
Version=0
Type=Executable, Library, Object
Base=0
Language=Z, Magic, CML, Pure ASM    
How long before initial release? (in Projects forum). Maybe 1-2 months, I don't know, depends on the time I have available.
Post 12 Feb 2014, 12:10
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 18:13; edited 2 times in total
Post 14 Feb 2014, 04:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
HaHaAnonymous wrote:
Download: http://www.sendspace.com/file/75vff2
Somehow I don't think you wrote that. If you did then please post the source code.
Post 14 Feb 2014, 06:06
View user's profile Send private message Visit poster's website Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal
Image
Post 14 Feb 2014, 07:08
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 18:13; edited 2 times in total
Post 14 Feb 2014, 13:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
HaHaAnonymous wrote:
Did you expect me to write a implementation from scratch?!
Yes, of course I did.
HaHaAnonymous wrote:
Not for Windows...
A wrapper for Windows or Linux (or whatever OS) is not part of the requirement.
Post 14 Feb 2014, 13:11
View user's profile Send private message Visit poster's website Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal
Standard art software can convert image formats; ie, BMP to PNG. To reduce the size of images associated with our programs+games, we will need functions that load compressed images. All of my load functions accept structure, filename and return 1/0:
Code:
function load.x, image, file
  ; ...
endf    
PS: Deleted responses to deleted messages.


Last edited by m3ntal on 27 Feb 2014, 21:46; edited 1 time in total
Post 14 Feb 2014, 18:44
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal
Preview of ZDS implementation:

Image
Post 14 Feb 2014, 18:50
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 18:11; edited 2 times in total
Post 14 Feb 2014, 19:11
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal
Anyone want to write .DLL to load compressed image formats? Here are some C definitions to get you started:
Code:
#define structure typedef struct

structure {
  void *p;
  int x, y, w, h, bpp, alpha;
} Image;

int LoadBMP(Image *image, char *file);
int SaveBMP(Image *image, char *file);
int LoadGIF(Image *image, char *file);
int SaveGIF(Image *image, char *file);
int LoadPNG(Image *image, char *file);
int SavePNG(Image *image, char *file);    
Now, to convert any format, load to general Image structure then save as:
Code:
Image image;
char *source="MY.BMP", *destiny="MY.GIF";

if (!LoadBMP(&image, source)) return 0;
if (!SaveGIF(&image, destiny)) return 0;
return 1;    
Edit: To save 15/16/24/32 BPP as a lower BPP with palette (1/2/4/8/12) - example: 24BPP .BMP as 8BPP .GIF - number of colors must be reduced. See color quantization.
Post 14 Feb 2014, 19:48
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
mental, I would like to first give the bmp load/save a try, especially the color quantization. What is the internal format of your Image structure? It is clear what Image.w and Image.h are, but what about the others?
Post 14 Feb 2014, 22:48
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal
IMAGE is a generic "bitmap" structure defined in IMAGE.INC:
Code:
structure IMAGE
  void p             ; pixels address
  integer x, y, w, h ; location, size
  integer bpp        ; bits per pixel: 32 in memory
  integer key, alpha ; transparency or 0/opaque
ends ?image

draw.bitmap pixels, x, y, w, h, key, alpha ; DRAW.INC

; IMAGE.INC:

draw.image image
draw.image image, x, y
draw.image.b image, box
draw.image.a image, box, a
draw.image.in image, box, a, nx, ny
draw.image.alpha image
; ... etc    
Quote:
especially the color quantization
An alternative is to convert 24BPP images to 8BPP using an art program then save as 8BPP .BMP. SaveGIF(Image, File) would assume that Image has a maximum of 256 colors.
Post 14 Feb 2014, 23:41
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
Do you already have an art program that will do a 256 color quantization of an image? This is what I am think about at the moment....
Post 15 Feb 2014, 00:45
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal
Jasc Paint Shop Pro can reduce the number of colors: Image > Decrease Color Depth > X Colors. And it can save GIFA87/9 with non/interlaced (Save>Options).

LZW/GIF algorithms in different languages at rosettacode.
Post 15 Feb 2014, 01:26
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
Yes, but I though you wanted to do it in asm...??
If you want it in fasm, I am writing a high quality quantizier at the moment. If we combine that with a LZW compressor (maybe you can write it?), we will have a gif encoder implemented in fasm.
Post 15 Feb 2014, 01:56
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
Here is an attempt at color quantization. The algorithm is slow but it seems to be of good quality. I convert rgb values to yuv values so that the luminosity is most accurately quantized. It was inspired by neural networks (http://members.ozemail.com.au/~dekker/NEUQUANT.HTML), but I gave it some substantial tweaks to make it converge faster.


Description: different numbers of colors
Filesize: 276.84 KB
Viewed: 6234 Time(s)

screen.jpg


Description:
Download
Filename: quant.zip
Filesize: 430.62 KB
Downloaded: 184 Time(s)

Post 15 Feb 2014, 22:52
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3, 4  Next

< 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.