Hylafax Developers Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-devel] Re: faxq maxing out CPU - let's crack this!!!!!



Hi,

Attached is a patch so that hylafax works with tiff 3.5.  The tiff 
maintainers changed a few of the internal interfaces to achieve large run 
lengths (from 16 to 32 bits).  Hylafax uses one of libtiffs header 
files(faxd/tif_fax3.h) for some undocumented macros and interfaces and was 
only expecting 16 bits, and broke.

I successfully sent one fax with this patch and libtiff 3.5...anything more 
complicated might or might not work ;-)

- Robert

Index: CopyQuality.c+
==================================================================
RCS file: /usr/local/cvsroot/hylafax/faxd/CopyQuality.c++,
retrieving revision 1.
diff -u -r1.4 CopyQuality.c+
--- CopyQuality.c++	1999/09/02 10:16:22	1.
+++ CopyQuality.c++	2000/03/22 12:32:0
@@ -50,7 +50,7 @
     setupDecoder(conf.recvFillOrder, params.is2D())

     u_int rowpixels = params.pageWidth();	// NB: assume rowpixels <= 243
-    uint16 runs[2*2432];			// run arrays for cur+ref row
+    uint32 runs[2*2432];			// run arrays for cur+ref row
     setRuns(runs, runs+2432, rowpixels)

     recvEOLCount = 0;				// count of EOL code
Index: G3Decoder.c+
==================================================================
RCS file: /usr/local/cvsroot/hylafax/faxd/G3Decoder.c++,
retrieving revision 1.
diff -u -r1.2 G3Decoder.c+
--- G3Decoder.c++	1999/06/13 07:41:03	1.
+++ G3Decoder.c++	2000/03/22 12:32:0
@@ -41,13 +41,13 @
     DECLARE_STATE_EOL();						
     int a0;				/* reference element */		
     int RunLength;			/* length of current run */	
-    uint16* pa;				/* place to stuff next run */	
-    uint16* thisrun;			/* current row's run array */	
+    uint32* pa;				/* place to stuff next run */	
+    uint32* thisrun;			/* current row's run array */	
     const TIFFFaxTabEnt* TabEn
 #define	DECLARE_STATE_2D()						
     DECLARE_STATE();							
     int b1;				/* next change on prev line */	
