]> git.imager.perl.org - imager.git/commitdiff
Added more logging to quant.c. Removed global variables from gif.c.
authorArnar Mar Hrafnkelsson <addi@cpan.org>
Mon, 14 May 2001 03:55:39 +0000 (03:55 +0000)
committerArnar Mar Hrafnkelsson <addi@cpan.org>
Mon, 14 May 2001 03:55:39 +0000 (03:55 +0000)
Increased the limit of table entries when debugging malloc.

MANIFEST
gif.c
io.c
lib/Imager/Color.pm
quant.c

index 71d4d52809a3c26340ea241cb8735b632cae5af3..8469e737d61a71cb7ce14d8327f8e509afff5c6f 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -40,8 +40,7 @@ iolayer.c
 fontfiles/dcr10.afm
 fontfiles/dcr10.pfb
 fontfiles/dodge.ttf
-lib/Imager/regmach.pod
-lib/Imager/Regops.pm
+lib/Imager/regmach.pod #lib/Imager/Regops.pm
 lib/Imager/Expr.pm
 lib/Imager/Expr/Assem.pm
 lib/Imager/Color.pm
@@ -101,4 +100,4 @@ bench/quantone.perl One round of benchmarking image quantization.
 bench/quantbench.perl  Benchmark various quantization methods
 bench/makegrad.perl    Builds regular images for quantization.
 bench/kscdisplay.png   Photo test for quantization.
-bench/benchform.perl   Formats the benchmark results
\ No newline at end of file
+bench/benchform.perl   Formats the benchmark results
diff --git a/gif.c b/gif.c
index 5748afe934632693af7a400af910e4b0dee359e4..7dbfc42cee88dd416d96a91c1e7a0535bb002c02 100644 (file)
--- a/gif.c
+++ b/gif.c
@@ -108,29 +108,27 @@ my_gif_inputfunc(GifFileType* gft, GifByteType *buf,int length) {
 /* Make some variables global, so we could access them faster: */
 
 static int
-    BackGround = 0,
-    ColorMapSize = 0,
-    InterlacedOffset[] = { 0, 4, 2, 1 }, /* The way Interlaced image should. */
-    InterlacedJumps[] = { 8, 8, 4, 2 };    /* be read - offsets and jumps... */
+  InterlacedOffset[] = { 0, 4, 2, 1 }, /* The way Interlaced image should. */
+  InterlacedJumps[] = { 8, 8, 4, 2 };    /* be read - offsets and jumps... */
 
-static ColorMapObject *ColorMap;
+/*  static ColorMapObject *ColorMap; */
 
 
 static
 void
-i_colortable_copy(int **colour_table, int *colours, ColorMapObject *colormap) {
+i_colortable_copy(int **colour_table, int *colours, ColorMapObject *colourmap) {
   GifColorType *mapentry;
   int q;
-  int colormapsize = colormap->ColorCount;
+  int colourmapsize = colourmap->ColorCount;
 
-  if(colours) *colours = colormapsize;
+  if(colours) *colours = colourmapsize;
   if(!colour_table) return;
   
-  *colour_table = mymalloc(sizeof(int *) * colormapsize * 3);
-  memset(*colour_table, 0, sizeof(int *) * colormapsize * 3);
+  *colour_table = mymalloc(sizeof(int *) * colourmapsize * 3);
+  memset(*colour_table, 0, sizeof(int *) * colourmapsize * 3);
 
-  for(q=0; q<ColorMapSize; q++) {
-    mapentry = &colormap->Colors[q];
+  for(q=0; q<colourmapsize; q++) {
+    mapentry = &colourmap->Colors[q];
     (*colour_table)[q*3 + 0] = mapentry->Red;
     (*colour_table)[q*3 + 1] = mapentry->Green;
     (*colour_table)[q*3 + 2] = mapentry->Blue;
@@ -151,8 +149,8 @@ i_img *
 i_readgif_low(GifFileType *GifFile, int **colour_table, int *colours) {
   i_img *im;
   int i, j, Size, Row, Col, Width, Height, ExtCode, Count, x;
-  int cmapcnt = 0, ImageNum = 0;
+  int cmapcnt = 0, ImageNum = 0, BackGround = 0, ColorMapSize = 0;
+  ColorMapObject *ColorMap;
  
   GifRecordType RecordType;
   GifByteType *Extension;
@@ -296,7 +294,7 @@ i_readgif_low(GifFileType *GifFile, int **colour_table, int *colours) {
            col.rgb.r = ColorMapEntry->Red;
            col.rgb.g = ColorMapEntry->Green;
            col.rgb.b = ColorMapEntry->Blue;
-           i_ppix(im,x,Row,&col);
+           i_ppix(im, x, Row, &col);
          }
          Row++;
        }
diff --git a/io.c b/io.c
index 64fc84e5a7cbb534efb925acdc92cc3567f0ba71..ca38fa9b2d8376275ea0fff660e7739260d0098d 100644 (file)
--- a/io.c
+++ b/io.c
@@ -10,7 +10,7 @@
 
 #ifdef IMAGER_DEBUG_MALLOC
 
-#define MAXMAL 1024
+#define MAXMAL 102400
 #define MAXDESC 65
 
 #define UNDRRNVAL 100
index a74a4963429b274475b410ad5ea1401c159af92d..2248798eb5f903738aa206c1703ee64566630280 100644 (file)
@@ -32,7 +32,6 @@ sub new {
 
 sub set {
   my $self = shift;
-  print "set: @_\n";
   my @arg = pspec(@_);
   return @arg ? set_internal($self, $arg[0],$arg[1],$arg[2],$arg[3]) : ();
 }
diff --git a/quant.c b/quant.c
index 3787008d34642b665037999a1d9aa0607d17d1a2..e257b8f53d75c1d7a7e1b0a92760e97e7709d2ea 100644 (file)
--- a/quant.c
+++ b/quant.c
@@ -68,7 +68,11 @@ static void translate_addi(i_quantize *, i_img *, i_palidx *);
    The giflib quantizer ignores the palette.
 */
 i_palidx *quant_translate(i_quantize *quant, i_img *img) {
-  i_palidx *result = mymalloc(img->xsize * img->ysize);
+  i_palidx *result;
+       mm_log((1, "quant_translate(quant %p, img %p)\n", quant, img));
+
+       result = mymalloc(img->xsize * img->ysize);
+
   switch (quant->translate) {
 #ifdef HAVE_LIBGIF
   case pt_giflib:
@@ -115,7 +119,7 @@ static void translate_giflib(i_quantize *quant, i_img *img, i_palidx *out) {
   
   i_color col;
 
-  /*mm_log((1,"i_writegif(0x%x, fd %d, colors %dbpp)\n",im,fd,colors));*/
+       mm_log((1,"i_writegif(quant %p, img %p, out %p)\n", quant, img, out));
   
   /*if (!(im->channels==1 || im->channels==3)) { fprintf(stderr,"Unable to write gif, improper colorspace.\n"); exit(3); }*/