flat assembler
Message board for the users of flat assembler.

Index > Windows > Small GIF decoder for FASM and Fresh.

Author
Thread Post new topic Reply to topic
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 25 Feb 2004, 09:38
Hi all.
In this moment as a little rest from Fresh, I began to port several libraries from MASM to FASM (Fresh).
This is first of them: GifLib1.0 from Exagone (aka MadWizzard).
This library contains only GIF decoder and it is very small. I am intended to use it for loading images for toolbars and menus instead of bitmaps, because bitmaps are too big for assembly programming style. Smile

GifLib is not finished yet. I think to implement transparency and some more convenient user API.

Regards.

[edit]New version of the file is available below. [/edit]


Last edited by JohnFound on 27 Feb 2004, 22:21; edited 2 times in total
Post 25 Feb 2004, 09:38
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 25 Feb 2004, 11:54
What about gif's patent issues?
Post 25 Feb 2004, 11:54
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 25 Feb 2004, 12:07
roticv wrote:
What about gif's patent issues?


Well, I expected that question. Smile
I made some search about this problem and IMHO everythink is clear.
There are several considerations:

1. Patent in USA expired.

2. Unisys patent in EU is probably illegal, because it was (and today also) illegal to patent interfaces, formats and programs in EU: http://www.noepatents.org/gif.html?LANG=en
At least (AFAIK) no one was sued in Europe for using LZW.

3. In all cases, patent in Europe will expire on 18.06.2004 (btw: my birthday Wink

4. AFAIK, decoders are not covered by LZW patent. (or Unisis granted the right for writing GIF decoders for free).

Regards
Post 25 Feb 2004, 12:07
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 26 Feb 2004, 07:33
Hi all.
With the permission of MadWizard (aka Exagone), the author of the original source, I changed the license of library FASM port to "Fresh artistic license". Also small bugfix and added two precompiled demos - one for file loading and one for resource loading.

File in the first post of the thread is updated.

Regards.
Post 26 Feb 2004, 07:33
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 27 Feb 2004, 22:24
Hi again.
I made some (big) changes in FreshGif library and here is version 1.1.

history.txt wrote:

27.02.2004

- Now library creates DIB bitmaps only in format 32bit. This simplifyes the library and
make it much smaller.
- Size optimizations - now the library is about 1600 bytes long.
- Added support for transparent GIF files.
- Added "ImageList_LoadGif" function that creates transparent imagelist from GIF resource.


Regards.


Description:
Download
Filename: FreshGif1.1.zip
Filesize: 37.99 KB
Downloaded: 358 Time(s)

Post 27 Feb 2004, 22:24
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 28 Feb 2004, 13:51
Very nice JohnFound !!

btw, I've translated another useful stuff for the lib from Thomas (aka MadWizard) I have played also with alpha blending from BitRAKE but I need to do some cleaning.
Code:
proc Resample,lpSrc,lpDest,dwWidth,dwHeight
; Procedure written by Thomas
; http://www.madwizard.org
; This snippet rescales bitmap data (32-bits per pixel) into
; a bitmap of half the size. 
; lpSrc is a pointer to the source bitmap data 
; lpDest is a pointer for the output data 
; dwWidth is the width of the source bitmap 
; dwHeight is the height of the source bitmap. 
; It resamples the bitmap which means it calculates one output
; pixel by averaging four input pixels. The algorithm uses MMX,
; the width should be a multiple of 4, height should be a
; multiple of 2.
     begin 
    push edi esi ebx
    mov        esi, [lpSrc] 
    mov        edi, [lpDest] 
    mov        edx, [dwWidth] 
    shr        edx, 1 
     
    mov        ecx, [dwWidth] 
     
    pxor    MM4, MM4         
     
    mov        ebx, [dwHeight] 
    shr        ebx, 1 
    ALIGN 16 
    .nextline: 
         
        mov        edx, ecx 
        shr        edx, 2 
        ALIGN 16 
        .nextpixel: 
            movq        MM0, [esi]            ; MM0: X2 R2 G2    B2-X1 R1 G1    B1 
            movq        MM1, [esi+8]        ; MM1: X4 R4 G4    B4-X3 R3 G3    B3 
            movq        MM2, [esi+4*ecx]        ; MM2: X6 R6 G6    B6-X5 R5 G5    B5 
            movq        MM3, [esi+4*ecx+8]    ; MM3: X8 R8 G8    B8-X7 R7 G7    B7 
             
            movq        MM5, MM0 
            movq        MM6, MM2 
             
            punpckhbw    MM0, MM4            ; MM0: 00 X2 00    R2-00 G2 00    B2 
            punpckhbw    MM2, MM4            ; MM2: 00 X6 00    R6-00 B6 00    B6 
            punpcklbw    MM5, MM4            ; MM5: 00 X1 00    R1-00 G1 00    B1 
            punpcklbw    MM6, MM4            ; MM6: 00 X5 00    R5-00 G5 00    B5 
             
            paddw        MM0, MM2 
            paddw        MM0, MM5 
            paddw        MM0, MM6 
            psrlw        MM0, 2                 
             
            ; second pixel: 
             
            movq        MM5, MM1 
            movq        MM6, MM3 
             
            punpckhbw    MM1, MM4            ; MM1: 00 X4 00    R4-00 G4 00    B4 
            punpckhbw    MM3, MM4            ; MM3: 00 X8 00    R8-00 B8 00    B8 
            punpcklbw    MM5, MM4            ; MM5: 00 X3 00    R3-00 G3 00    B3 
            punpcklbw    MM6, MM4            ; MM6: 00 X7 00    R7-00 G7 00    B7 
             
            paddw        MM1, MM3 
            paddw        MM1, MM5 
            paddw        MM1, MM6 
            psrlw        MM1, 2             
                 
            ; now:    MM0: 00    XQ 00 RQ-00    GQ 00 BQ ;where    Q is the first mixed pixel 
            ; now:    MM1: 00    XP 00 RP-00    GP 00 BP ;where    P is the second    mixed pixel 
            ; output should    be:    BQ GQ RQ XQ-BP GP RP XP    (in    mem) 
            ;                    XP RP GP BP    XQ RQ GQ BQ    (in    reg) 
             
            packuswb    MM0, MM1 
            movq        [edi], MM0 
             
             
            add        esi, 16 
            add        edi, 8 
            dec        edx 
            jnz        .nextpixel     
         
        lea        esi, [esi+4*ecx] 
        dec        ebx 
        jnz        .nextline 
    emms
    pop ebx esi edi
     return 
endp 
    
Post 28 Feb 2004, 13:51
View user's profile Send private message Yahoo Messenger Reply with quote
Feggger



Joined: 19 Apr 2006
Posts: 8
Feggger 29 Sep 2006, 12:40
"GIF is NOW finally free - for real" (from 1 october 2006)
http://www.freesoftwaremagazine.com/node/1772
Post 29 Sep 2006, 12:40
View user's profile Send private message Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu 29 Sep 2006, 16:13
right
Post 29 Sep 2006, 16:13
View user's profile Send private message Visit poster's website Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 29 Sep 2006, 17:41
the patent is out-of-date?
Post 29 Sep 2006, 17:41
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 cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.