[gs-cvs] rev 8816 - trunk/gs/src

giles at ghostscript.com giles at ghostscript.com
Thu Jul 3 11:25:53 PDT 2008


Author: giles
Date: 2008-07-03 11:25:52 -0700 (Thu, 03 Jul 2008)
New Revision: 8816

Modified:
   trunk/gs/src/sjpx.c
   trunk/gs/src/sjpx.h
   trunk/gs/src/sjpx_luratech.c
   trunk/gs/src/sjpx_luratech.h
Log:
Remove trailing whitespace from the jpx stream implementation.


Modified: trunk/gs/src/sjpx.c
===================================================================
--- trunk/gs/src/sjpx.c	2008-07-03 13:03:11 UTC (rev 8815)
+++ trunk/gs/src/sjpx.c	2008-07-03 18:25:52 UTC (rev 8816)
@@ -1,6 +1,6 @@
 /* Copyright (C) 2001-2006 Artifex Software, Inc.
    All Rights Reserved.
-  
+
    This software is provided AS-IS with no warranty, either express or
    implied.
 
@@ -26,8 +26,8 @@
 
 /* stream implementation */
 
-/* As with the /JBIG2Decode filter, we let the library do its own 
-   memory management through malloc() etc. and rely on our release() 
+/* As with the /JBIG2Decode filter, we let the library do its own
+   memory management through malloc() etc. and rely on our release()
    proc being called to deallocate state.
 */
 
@@ -54,7 +54,7 @@
 
     if (state->jpx_memory == NULL) {
       state->jpx_memory = ss->memory ?
-		ss->memory->non_gc_memory : 
+		ss->memory->non_gc_memory :
 		gs_lib_ctx_get_non_gc_memory_t();
     }
 
@@ -101,7 +101,7 @@
 	case JAS_CLRSPC_GENRGB: csname = "generic RGB"; break;
 	case JAS_CLRSPC_GENYCBCR: csname = "generic YCbCr"; break;
     }
