Skip to content
Snippets Groups Projects
Commit a630bec3 authored by Mirar (Pontus Hagland)'s avatar Mirar (Pontus Hagland)
Browse files

(Image.GIF) added support for crippled lzw, some kind of rle

Rev: src/configure.in:1.294
Rev: src/modules/Image/encodings/gif_lzw.c:1.6
Rev: src/modules/Image/encodings/gif_lzw.h:1.7
parent 6bd087b2
No related branches found
No related tags found
No related merge requests found
AC_REVISION("$Id: configure.in,v 1.293 1999/05/29 15:20:51 grubba Exp $") AC_REVISION("$Id: configure.in,v 1.294 1999/05/30 20:11:12 mirar Exp $")
AC_INIT(interpret.c) AC_INIT(interpret.c)
AC_CONFIG_HEADER(machine.h) AC_CONFIG_HEADER(machine.h)
...@@ -284,6 +284,7 @@ AC_ARG_WITH(threads, [ --without-threads no threads support],[],[with_ ...@@ -284,6 +284,7 @@ AC_ARG_WITH(threads, [ --without-threads no threads support],[],[with_
AC_ARG_WITH(zlib, [ --without-zlib no gz compression support],[],[with_zlib=yes]) AC_ARG_WITH(zlib, [ --without-zlib no gz compression support],[],[with_zlib=yes])
AC_ARG_WITH(ssleay, [ --without-ssleay no support for the secure socket protocol],[],[with_ssleay=yes]) AC_ARG_WITH(ssleay, [ --without-ssleay no support for the secure socket protocol],[],[with_ssleay=yes])
AC_ARG_WITH(mysql, [ --without-mysql no support for the Mysql database],[],[with_mysql=yes]) AC_ARG_WITH(mysql, [ --without-mysql no support for the Mysql database],[],[with_mysql=yes])
AC_ARG_WITH(gif-rle, [ --with-gif-rle use kind-of-rle packing instead of lzw],[],[])
AC_ARG_WITH(dmalloc, [ --with-dmalloc enable memory-leak tests],[AC_DEFINE(DEBUG_MALLOC,10)],[]) AC_ARG_WITH(dmalloc, [ --with-dmalloc enable memory-leak tests],[AC_DEFINE(DEBUG_MALLOC,10)],[])
AC_ARG_WITH(checker, [ --with-checker add extra memory checking overhead (Purify)]) AC_ARG_WITH(checker, [ --with-checker add extra memory checking overhead (Purify)])
AC_ARG_WITH(profiling, [ --with-profiling add code used to profile pike code ],[AC_DEFINE(PROFILING)],[]) AC_ARG_WITH(profiling, [ --with-profiling add code used to profile pike code ],[AC_DEFINE(PROFILING)],[])
......
/* /*
**! module Image **! module Image
**! note **! note
**! $Id: gif_lzw.c,v 1.5 1998/04/29 01:27:22 mirar Exp $ **! $Id: gif_lzw.c,v 1.6 1999/05/30 20:11:14 mirar Exp $
*/ */
#include "global.h" #include "global.h"
#include "image_machine.h"
#include "gif_lzw.h" #include "gif_lzw.h"
#define DEFAULT_OUTBYTES 16384 #define DEFAULT_OUTBYTES 16384
...@@ -84,19 +85,37 @@ static INLINE void lzw_add(struct gif_lzw *lzw,int c) ...@@ -84,19 +85,37 @@ static INLINE void lzw_add(struct gif_lzw *lzw,int c)
if (lzw->current==LZWCNULL) /* no current, load */ if (lzw->current==LZWCNULL) /* no current, load */
{ {
lzw->current=c; lzw->current=c;
#ifdef GIF_LZW_LZ
lzw->skipone=0;
#endif
return; return;
} }
lno=lzw->code[lzw->current].firstchild; /* check if we have this sequence */ #ifdef GIF_LZW_RLE
while (lno!=LZWCNULL) if (c==lzw->code[lzw->current].c)
{ {
if (lzw->code[lno].c==c && lno!=lzw->codes-1 ) #endif
#ifdef GIF_LZW_LZ
if (!lzw->skipone)
{ {
lzw->current=lno; #endif
return; /* check if we have this sequence */
lno=lzw->code[lzw->current].firstchild;
while (lno!=LZWCNULL)
{
if (lzw->code[lno].c==c && lno!=lzw->codes-1 )
{
lzw->current=lno;
return;
}
lno=lzw->code[lno].next;
}
#ifdef GIF_LZW_RLE
} }
lno=lzw->code[lno].next; #endif
#ifdef GIF_LZW_LZ
} }
#endif
if (lzw->codes==4096) /* needs more than 12 bits */ if (lzw->codes==4096) /* needs more than 12 bits */
{ {
...@@ -113,6 +132,9 @@ static INLINE void lzw_add(struct gif_lzw *lzw,int c) ...@@ -113,6 +132,9 @@ static INLINE void lzw_add(struct gif_lzw *lzw,int c)
lzw->codebits=lzw->bits+1; lzw->codebits=lzw->bits+1;
lzw->current=c; lzw->current=c;
#ifdef GIF_LZW_LZ
lzw->skipone=0;
#endif
return; return;
} }
...@@ -133,6 +155,9 @@ static INLINE void lzw_add(struct gif_lzw *lzw,int c) ...@@ -133,6 +155,9 @@ static INLINE void lzw_add(struct gif_lzw *lzw,int c)
lzw->codebits++; lzw->codebits++;
lzw->current=c; lzw->current=c;
#ifdef GIF_LZW_LZ
lzw->skipone=!lzw->skipone;
#endif
} }
void image_gif_lzw_init(struct gif_lzw *lzw,int bits) void image_gif_lzw_init(struct gif_lzw *lzw,int bits)
......
/* /*
**! module Image **! module Image
**! note **! note
**! $Id: gif_lzw.h,v 1.6 1998/05/02 01:24:25 mirar Exp $ **! $Id: gif_lzw.h,v 1.7 1999/05/30 20:11:15 mirar Exp $
*/ */
typedef unsigned short lzwcode_t; /* no more than 12 bits used */ typedef unsigned short lzwcode_t; /* no more than 12 bits used */
...@@ -23,6 +23,10 @@ struct gif_lzw ...@@ -23,6 +23,10 @@ struct gif_lzw
int earlychange; int earlychange;
int reversebits; int reversebits;
#ifdef GIF_LZW_LZ
int skipone; /* lz marker for skip next code */
#endif
unsigned long codes; unsigned long codes;
unsigned long bits; /* initial encoding bits */ unsigned long bits; /* initial encoding bits */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment