Skip to content
Browse files

Added more logging to quant.c. Removed global variables from gif.c.

Increased the limit of table entries when debugging malloc.
  • Loading branch information...
1 parent 968a2aa commit 2ff8ed30e1ea6c57f4f590c5b3fde5547a18598e Arnar Mar Hrafnkelsson committed
Showing with 22 additions and 22 deletions.
  1. +2 −3 MANIFEST
  2. +13 −15 gif.c
  3. +1 −1 io.c
  4. +0 −1 lib/Imager/Color.pm
  5. +6 −2 quant.c
View
5 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
+bench/benchform.perl Formats the benchmark results
View
28 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++;
}
View
2 io.c
@@ -10,7 +10,7 @@
#ifdef IMAGER_DEBUG_MALLOC
-#define MAXMAL 1024
+#define MAXMAL 102400
#define MAXDESC 65
#define UNDRRNVAL 100
View
1 lib/Imager/Color.pm
@@ -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]) : ();
}
View
8 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); }*/

0 comments on commit 2ff8ed3

Please sign in to comment.
Something went wrong with that request. Please try again.