-    if_debug3('w',"[w]  colorspace is %s (family %d, member %d)\n", 
+    if_debug3('w',"[w]  colorspace is %s (family %d, member %d)\n",
 	csname, jas_clrspc_fam(clrspc), jas_clrspc_mbr(clrspc));
 
     for (i = 0; i < numcmpts; i++) {
@@ -218,7 +218,7 @@
 #ifdef JPX_USE_IRT
 	q[1] = p[0] - ((p[1] + p[2])>>2);
 	q[0] = p[1] + q[1];
-	q[2] = p[2] + q[1]; 
+	q[2] = p[2] + q[1];
 #else
 	q[0] = (int)((double)p[0] + 1.402 * p[2]);
 	q[1] = (int)((double)p[0] - 0.34413 * p[1] - 0.71414 * p[2]);
@@ -268,7 +268,7 @@
         unsigned char *newbuf = NULL;
         while (newsize - state->buffill < bytes)
             newsize <<= 1;
-        newbuf = (unsigned char *)gs_malloc(state->jpx_memory, newsize, 1, 
+        newbuf = (unsigned char *)gs_malloc(state->jpx_memory, newsize, 1,
 					    "JPXDecode temp buffer");
         /* TODO: check for allocation failure */
         memcpy(newbuf, state->buffer, state->buffill);
@@ -308,7 +308,7 @@
 	}
 #ifdef JPX_USE_JASPER_CM
 	/* convert non-rgb multicomponent colorspaces to sRGB */
-	if (jas_image_numcmpts(image) > 1 && 
+	if (jas_image_numcmpts(image) > 1 &&
 	    jas_clrspc_fam(jas_image_clrspc(image)) != JAS_CLRSPC_FAM_RGB) {
 	    jas_cmprof_t *outprof;
 	    jas_image_t *rgbimage = NULL;
@@ -347,16 +347,16 @@
     long in_size = pr->limit - pr->ptr;
     long out_size = pw->limit - pw->ptr;
     int status = 0;
-    
+
     /* note that the gs stream library expects offset-by-one
        indexing of its buffers while we use zero indexing */
-       
+
     /* JasPer has its own stream library, but there's no public
-       api for handing it pieces. We need to add some plumbing 
+       api for handing it pieces. We need to add some plumbing
        to convert between gs and jasper streams. In the meantime
        just buffer the entire stream, since it can handle that
        as input. */
-    
+
     /* pass all available input to the decoder */
     if (in_size > 0) {
 	s_jpxd_buffer_input(state, pr, in_size);
@@ -411,8 +411,8 @@
             state->offset += done;
             status = (state->offset < image_size) ? 1 : 0;
         }
-    }    
-    
+    }
+
     return status;
 }
 
@@ -434,7 +434,7 @@
 
 /* set stream defaults.
    This hook exists to avoid confusing the gc with bogus
-   pointers. We also set a default for client-settable 
+   pointers. We also set a default for client-settable
    parameters like the requested output colorspace.
  */
 static void
@@ -455,10 +455,10 @@
 
 /* stream template */
 const stream_template s_jpxd_template = {
-    &st_jpxd_state, 
+    &st_jpxd_state,
     s_jpxd_init,
     s_jpxd_process,
-    1, 1, /* min in and out buffer sizes we can handle 
+    1, 1, /* min in and out buffer sizes we can handle
                      should be ~32k,64k for efficiency? */
     s_jpxd_release,
     s_jpxd_set_defaults

Modified: trunk/gs/src/sjpx.h
===================================================================
--- trunk/gs/src/sjpx.h	2008-07-03 13:03:11 UTC (rev 8815)
+++ trunk/gs/src/sjpx.h	2008-07-03 18:25:52 UTC (rev 8816)
@@ -1,6 +1,6 @@
 /* Copyright (C) 2001-2006 Artifex Software, Inc.
    All Rights Reserved.
-  
+
    This software is provided AS-IS with no warranty, either express or
    implied.
 
@@ -26,7 +26,7 @@
 /* define colorspace enumeration for the input image data */
 typedef enum {
   gs_jpx_cs_unset,  /* colorspace hasn't been set */
-  gs_jpx_cs_gray,   /* single component grayscale image */ 
+  gs_jpx_cs_gray,   /* single component grayscale image */
   gs_jpx_cs_rgb,    /* three component (s)RGB image */
   gs_jpx_cs_cmyk,   /* four component CMYK image */
   gs_jpx_cs_indexed /* PDF image wants raw index values */

Modified: trunk/gs/src/sjpx_luratech.c
===================================================================
--- trunk/gs/src/sjpx_luratech.c	2008-07-03 13:03:11 UTC (rev 8815)
+++ trunk/gs/src/sjpx_luratech.c	2008-07-03 18:25:52 UTC (rev 8816)
@@ -1,6 +1,6 @@
 /* Copyright (C) 2001-2006 Artifex Software, Inc.
    All Rights Reserved.
-  
+
    This software is provided AS-IS with no warranty, either express or
    implied.
 
@@ -13,7 +13,7 @@
 
 /* $Id$ */
 /* JPXDecode filter implementation -- hooks in the Luratech JPEG2K CSDK */
- 
+
 #include "memory_.h"
 #include "malloc_.h"
 #include "gserrors.h"
@@ -37,8 +37,8 @@
 #endif
 ***/
 
-/* As with the /JBIG2Decode filter, we let the library do its  
-   memory management through malloc() etc. and rely on our release() 
+/* As with the /JBIG2Decode filter, we let the library do its
+   memory management through malloc() etc. and rely on our release()
    proc being called to deallocate state.
 */
 
@@ -55,7 +55,7 @@
 {
     void *result = malloc(size);
 
-    return result;   
+    return result;
 }
 
 /* memory free */
@@ -70,7 +70,7 @@
 /* pass any available input to the library */
 static unsigned long JP2_Callback_Conv
 s_jpxd_read_data(unsigned char *pucData,
-			    unsigned long ulPos, unsigned long ulSize, 
+			    unsigned long ulPos, unsigned long ulSize,
 			    JP2_Callback_Param param)
 {
     stream_jpxd_state *const state = (stream_jpxd_state *) param;
@@ -138,7 +138,7 @@
 	while (new_size < state->inbuf_fill + in_size)
 	    new_size = new_size << 1;
 
-	if_debug1('s', "[s]jpxd growing input buffer to %lu bytes\n", 
+	if_debug1('s', "[s]jpxd growing input buffer to %lu bytes\n",
 		new_size);
 	new = realloc(state->inbuf, new_size);
 	if (new == NULL) return gs_error_VMerror;
@@ -165,10 +165,10 @@
 s_jpxd_init(stream_state * ss)
 {
     stream_jpxd_state *const state = (stream_jpxd_state *) ss;
- 
+
     if (state->jpx_memory == NULL) {
       state->jpx_memory = ss->memory ?
-		ss->memory->non_gc_memory : 
+		ss->memory->non_gc_memory :
 		gs_lib_ctx_get_non_gc_memory_t();
     }
 
@@ -213,7 +213,7 @@
 	if (state->handle == (JP2_Decomp_Handle)NULL) {
 	    /* initialize decompressor */
 	    err = JP2_Decompress_Start(&state->handle,
-		/* memory allocator callbacks */ 
+		/* memory allocator callbacks */
 		s_jpx_alloc, (JP2_Callback_Param)state,
 		s_jpx_free,  (JP2_Callback_Param)state,
 		/* our read callback */
@@ -242,7 +242,7 @@
 	    state->ncomp = result;
 
 	    if_debug1('w', "[w]jpxd image has %d components\n", state->ncomp);
-	
+
 	    {
 		const char *cspace = "unknown";
 		err = JP2_Decompress_GetProp(state->handle,
@@ -311,7 +311,7 @@
 		    err= JP2_Decompress_GetProp(state->handle,
 			cJP2_Prop_Signed_Samples, &result, -1, (short)comp);
 		    if (err != cJP2_Error_OK) {
-			dlprintf2("Luratech JP2 error %d decoding " 
+			dlprintf2("Luratech JP2 error %d decoding "
 				"signedness of component %d\n", (int)err, comp);
 			return ERRC;
 		    }
@@ -328,12 +328,12 @@
 		}
 	    }
 	    if_debug3('w', "[w]jpxd decoding image at %ldx%ld"
-		" with %d bits per component\n", 
+		" with %d bits per component\n",
 		state->width, state->height, state->bpc);
 
 	}
 
-	if (state->handle != (JP2_Decomp_Handle)NULL && 
+	if (state->handle != (JP2_Decomp_Handle)NULL &&
 		state->image == NULL) {
 
 	    /* allocate our output buffer */
@@ -349,7 +349,7 @@
 		return ERRC;
 	    }
 	    err = JP2_Decompress_SetProp(state->handle,
-		cJP2_Prop_Output_Function, 
+		cJP2_Prop_Output_Function,
 		(JP2_Property_Value)s_jpxd_write_data);
 	    if (err != cJP2_Error_OK) {
 		dlprintf1("Luratech JP2 error %d setting output function\n", (int)err);
@@ -399,10 +399,10 @@
 
 /* stream template */
 const stream_template s_jpxd_template = {
-    &st_jpxd_state, 
+    &st_jpxd_state,
     s_jpxd_init,
     s_jpxd_process,
-    1024, 1024,   /* min in and out buffer sizes we can handle 
+    1024, 1024,   /* min in and out buffer sizes we can handle
                      should be ~32k,64k for efficiency? */
     s_jpxd_release
 };
@@ -484,7 +484,7 @@
 	}
 	state->outbuf = new;
 	state->outsize *= 2;
-	if_debug1('s', "[s] jpxe output buffer resized to %lu bytes\n", 
+	if_debug1('s', "[s] jpxe output buffer resized to %lu bytes\n",
 		state->outsize);
     }
 
@@ -598,25 +598,25 @@
     }
 
     /* set image parameters - the same for all components */
-    err = JP2_Compress_SetProp(state->handle, 
+    err = JP2_Compress_SetProp(state->handle,
 	cJP2_Prop_Width, state->width, -1, -1);
     if (err != cJP2_Error_OK) {
 	dlprintf1("Luratech JP2 error %d setting width\n", (int)err);
 	return ERRC;
     }
-    err = JP2_Compress_SetProp(state->handle, 
+    err = JP2_Compress_SetProp(state->handle,
 	cJP2_Prop_Height, state->height, -1, -1);
     if (err != cJP2_Error_OK) {
 	dlprintf1("Luratech JP2 error %d setting height\n", (int)err);
 	return ERRC;
     }
-    err = JP2_Compress_SetProp(state->handle, 
+    err = JP2_Compress_SetProp(state->handle,
 	cJP2_Prop_Bits_Per_Sample, state->bpc, -1, -1);
     if (err != cJP2_Error_OK) {
 	dlprintf1("Luratech JP2 error %d setting bits per sample\n", (int)err);
 	return ERRC;
     }
-  
+
     switch (state->colorspace) {
 	case gs_jpx_cs_gray: value = cJP2_Colorspace_Gray; break;
 	case gs_jpx_cs_rgb: value = cJP2_Colorspace_RGBa; break;
@@ -626,7 +626,7 @@
 		(int)state->colorspace);
 	    return ERRC;
     }
-    err = JP2_Compress_SetProp(state->handle, 
+    err = JP2_Compress_SetProp(state->handle,
 	cJP2_Prop_Extern_Colorspace, value, -1, -1);
     if (err != cJP2_Error_OK) {
 	dlprintf1("Luratech JP2 error %d setting colorspace\n", (int)err);
@@ -755,7 +755,7 @@
 	if_debug1('w', "[w]jpxe Luratech JP2 error %d"
 		" closing compression context", (int)err);
     }
-    
+
     /* free our own storage */
     free(state->outbuf);
     free(state->inbuf);

Modified: trunk/gs/src/sjpx_luratech.h
===================================================================
--- trunk/gs/src/sjpx_luratech.h	2008-07-03 13:03:11 UTC (rev 8815)
+++ trunk/gs/src/sjpx_luratech.h	2008-07-03 18:25:52 UTC (rev 8816)
@@ -1,6 +1,6 @@
 /* Copyright (C) 2001-2006 Artifex Software, Inc.
    All Rights Reserved.
-  
+
    This software is provided AS-IS with no warranty, either express or
    implied.
 
@@ -26,7 +26,7 @@
 /* define colorspace enumeration for the decompressed image data */
 typedef enum {
   gs_jpx_cs_unset,  /* colorspace hasn't been set */
-  gs_jpx_cs_gray,   /* single component grayscale image */ 
+  gs_jpx_cs_gray,   /* single component grayscale image */
   gs_jpx_cs_rgb,    /* three component (s)RGB image */
   gs_jpx_cs_cmyk,   /* four component CMYK image */
   gs_jpx_cs_indexed /* PDF image wants raw index values */



More information about the gs-cvs mailing list