-    uint16* pb				/* next run in reference line *
+    uint32* pb				/* next run in reference line *
 /
  * Load any state that may be changed during decoding
  *
@@ -113,7 +113,7 @
 

 voi
-G3Decoder::setRuns(uint16* cr, uint16* rr, int w
+G3Decoder::setRuns(uint32* cr, uint32* rr, int w
 
     curruns = cr
     if (refruns = rr) 
@@ -134,7 +134,7 @
 
     u_int rowbytes = howmany(w, 8)
     if (curruns == NULL) 
-	uint16 runs[2*2432];		// run arrays for cur+ref row
+	uint32 runs[2*2432];		// run arrays for cur+ref row
 	setRuns(runs, runs+2432, w)
 	while (h-- > 0) 
 	    decodeRow(raster, w)
@@ -235,7 +235,7 @
 	_TIFFFax3fillruns((u_char*) scanline, thisrun, pa, lastx)
     if (is2D) 
 	SETVAL(0);			// imaginary change for referenc
-	SWAP(uint16*, curruns, refruns)
+	SWAP(uint32*, curruns, refruns)
     
     rowref++
     UNCACHE_STATE()
Index: G3Decoder.
==================================================================
RCS file: /usr/local/cvsroot/hylafax/faxd/G3Decoder.h,
retrieving revision 1.
diff -u -r1.2 G3Decoder.
--- G3Decoder.h	1999/06/13 07:41:03	1.
+++ G3Decoder.h	2000/03/22 12:32:0
@@ -43,8 +43,8 @
     int		RTCrun;		// count of consecutive zero-length row
     int		rowref;		// reference count of rows decode
     int		RTCrow;		// row number of start of RT
-    uint16*	refruns;	// runs for reference lin
-    uint16*	curruns;	// runs for current lin
+    uint32*	refruns;	// runs for reference lin
+    uint32*	curruns;	// runs for current lin
     const u_char* bitmap;	// bit reversal tabl
 protected
     G3Decoder()
@@ -68,8 +68,8 @
     virtual ~G3Decoder()

     void	setupDecoder(u_int fillorder, bool is2D)
-    void	setRuns(uint16*, uint16*, int)
-    uint16*	lastRuns()
+    void	setRuns(uint32*, uint32*, int)
+    uint32*	lastRuns()

     void	decode(void* raster, u_int w, u_int h)
     bool	decodeRow(void* scanline, u_int w)
@@ -92,7 +92,7 @
 #define	EOFraised()		(sigsetjmp(jmpEOF, 0) != 0
 #define	RTCraised()		(sigsetjmp(jmpRTC, 0) != 0

-inline uint16* G3Decoder::lastRuns()	{ return is2D ? refruns : curruns; 
+inline uint32* G3Decoder::lastRuns()	{ return is2D ? refruns : curruns; 
 inline const u_char* G3Decoder::getBitmap()	{ return bitmap; 
 inline int G3Decoder::getPendingBits() const	{ return bit; 
 inline bool G3Decoder::seenRTC() const	{ return (RTCrow != -1); 
Index: TagLine.c+
==================================================================
RCS file: /usr/local/cvsroot/hylafax/faxd/TagLine.c++,
retrieving revision 1.
diff -u -r1.4 TagLine.c+
--- TagLine.c++	1999/08/23 11:19:34	1.
+++ TagLine.c++	2000/03/22 12:32:1
@@ -208,7 +208,7 @
      *
     TagLineMemoryDecoder dec(buf)
     dec.setupDecoder(fillorder,  params.is2D())
-    uint16 runs[2*2432];		// run arrays for cur+ref row
+    uint32 runs[2*2432];		// run arrays for cur+ref row
     dec.setRuns(runs, runs+2432, w)

     dec.decode(NULL, w, th);		// discard decoded dat
Index: choptest.c+
==================================================================
RCS file: /usr/local/cvsroot/hylafax/faxd/choptest.c++,
retrieving revision 1.
diff -u -r1.2 choptest.c+
--- choptest.c++	1999/06/13 07:41:05	1.
+++ choptest.c++	2000/03/22 12:32:1
@@ -70,7 +70,7 @
 

 static boo
-isBlank(uint16* runs, u_int rowpixels
+isBlank(uint32* runs, u_int rowpixels
 
     u_int x = 0
     for (;;) 
@@ -89,7 +89,7 @
 
     setupDecoder(fillorder,  params.is2D())
     u_int rowpixels = params.pageWidth();	// NB: assume rowpixels <= 243
-    uint16 runs[2*2432];			// run arrays for cur+ref row
+    uint32 runs[2*2432];			// run arrays for cur+ref row
     setRuns(runs, runs+2432, rowpixels)

     if (!RTCraised()) 
Index: cqtest.c+
==================================================================
RCS file: /usr/local/cvsroot/hylafax/faxd/cqtest.c++,
retrieving revision 1.
diff -u -r1.4 cqtest.c+
--- cqtest.c++	1999/09/02 10:16:22	1.
+++ cqtest.c++	2000/03/22 12:32:1
@@ -144,7 +144,7 @
     setupDecoder(recvFillOrder, params.is2D())

     u_int rowpixels = params.pageWidth();	// NB: assume rowpixels <= 243
-    uint16 runs[2*2432];			// run arrays for cur+ref row
+    uint32 runs[2*2432];			// run arrays for cur+ref row
     setRuns(runs, runs+2432, rowpixels)

     recvEOLCount = 0;				// count of EOL code
Index: faxQueueApp.c+
==================================================================
RCS file: /usr/local/cvsroot/hylafax/faxd/faxQueueApp.c++,
retrieving revision 1.
diff -u -r1.7 faxQueueApp.c+
--- faxQueueApp.c++	2000/03/08 13:44:06	1.
+++ faxQueueApp.c++	2000/03/22 12:32:4
@@ -805,7 +805,7 @
 

 static boo
-isBlank(uint16* runs, u_int rowpixels
+isBlank(uint32* runs, u_int rowpixels
 
     u_int x = 0
     for (;;) 
@@ -824,7 +824,7 @
 
     setupDecoder(fillorder,  params.is2D())
     u_int rowpixels = params.pageWidth();	// NB: assume rowpixels <= 243
-    uint16 runs[2*2432];			// run arrays for cur+ref row
+    uint32 runs[2*2432];			// run arrays for cur+ref row
     setRuns(runs, runs+2432, rowpixels)

     if (!RTCraised()) 
Index: tagtest.c+
==================================================================
RCS file: /usr/local/cvsroot/hylafax/faxd/tagtest.c++,
retrieving revision 1.
diff -u -r1.4 tagtest.c+
--- tagtest.c++	1999/08/23 11:19:35	1.
+++ tagtest.c++	2000/03/22 12:32:4
@@ -236,7 +236,7 @
      *
     MemoryDecoder dec(buf)
     dec.setupDecoder(fillorder,  params.is2D())
-    uint16 runs[2*2432];		// run arrays for cur+ref row
+    uint32 runs[2*2432];		// run arrays for cur+ref row
     dec.setRuns(runs, runs+2432, w)

     u_int row
Index: tif_fax3.
==================================================================
RCS file: /usr/local/cvsroot/hylafax/faxd/tif_fax3.h,
retrieving revision 1.1.1.
diff -u -r1.1.1.1 tif_fax3.
--- tif_fax3.h	1998/10/12 20:47:49	1.1.1.
+++ tif_fax3.h	2000/03/22 12:32:5
@@ -1,8 +1,8 @
-/* $Id: tif_fax3.h,v 1.1.1.1 1998/10/12 20:47:49 root Exp $ *
+/* $Id: tif_fax3.h,v 1.2 1999/09/17 04:08:59 mwelles Exp $ *

 /
- * Copyright (c) 1990-1996 Sam Leffle
- * Copyright (c) 1991-1996 Silicon Graphics, Inc
+ * Copyright (c) 1990-1997 Sam Leffle
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc
  
  * Permission to use, copy, modify, distribute, and sell this software and
  * its documentation for any purpose is hereby granted without fee, provide
@@ -43,7 +43,7 @
  * The routine must have the type signature given below
  * for example
  
- * fillruns(unsigned char* buf, uint16* runs, uint16* erun, uint32 lastx
+ * fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx
  
  * where buf is place to set the bits, runs is the array of b&w ru
  * lengths (white then black), erun is the last run in the array, an
@@ -52,7 +52,7 @
  * data in the run array as needed (e.g. to append zero runs to brin
  * the count up to a nice multiple)
  *
-typedef	void (*TIFFFaxFillFunc)(unsigned char*, uint16*, uint16*, uint32)
+typedef	void (*TIFFFaxFillFunc)(unsigned char*, uint32*, uint32*, uint32)

 /
  * The default run filler; made external for other decoders
@@ -60,7 +60,7 @
 #if defined(__cplusplus
 extern "C" 
 #endi
-extern	void _TIFFFax3fillruns(unsigned char*, uint16*, uint16*, uint32)
+extern	void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32)
 #if defined(__cplusplus
 
 #endi
@@ -84,7 +84,7 @
 typedef struct {		/* state table entry *
 	unsigned char State;	/* see above *
 	unsigned char Width;	/* width of code in bits *
-	uint16	Param;		/* unsigned 16-bit run length in bits *
+	uint32	Param;		/* unsigned 32-bit run length in bits *
 } TIFFFaxTabEnt

 extern	const TIFFFaxTabEnt TIFFFaxMainTable[]



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services