home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-09 | 59.8 KB | 1,715 lines |
- Newsgroups: comp.sources.misc
- From: casey@gauss.llnl.gov (Casey Leedom)
- Subject: v40i122: lic - LLNL Line Integral Convolution, v1.3, Part08/09
- Message-ID: <1993Nov9.171043.27009@sparky.sterling.com>
- X-Md4-Signature: 3847d04b957b7f087ad035bb94037638
- Sender: kent@sparky.sterling.com (Kent Landfield)
- Organization: Sterling Software
- Date: Tue, 9 Nov 1993 17:10:43 GMT
- Approved: kent@sparky.sterling.com
-
- Submitted-by: casey@gauss.llnl.gov (Casey Leedom)
- Posting-number: Volume 40, Issue 122
- Archive-name: lic/part08
- Environment: UNIX
- Supersedes: lic: Volume 38, Issue 104
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: lic.1.3/ABSTRACT lic.1.3/TODO lic.1.3/avs/WhiteNoise.c
- # lic.1.3/liblic/Destroy.c lic.1.3/liblic/LIC_ComputeImage.3
- # lic.1.3/liblic/LIC_Convolve.3 lic.1.3/liblic/LIC_Destroy.3
- # lic.1.3/liblic/LIC_Query.3 lic.1.3/liblic/Makefile.tmpl
- # lic.1.3/liblic/Modify.c lic.1.3/liblic/Query.c
- # lic.1.3/test/CircleField.c lic.1.3/test/Makefile.tmpl
- # lic.1.3/test/WhiteNoise.c
- # Wrapped by kent@sparky on Tue Nov 9 10:09:42 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 8 (of 9)."'
- if test -f 'lic.1.3/ABSTRACT' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/ABSTRACT'\"
- else
- echo shar: Extracting \"'lic.1.3/ABSTRACT'\" \(5127 characters\)
- sed "s/^X//" >'lic.1.3/ABSTRACT' <<'END_OF_FILE'
- XIdentification:
- X
- X Software Acronym: LIC
- X Software Title: Line Integral Convolution Experimental Software
- X
- X
- XAuthor Name(s) and Affiliations:
- X
- X Brian Cabral Casey Leedom
- X LLNL/Engineering LLNL/Computation
- X
- X
- XSoftware Completion Date:
- X
- X February 15, 1993
- X
- X
- XBrief Description:
- X
- X This software is an experimental implementation of a new vector
- X visualization algorithm. It allows researchers to experiment with
- X this algorithm and duplicate results presented in a paper written
- X by the authors in the 1993 SIGGRAPH conference: ``Imaging Vector
- X Fields Using Line Integral Convolution.''
- X
- X The software consists of an object-oriented library that
- X implements the algorithm, a command line interface and an AVS
- X interface and documentation for all of the above.
- X
- X
- XMethod of Solution:
- X
- X Vectors are visualized by convolving an input image along vector
- X stream lines in an input vector field. The result is an image that
- X looks like the input image, but blurred in the directions of the
- X vectors in the vector field.
- X
- X The convolution is performed for each vector field element as
- X follows: a parametric curve in the vector field is created by
- X locally following the vector field forward and backward for some
- X distance, L. The parametric curve is laid over the corresponding
- X input image pixels. This yields a pixel value function, F(s), on
- X the parametric curve. This function is convolved with a filter
- X kernel, k(s), to produce the LIC output.
- X
- X
- XComputer(s) for which software is written:
- X
- X DEC OSF1
- X HP HP-UX 8.07
- X IBM AIX 3.2
- X SGI IRIX 4.0.5
- X Sun SunOS 4.1.1
- X
- X
- XOperating System:
- X
- X POSIX 1003.1-1990.
- X
- X
- XProgramming Language(s) Used:
- X
- X ANSI C X3.159-1989.
- X
- X
- XSoftware limitations:
- X
- X All data is dynamically allocated with the C malloc() library
- X routine. The software does not handle varying image or vector
- X field types dynamically at run time. There is support for
- X compile-time specification of a limited number of image pixel
- X formats. There is only support for single precision vector fields.
- X The AVS interface only supports two-dimensional vector fields.
- X
- X
- XUnique Features of the Software:
- X
- X The software allows one to visualize very large and dense vector
- X fields. Most current vector visualization algorithms bog down
- X for large vector fields.
- X
- X
- XRelated and Auxiliary Software:
- X
- X This is the first release of this software. It does not supersede
- X any other version. It does not depend on any other software
- X systems. There are many other vector visualization algorithms
- X described in the literature.
- X
- X
- XOther Programming or Operating Information or Restrictions:
- X
- X Files in the top level directory whose names consist of all capital
- X letters are general information files and should be read before all
- X others.
- X
- X Files ending in ".c" and ".h" are ANSI C source files. Files
- X ending in ".frame" are Frame Maker source files to be processed.
- X Files ending in ".N," where N is a single digit, are troff on-line
- X manual pages to be processed with the "man" troff macro package.
- X Files whose names start with "Makefile" are part of the automatic
- X software compilation and installation system for the software.
- X
- X
- XHardware Requirements:
- X
- X No special hardware is required.
- X
- X
- XTime requirements:
- X
- X For typical two-dimensional vector fields, about 2000 vector can be
- X rendered per second on an IBM RS/6000 based machine.
- X
- X
- XReferences:
- X
- X Reference documents that are provided with this package:
- X
- X . (general info) description
- X ----------------- -----------
- X ABSTRACT .............. this file
- X CHANGES ............... catalogue of changes between releases
- X MEMO .................. memo of understanding from software authors
- X to LLNL software release office
- X README ................ overview of software and installation
- X instructions
- X TODO .................. notes about remaining work to do on
- X software
- X
- X ./liblic (manual pages) description
- X ----------------------- -----------
- X LIC.3 ................. general introduction to LIC library
- X LIC_ComputeImage.3 .... perform LIC computation on LIC object
- X LIC_Convolve.3 ........ perform LIC computation for one vector cell
- X LIC_Create.3 .......... create and initialize a LIC object
- X LIC_Destroy.3 ......... destroy a LIC object
- X LIC_Filters.3 ......... description of LIC filters
- X LIC_Modify.3 .......... modify a LIC object in various ways
- X LIC_Query.3 ........... query a LIC object and the library
- X
- X ./lic (manual pages) description
- X -------------------- -----------
- X lic.1 ................. command line interface to the LIC library
- X
- X ./avs (documentation) description
- X --------------------- -----------
- X LIC.txt ............... on-line documentation to AVS LIC module
- X
- X ./doc (documentation) description
- X --------------------- -----------
- X cover.me .............. cover page, contents, etc. for printed
- X documentation
- X siggraph .............. SIGGRAPH 1993 LIC paper
- X
- X
- XCategorization and Keywords:
- X
- X Subject Classification Code: P
- X Keywords: computer graphics, image processing
- END_OF_FILE
- if test 5127 -ne `wc -c <'lic.1.3/ABSTRACT'`; then
- echo shar: \"'lic.1.3/ABSTRACT'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/ABSTRACT'
- fi
- if test -f 'lic.1.3/TODO' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/TODO'\"
- else
- echo shar: Extracting \"'lic.1.3/TODO'\" \(3487 characters\)
- sed "s/^X//" >'lic.1.3/TODO' <<'END_OF_FILE'
- X$Header: /usr/local/src/lic/RCS/TODO,v 1.21 1993/11/05 00:19:44 casey Exp $
- X
- X
- X Unfinished work on the LLNL LIC distribution
- X
- X
- X o Implement a three-dimensional AVS module. Preferably two- and
- X three-dimensional support should be handled automatically by
- X the same module.
- X
- X o Should probably implement a means to change the number of
- X animation frames that the AVS module generates.
- X
- X o Implement Explorer module.
- X
- X o Should really report parameter errors to user instead of
- X silently correcting them. See checks for negative lengths,
- X frequencies, etc.
- X
- X o The convolve routines do almost no parameter checking. In
- X particular, no check is made to make sure i, j and k are in
- X the correct ranges. Should probably do this by moving some
- X range checking code from the bottom of the main loop to the
- X top rather than introducing yet more code the wade through,
- X but don't have time to think about how best to do this and
- X test the results.
- X
- X o Should port the parallel code to more platforms. Should implement
- X a much more intelligent tiling in liblic/ComputeImage.c. Right now
- X it just stupidly breaks the task into row stripes -- even for
- X three-dimensional fields.
- X
- X o Really need a better way of determining when to provide progress
- X reports to the user. Currently we just do it 10% of the rows
- X that we process. You'd kind of like it to be semi-dynamic
- X with reports being made every, say, 10% or 60 seconds,
- X whichever was shorter. But this is just a simple hack after
- X all ...
- X
- X o Probably need to make the number of ``speeds'' be variable.
- X Also want the number of integral tables allocated and built to
- X be limited to 1 when variable speed is turned off. Finally,
- X it might be nice to expose the VariableSpeed frequency scaling
- X factor used in LIC_Ripple. LIC_Ripple scales the ripple filter
- X frequency inversely with vector magnitude. It's currently
- X hardwired to map maximum to 0 vectors to scale factors of 1.0
- X and 6.0, respectively.
- X
- X o Should probably expose SIN_PARALLEL as a user specifiable
- X parameter. (SIN_PARALLEL is the sin(w) of some small angle w.
- X It is used in the convolution LIC path advection code to
- X determine whether a vector is ``parallel'' to a vector cell
- X edge or face.) Might also want to expose the maximum loop
- X count factor of the inner convolution loop -- it's currently
- X 3 * Length.
- X
- X o Implement image and vector field formatting handling
- X dynamically at run time. Currently only compile time support
- X for image pixel types is supported. There is only support for
- X single precision vector fields.
- X
- X o There are too many parameters to LIC_Create. There are also
- X simultaneously too few and too many LIC_ChangeFoo routines.
- X There are too few because we really want to expose all the LIC
- X knobs to the user, but there are too many because they're
- X proliferating like rabbits. Probably something more along the
- X lines of XtVaSetArgs is what we really want.
- X
- X o LIC_Image and LIC_VectorField should have a set of methods put
- X together to create, modify, query and destroy them. That
- X would help clean up the horrible parameter mess that
- X LIC_Create has become.
- X
- X o The LIC_Filter type should be yet another object type that not
- X only keeps a pointer to the filter kernel integral function,
- X but also keeps track of any special filter specific
- X parameters.
- X
- X o Should we implement a routine that makes it easy to reissue a
- X convolution on the output of a previous convolution?
- X
- END_OF_FILE
- if test 3487 -ne `wc -c <'lic.1.3/TODO'`; then
- echo shar: \"'lic.1.3/TODO'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/TODO'
- fi
- if test -f 'lic.1.3/avs/WhiteNoise.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/avs/WhiteNoise.c'\"
- else
- echo shar: Extracting \"'lic.1.3/avs/WhiteNoise.c'\" \(4858 characters\)
- sed "s/^X//" >'lic.1.3/avs/WhiteNoise.c' <<'END_OF_FILE'
- X/*
- X * $Header: /usr/local/src/lic/avs/RCS/WhiteNoise.c,v 1.3 1993/11/04 06:33:17 casey Exp $
- X */
- X
- X/*
- X * Copyright (c) 1993 The Regents of the University of California.
- X * All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by the University of
- X * California, Lawrence Livermore National Laboratory and its
- X * contributors.
- X * 4. Neither the name of the University nor the names of its contributors
- X * may be used to endorse or promote products derived from this software
- X * without specific prior written permission.
- X *
- X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X * SUCH DAMAGE.
- X */
- X
- X#ifndef lint
- X static char rcsid[] = "$Header: /usr/local/src/lic/avs/RCS/WhiteNoise.c,v 1.3 1993/11/04 06:33:17 casey Exp $";
- X static char copyright[] =
- X "Copyright (c) 1993 The Regents of the University of California.\n"
- X "All rights reserved.\n";
- X#endif
- X
- X
- X#include <stdlib.h>
- X#include <unistd.h>
- X
- X#include <avs/avs.h>
- X#include <avs/field.h>
- X#include <avs/port.h>
- X
- X
- X/*
- X * Local support routines.
- X */
- Xstatic int DescribeModule(void);
- Xstatic int WhiteNoise(AVSfield_char **output_image,
- X int Xres,
- X int Yres,
- X int Zres);
- X
- X
- Xint
- XAVSinit_modules()
- X /*
- X * Initialization for modules contained in this file.
- X */
- X{
- X static int ((*mod_list[])()) =
- X {
- X DescribeModule,
- X };
- X
- X AVSinit_from_module_list(mod_list,
- X (sizeof(mod_list) / sizeof(mod_list[0])));
- X return(1);
- X}
- X
- X
- Xstatic int
- XDescribeModule(void)
- X /*
- X * Module Description
- X */
- X{
- X /* Set the name of the module */
- X AVSset_module_name("White noise", MODULE_DATA);
- X
- X /* Create an input port for the required field input */
- X AVScreate_output_port("Output Image", "field 3D 4-vector 2-space byte");
- X
- X /* Create a bounded integer parameter, and tie it to a widget */
- X AVSconnect_widget(AVSadd_parameter("Xres", "integer", 256, 0, 10000),
- X "typein_integer");
- X AVSconnect_widget(AVSadd_parameter("Yres", "integer", 256, 0, 10000),
- X "typein_integer");
- X AVSconnect_widget(AVSadd_parameter("Zres", "integer", 1, 0, 10000),
- X "typein_integer");
- X
- X /* Set the callback for each time this module gets executed */
- X AVSset_compute_proc(WhiteNoise);
- X
- X return(1);
- X}
- X
- X
- Xstatic int
- XWhiteNoise(AVSfield_char **output_image,
- X int Xres,
- X int Yres,
- X int Zres)
- X /*
- X * Module Compute Routine
- X */
- X{
- X register int i, j, k;
- X int dims[3];
- X float min_extent[3], max_extent[3];
- X
- X /* Set dimensions */
- X dims[0] = Xres;
- X dims[1] = Yres;
- X dims[2] = Zres;
- X
- X /* Allocate space for image data */
- X *output_image =
- X (AVSfield_char *)AVSdata_alloc("field 3D 4-vector 2-space byte", dims);
- X
- X /* Set the labels for each component */
- X AVSfield_set_labels((AVSfield *)*output_image, "alpha;red;green;blue", ";");
- X
- X /* Set the extent for the image */
- X min_extent[0] = 0.0; max_extent[0] = Xres - 1.0;
- X min_extent[1] = 0.0; max_extent[1] = Yres - 1.0;
- X min_extent[2] = 0.0; max_extent[2] = Zres - 1.0;
- X AVSfield_set_extent((AVSfield *)*output_image, min_extent, max_extent);
- X
- X srand(98639);
- X for (k = 0; k < Zres; k++)
- X for (j = 0; j < Yres; j++)
- X for (i = 0; i < Xres; i++)
- X {
- X register unsigned char r = rand() & 255;
- X
- X I3DV(*output_image, i, j, k)[0] = 0;
- X I3DV(*output_image, i, j, k)[1] = r;
- X I3DV(*output_image, i, j, k)[2] = r;
- X I3DV(*output_image, i, j, k)[3] = r;
- X }
- X return(1);
- X}
- END_OF_FILE
- if test 4858 -ne `wc -c <'lic.1.3/avs/WhiteNoise.c'`; then
- echo shar: \"'lic.1.3/avs/WhiteNoise.c'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/avs/WhiteNoise.c'
- fi
- if test -f 'lic.1.3/liblic/Destroy.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/liblic/Destroy.c'\"
- else
- echo shar: Extracting \"'lic.1.3/liblic/Destroy.c'\" \(2412 characters\)
- sed "s/^X//" >'lic.1.3/liblic/Destroy.c' <<'END_OF_FILE'
- X/*
- X * $Header: /usr/local/src/lic/liblic/RCS/Destroy.c,v 1.1 1993/05/18 17:01:31 casey Exp $
- X */
- X
- X/*
- X * Copyright (c) 1993 The Regents of the University of California.
- X * All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by the University of
- X * California, Lawrence Livermore National Laboratory and its
- X * contributors.
- X * 4. Neither the name of the University nor the names of its contributors
- X * may be used to endorse or promote products derived from this software
- X * without specific prior written permission.
- X *
- X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X * SUCH DAMAGE.
- X */
- X
- X#ifndef lint
- X static char rcsid[] = "$Header: /usr/local/src/lic/liblic/RCS/Destroy.c,v 1.1 1993/05/18 17:01:31 casey Exp $";
- X static char copyright[] =
- X "Copyright (c) 1993 The Regents of the University of California.\n"
- X "All rights reserved.\n";
- X#endif
- X
- X
- X#include "liblic.h"
- X
- X
- Xvoid
- XLIC_Destroy(LIC *This)
- X{
- X if (!This->Normalized)
- X free(This->NormalField.data);
- X if (This->FreeOutput)
- X free(This->OutputImage.data);
- X free(This);
- X}
- END_OF_FILE
- if test 2412 -ne `wc -c <'lic.1.3/liblic/Destroy.c'`; then
- echo shar: \"'lic.1.3/liblic/Destroy.c'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/liblic/Destroy.c'
- fi
- if test -f 'lic.1.3/liblic/LIC_ComputeImage.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/liblic/LIC_ComputeImage.3'\"
- else
- echo shar: Extracting \"'lic.1.3/liblic/LIC_ComputeImage.3'\" \(4361 characters\)
- sed "s/^X//" >'lic.1.3/liblic/LIC_ComputeImage.3' <<'END_OF_FILE'
- X.\" Copyright (c) 1993 The Regents of the University of California.
- X.\" All rights reserved.
- X.\"
- X.\" Redistribution and use in source and binary forms, with or without
- X.\" modification, are permitted provided that the following conditions
- X.\" are met:
- X.\" 1. Redistributions of source code must retain the above copyright
- X.\" notice, this list of conditions and the following disclaimer.
- X.\" 2. Redistributions in binary form must reproduce the above copyright
- X.\" notice, this list of conditions and the following disclaimer in the
- X.\" documentation and/or other materials provided with the distribution.
- X.\" 3. All advertising materials mentioning features or use of this software
- X.\" must display the following acknowledgement:
- X.\" This product includes software developed by the University of
- X.\" California, Lawrence Livermore National Laboratory and its
- X.\" contributors.
- X.\" 4. Neither the name of the University nor the names of its contributors
- X.\" may be used to endorse or promote products derived from this software
- X.\" without specific prior written permission.
- X.\"
- X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X.\" SUCH DAMAGE.
- X.\"
- X.de Hd
- X.ds Dt \\$4
- X..
- X.Hd $Header: /usr/local/src/lic/liblic/RCS/LIC_ComputeImage.3,v 1.5 1993/11/03 20:16:11 casey Exp $
- X.TH LIC_COMPUTEIMAGE 3 \*(Dt
- X.SH NAME
- XLIC_ComputeImage \- compute image using Line Integral Convolution
- X.SH SYNOPSIS
- X.nf
- X#include <lic.h>
- X
- Xvoid \fBLIC_ComputeImage\fP(LIC *\fIThis\fP)
- X
- Xint \fBLIC_NumThreads\fP(LIC *\fIThis\fP)
- Xvoid \fBLIC_ChangeNumThreads\fP(LIC *\fIThis\fP, int \fIthreads\fP)
- X.fi
- X.SH DESCRIPTION
- X.B LIC_ComputeImage
- Xcalls the appropriate Line Integral Convolution method for each input
- Xvector field cell and deposits the normalized results into the output image.
- X.PP
- XFor each cell,
- X.B LIC_ComputeImage
- Xcalls the appropriate convolution method twice: once to compute the partial LIC
- Xfor the positive vector field direction and once for the negative direction.
- XThe two partial results are summed and normalized by the summed normalization
- Xfactors.
- X.PP
- XCurrently two- and three-dimensional versions of Line Integral Convolution
- Xare implemented.
- X.B LIC_ComputeImage
- Xcalls one of
- X.BR LIC_Convolve2D (3)
- Xor
- X.BR LIC_Convolve3D (3)
- Xdepending on the Z depth of the input vector field.
- X.PP
- X.B LIC_NumThreads
- Xreturns the number of parallel threads that will be used by
- X.BR LIC_ComputeImage .
- XA
- X.B 0
- Xindicates that the maximum number of CPUs available for parallel
- Xprocessing on the current system will be used.
- X.PP
- X.B LIC_ChangeNumThreads
- Xspecifies the number of parallel threads that should be used by
- X.BR LIC_ComputeImage (3).
- XAs above, if a
- X.B 0
- Xis specified, the maximum number of CPUs available for parallel
- Xprocessing on the current system will be used. Note that parallel
- Xprocessing support is not available on all systems. If a value other
- Xthan
- X.B 1
- Xis specified on a system which does not support parallel processing, a
- Xwarning will be issued via
- X.I ReportError
- Xand calculations will execute single threaded.
- X.PP
- XNote that if the computation partioning selected by
- X.B LIC_ComputeImage
- Xgenerates fewer partitions than the number of threads requested,
- Xparallelism will be restricted to the number of partitions.
- XCurrently,
- X.B LIC_ComputeImage
- Xpartitions the computation by having each thread execute a row stripe.
- XThus, the maximum number of parallel threads is limited to the number
- Xof rows in the input vector field. A more intelligent partitioning
- Xscheme is probably needed ...
- X.SH "SEE ALSO"
- X.BR LIC (3),
- X.BR LIC_Convolve (3)
- X.SH STANDARDS
- XThis is unsupported, non-standard software. It is not the subject of any
- Xstandards effort.
- END_OF_FILE
- if test 4361 -ne `wc -c <'lic.1.3/liblic/LIC_ComputeImage.3'`; then
- echo shar: \"'lic.1.3/liblic/LIC_ComputeImage.3'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/liblic/LIC_ComputeImage.3'
- fi
- if test -f 'lic.1.3/liblic/LIC_Convolve.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/liblic/LIC_Convolve.3'\"
- else
- echo shar: Extracting \"'lic.1.3/liblic/LIC_Convolve.3'\" \(4826 characters\)
- sed "s/^X//" >'lic.1.3/liblic/LIC_Convolve.3' <<'END_OF_FILE'
- X.\" Copyright (c) 1993 The Regents of the University of California.
- X.\" All rights reserved.
- X.\"
- X.\" Redistribution and use in source and binary forms, with or without
- X.\" modification, are permitted provided that the following conditions
- X.\" are met:
- X.\" 1. Redistributions of source code must retain the above copyright
- X.\" notice, this list of conditions and the following disclaimer.
- X.\" 2. Redistributions in binary form must reproduce the above copyright
- X.\" notice, this list of conditions and the following disclaimer in the
- X.\" documentation and/or other materials provided with the distribution.
- X.\" 3. All advertising materials mentioning features or use of this software
- X.\" must display the following acknowledgement:
- X.\" This product includes software developed by the University of
- X.\" California, Lawrence Livermore National Laboratory and its
- X.\" contributors.
- X.\" 4. Neither the name of the University nor the names of its contributors
- X.\" may be used to endorse or promote products derived from this software
- X.\" without specific prior written permission.
- X.\"
- X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X.\" SUCH DAMAGE.
- X.\"
- X.de Hd
- X.ds Dt \\$4
- X..
- X.Hd $Header: /usr/local/src/lic/liblic/RCS/LIC_Convolve.3,v 1.3 1993/10/26 18:25:38 casey Exp $
- X.TH LIC_CONVOLVE 3 \*(Dt
- X.SH NAME
- XLIC_Convolve2D, LIC_Convolve3D \- Line Integral Convolution engines
- X.SH SYNOPSIS
- X.nf
- X#include <lic.h>
- X
- X.ta \w'LIC *\fBLIC_Convolve2D\fP('u +\w'doubleXXX'u
- Xvoid \fBLIC_Convolve2D\fP(LIC *\fIThis\fP,
- X.ta \w'LIC *\fBLIC_Convolve2D\fP('u +\w'doubleXXX*'u
- X int \fIi\fP,
- X int \fIj\fP,
- X int \fIdirection\fP,
- X.ta \w'LIC *\fBLIC_Convolve2D\fP('u +\w'doubleXXX'u
- X double *\fIrIntegral\fP,
- X double *\fIgIntegral\fP,
- X double *\fIbIntegral\fP,
- X double *\fIaIntegral\fP,
- X double *\fIKernelArea\fP)
- X.DT
- X
- X.ta \w'LIC *\fBLIC_Convolve3D\fP('u +\w'doubleXXX'u
- Xvoid \fBLIC_Convolve3D\fP(LIC *\fIThis\fP,
- X.ta \w'LIC *\fBLIC_Convolve3D\fP('u +\w'doubleXXX*'u
- X int \fIi\fP,
- X int \fIj\fP,
- X int \fIk\fP,
- X int \fIdirection\fP,
- X.ta \w'LIC *\fBLIC_Convolve3D\fP('u +\w'doubleXXX'u
- X double *\fIrIntegral\fP,
- X double *\fIgIntegral\fP,
- X double *\fIbIntegral\fP,
- X double *\fIaIntegral\fP,
- X double *\fIKernelArea\fP)
- X.DT
- X.fi
- X.SH DESCRIPTION
- X.B LIC_Convolve2D
- Xand
- X.B LIC_Convolve3D
- Xperform the Line Integral Convolution algorithm for two and three dimensions,
- Xrespectively.
- X.IR i ,
- X.I j
- Xand
- X.I k
- Xrepresent the position within the vector field to image. They are
- Xzero-based indexes referencing columns, rows and planes, respectively.
- X(Note that this is the opposite of traditional usage of \*(lq\fBi\fP\*(rq
- Xand \*(lq\fBj\fP\*(rq in matrix coordinates.)
- X.PP
- X.I direction
- Xcontrols whether the LIC follows the vector field foreward along vector
- Xfield lines,
- X.BR LIC_FOREWARD ,
- Xor backward along the negative of vector field lines,
- X.BR LIC_BACKWARD .
- X.PP
- X.IR rIntegral ,
- X.IR gIntegral ,
- X.I bIntegral
- Xand
- X.I aIntegral
- Xare value return parameters. On return from the convolution routine, they
- Xwill hold the red, green, blue and alpha LIC sums, respectively. These
- Xsums represent the convolution of the LIC filter,
- X.IR k(s) ,
- Xwith the pixel values,
- X.IR F(s) ,
- Xalong the LIC path.
- X.PP
- X.I KernelArea
- Xis a value return parameter. On return from the convolution routine,
- Xit will hold the area (integral) of the filter kernel for the
- Xconvolution. For variable normalization (see
- X.BR LIC_Create )
- Xonly the area under the portion of the filter kernel actually used in
- Xthe convolution will be returned. For fixed normalization the area
- Xreturned will be for the entire filter kernel corresponding to
- X.IR direction .
- XThese will differ when the LIC path is prematurely terminated due to a vector
- Xfield singularity or running off the edge of the vector field.
- X.SH "SEE ALSO"
- X.BR LIC (3),
- X.BR LIC_ComputeImage (3)
- X.SH BUGS
- XIf
- X.IR i ,
- X.I j
- Xor
- X.I k
- Xare out of range (less than 0 or greater than or equal to their corresponding
- Xdimension size), the most likely outcome will be a segmentation fault. This
- Xshould probably be fixed ...
- X.SH STANDARDS
- XThis is unsupported, non-standard software. It is not the subject of any
- Xstandards effort.
- END_OF_FILE
- if test 4826 -ne `wc -c <'lic.1.3/liblic/LIC_Convolve.3'`; then
- echo shar: \"'lic.1.3/liblic/LIC_Convolve.3'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/liblic/LIC_Convolve.3'
- fi
- if test -f 'lic.1.3/liblic/LIC_Destroy.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/liblic/LIC_Destroy.3'\"
- else
- echo shar: Extracting \"'lic.1.3/liblic/LIC_Destroy.3'\" \(2571 characters\)
- sed "s/^X//" >'lic.1.3/liblic/LIC_Destroy.3' <<'END_OF_FILE'
- X.\" Copyright (c) 1993 The Regents of the University of California.
- X.\" All rights reserved.
- X.\"
- X.\" Redistribution and use in source and binary forms, with or without
- X.\" modification, are permitted provided that the following conditions
- X.\" are met:
- X.\" 1. Redistributions of source code must retain the above copyright
- X.\" notice, this list of conditions and the following disclaimer.
- X.\" 2. Redistributions in binary form must reproduce the above copyright
- X.\" notice, this list of conditions and the following disclaimer in the
- X.\" documentation and/or other materials provided with the distribution.
- X.\" 3. All advertising materials mentioning features or use of this software
- X.\" must display the following acknowledgement:
- X.\" This product includes software developed by the University of
- X.\" California, Lawrence Livermore National Laboratory and its
- X.\" contributors.
- X.\" 4. Neither the name of the University nor the names of its contributors
- X.\" may be used to endorse or promote products derived from this software
- X.\" without specific prior written permission.
- X.\"
- X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X.\" SUCH DAMAGE.
- X.\"
- X.de Hd
- X.ds Dt \\$4
- X..
- X.Hd $Header: /usr/local/src/lic/liblic/RCS/LIC_Destroy.3,v 1.1 1993/05/27 20:18:46 casey Exp $
- X.TH LIC_DESTROY 3 \*(Dt
- X.SH NAME
- XLIC_Destroy \- destroy Line Integral Convolution object instance
- X.SH SYNOPSIS
- X.nf
- X#include <lic.h>
- X
- Xvoid \fBLIC_Destroy\fP(LIC *\fIThis\fP)
- X.fi
- X.SH DESCRIPTION
- X.B LIC_Destroy
- Xdestroys a LIC instance pointed to by
- X.IR This .
- XThe LIC instance must previously have been instantiated via
- X.BR LIC_Create .
- XAny resources allocated to the LIC instance will be freed up by
- X.BR LIC_Destroy .
- X.SH "SEE ALSO"
- X.BR LIC (3),
- X.BR LIC_Create (3)
- X.SH STANDARDS
- XThis is unsupported, non-standard software. It is not the subject of any
- Xstandards effort.
- END_OF_FILE
- if test 2571 -ne `wc -c <'lic.1.3/liblic/LIC_Destroy.3'`; then
- echo shar: \"'lic.1.3/liblic/LIC_Destroy.3'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/liblic/LIC_Destroy.3'
- fi
- if test -f 'lic.1.3/liblic/LIC_Query.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/liblic/LIC_Query.3'\"
- else
- echo shar: Extracting \"'lic.1.3/liblic/LIC_Query.3'\" \(3646 characters\)
- sed "s/^X//" >'lic.1.3/liblic/LIC_Query.3' <<'END_OF_FILE'
- X.\" Copyright (c) 1993 The Regents of the University of California.
- X.\" All rights reserved.
- X.\"
- X.\" Redistribution and use in source and binary forms, with or without
- X.\" modification, are permitted provided that the following conditions
- X.\" are met:
- X.\" 1. Redistributions of source code must retain the above copyright
- X.\" notice, this list of conditions and the following disclaimer.
- X.\" 2. Redistributions in binary form must reproduce the above copyright
- X.\" notice, this list of conditions and the following disclaimer in the
- X.\" documentation and/or other materials provided with the distribution.
- X.\" 3. All advertising materials mentioning features or use of this software
- X.\" must display the following acknowledgement:
- X.\" This product includes software developed by the University of
- X.\" California, Lawrence Livermore National Laboratory and its
- X.\" contributors.
- X.\" 4. Neither the name of the University nor the names of its contributors
- X.\" may be used to endorse or promote products derived from this software
- X.\" without specific prior written permission.
- X.\"
- X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X.\" SUCH DAMAGE.
- X.\"
- X.de Hd
- X.ds Dt \\$4
- X..
- X.Hd $Header: /usr/local/src/lic/liblic/RCS/LIC_Query.3,v 1.1 1993/05/27 20:18:46 casey Exp $
- X.TH LIC_QUERY 3 \*(Dt
- X.SH NAME
- XLIC_Query \- request information on LIC object instances and the library
- X.SH SYNOPSIS
- X.nf
- X#include <lic.h>
- X
- Xunsigned char *\fBLIC_InputImage\fP(LIC *\fIThis\fP)
- Xfloat *\fBLIC_InputField\fP(LIC *\fIThis\fP)
- Xunsigned char *\fBLIC_OutputImage\fP(LIC *\fIThis\fP)
- X
- Xdouble \fBLIC_Length\fP(LIC *\fIThis\fP)
- Xdouble \fBLIC_Phase\fP(LIC *\fIThis\fP)
- Xdouble \fBLIC_Frequency\fP(LIC *\fIThis\fP)
- X
- Xchar *\fBLIC_ConfiguredPixelType\fP(void)
- Xint \fBLIC_ConfiguredPixelSize\fP(void)
- X.fi
- X.SH DESCRIPTION
- X.BR LIC_InputImage ,
- X.B LIC_InputField
- Xand
- X.B LIC_OutputImage
- Xreturn pointers to the input image, input vector field and output image,
- Xrespectively.
- X.BR LIC_Length ,
- X.B LIC_Phase
- Xand
- X.B LIC_Frequency
- Xreturn the current filter kernel length, phase and frequency, respectively.
- X.PP
- X.B LIC_ConfiguredPixelType
- Xreturns a pointer to a character string representation of the pixel type
- Xconfigured into the LIC library.
- X.B LIC_ConfiguredPixelSize
- Xreturns the size in bytes of pixel values configured into the LIC library.
- X.PP
- XReturn values from
- X.B LIC_ConfiguredPixelType and LIC_ConfiguredPixelSize are:
- X.PP
- X.RS
- X.nf
- X.ta \w'MONOCHROMEXXX'u
- X.I Type Size
- X\fBMONOCHROME\fP 1
- X\fBRGB\fP 3
- X\fBBGR\fP 3
- X\fBRGBA\fP 4
- X\fBBGRA\fP 4
- X\fBARGB\fP 4
- X\fBABGR\fP 4
- X.DT
- X.fi
- X.RE
- X.SH "SEE ALSO"
- X.BR LIC (3),
- X.BR LIC_Create (3),
- X.BR LIC_Destroy (3),
- X.BR LIC_Modify (3)
- X.SH BUGS
- XNeither
- X.B LIC_ConfiguredPixelType
- Xnor
- X.BR LIC_ConfiguredPixelSize .
- Xshould be necessary. Such issues should be handled dynamically at run-time
- Xinstead of compile-time.
- X.SH STANDARDS
- XThis is unsupported, non-standard software. It is not the subject of any
- Xstandards effort.
- END_OF_FILE
- if test 3646 -ne `wc -c <'lic.1.3/liblic/LIC_Query.3'`; then
- echo shar: \"'lic.1.3/liblic/LIC_Query.3'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/liblic/LIC_Query.3'
- fi
- if test -f 'lic.1.3/liblic/Makefile.tmpl' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/liblic/Makefile.tmpl'\"
- else
- echo shar: Extracting \"'lic.1.3/liblic/Makefile.tmpl'\" \(1830 characters\)
- sed "s/^X//" >'lic.1.3/liblic/Makefile.tmpl' <<'END_OF_FILE'
- X#
- X# $Header: /usr/local/src/lic/liblic/RCS/Makefile.tmpl,v 1.9 1993/10/26 18:26:14 casey Exp $
- X#
- X DEFINES = $(IMAGE_DEFINES) $(MPC_DEFINES)
- X
- X HDRS = liblic.h
- X SRCS = ComputeImage.c Convolve2D.c Convolve3D.c Create.c Destroy.c \
- X Filters.c Modify.c Query.c
- X OBJS = ComputeImage.o Convolve2D.o Convolve3D.o Create.o Destroy.o \
- X Filters.o Modify.o Query.o
- X LIBRARY = liblic.a
- X MANS = LIC.3 LIC_ComputeImage.3 LIC_Convolve.3 LIC_Create.3 \
- X LIC_Destroy.3 LIC_Filters.3 LIC_Modify.3 LIC_Query.3
- X
- X ALL = $(LIBRARY)
- X
- Xall: $(ALL)
- X
- X$(LIBRARY): $(OBJS)
- X rm -f $@
- X $(AR) $@ $(OBJS)
- X $(RANLIB) $(LIBRARY)
- X
- Xinstall: $(LIBRARY) $(LIBDIR) install_$(MANINSTALL)
- X rm -f $(LIBDIR)/$(LIBRARY)
- X cp $(LIBRARY) $(LIBDIR)/$(LIBRARY)
- X $(RANLIB) $(LIBDIR)/$(LIBRARY)
- X chmod $(INSTLIBPROT) $(LIBDIR)/$(LIBRARY)
- X
- Xinstall_man: $(MANROOT) $(MAN3DIR)
- X @set -x; \
- X for i in $(MANS); do \
- X m=$(MAN3DIR)/`basename $$i .3`.$(MAN3EXT); \
- X rm -f $$m; \
- X cp $$i $$m; \
- X chmod $(INSTMANPROT) $$m; \
- X done
- X
- Xinstall_cat: $(MANROOT) $(MAN3DIR)
- X @set -x; \
- X for i in $(MANS); do \
- X m=$(MAN3DIR)/`basename $$i .3`.$(MAN3EXT); \
- X rm -f $$m; \
- X $(NROFF) -man $$i > $$m; \
- X chmod $(INSTMANPROT) $$m; \
- X done
- X
- Xinstall_none:
- X
- X$(LIBDIR) $(MANROOT) $(MAN3DIR):
- X mkdir $@
- X
- Xclean:
- X rm -f $(LIBRARY) $(OBJS)
- X rm -f *~ *.o core a.out MAKELOG
- X
- Xlint:
- X
- Xtags:
- X
- Xdepend:
- X
- XComputeImage.o: ComputeImage.c liblic.h $(BUILDINCTOP)/lic.h
- XConvolve2D.o: Convolve2D.c liblic.h $(BUILDINCTOP)/lic.h
- XConvolve3D.o: Convolve3D.c liblic.h $(BUILDINCTOP)/lic.h
- XCreate.o: Create.c liblic.h $(BUILDINCTOP)/lic.h
- XDestroy.o: Destroy.c liblic.h $(BUILDINCTOP)/lic.h
- XFilters.o: Filters.c liblic.h $(BUILDINCTOP)/lic.h
- XModify.o: Modify.c liblic.h $(BUILDINCTOP)/lic.h
- XQuery.o: Query.c liblic.h $(BUILDINCTOP)/lic.h
- END_OF_FILE
- if test 1830 -ne `wc -c <'lic.1.3/liblic/Makefile.tmpl'`; then
- echo shar: \"'lic.1.3/liblic/Makefile.tmpl'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/liblic/Makefile.tmpl'
- fi
- if test -f 'lic.1.3/liblic/Modify.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/liblic/Modify.c'\"
- else
- echo shar: Extracting \"'lic.1.3/liblic/Modify.c'\" \(3421 characters\)
- sed "s/^X//" >'lic.1.3/liblic/Modify.c' <<'END_OF_FILE'
- X/*
- X * $Header: /usr/local/src/lic/liblic/RCS/Modify.c,v 1.7 1993/11/03 20:16:31 casey Exp $
- X */
- X
- X/*
- X * Copyright (c) 1993 The Regents of the University of California.
- X * All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by the University of
- X * California, Lawrence Livermore National Laboratory and its
- X * contributors.
- X * 4. Neither the name of the University nor the names of its contributors
- X * may be used to endorse or promote products derived from this software
- X * without specific prior written permission.
- X *
- X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X * SUCH DAMAGE.
- X */
- X
- X#ifndef lint
- X static char rcsid[] = "$Header: /usr/local/src/lic/liblic/RCS/Modify.c,v 1.7 1993/11/03 20:16:31 casey Exp $";
- X static char copyright[] =
- X "Copyright (c) 1993 The Regents of the University of California.\n"
- X "All rights reserved.\n";
- X#endif
- X
- X
- X#include "liblic.h"
- X
- X
- X/*
- X * Change various features of LIC instances.
- X * =========================================
- X */
- X
- X
- Xvoid
- XLIC_ChangeLength(LIC *This, double length)
- X /*
- X * Change the length of the filter kernel.
- X */
- X{
- X if (length < 0.0)
- X {
- X length = 0.0;
- X if (This->ReportError)
- X This->ReportError("LIC_ChangeLength: length must be greater than"
- X " or equal to 0.0 -- using 0.0");
- X }
- X This->Length = length;
- X This->NeedIntegration = TRUE;
- X}
- X
- X
- Xvoid
- XLIC_ChangePhase(LIC *This, double phase)
- X /*
- X * Change the phase of the filter kernel.
- X */
- X{
- X This->Phase = phase;
- X This->NeedIntegration = TRUE;
- X}
- X
- X
- Xvoid
- XLIC_ChangeFrequency(LIC *This, double frequency)
- X /*
- X * Change the frequency of the filter kernel.
- X */
- X{
- X if (frequency < 0.0)
- X {
- X frequency = 1e-6;
- X if (This->ReportError)
- X This->ReportError("LIC_ChangeFrequency: frequency must be greater"
- X " than 0.0 -- using 1e-6");
- X }
- X This->Frequency = frequency;
- X This->NeedIntegration = TRUE;
- X}
- X
- X
- Xvoid
- XLIC_ChangeFilter(LIC *This, LIC_Filter filter)
- X /*
- X * Change the filter kernel.
- X */
- X{
- X This->Filter = filter;
- X This->NeedIntegration = TRUE;
- X}
- END_OF_FILE
- if test 3421 -ne `wc -c <'lic.1.3/liblic/Modify.c'`; then
- echo shar: \"'lic.1.3/liblic/Modify.c'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/liblic/Modify.c'
- fi
- if test -f 'lic.1.3/liblic/Query.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/liblic/Query.c'\"
- else
- echo shar: Extracting \"'lic.1.3/liblic/Query.c'\" \(2365 characters\)
- sed "s/^X//" >'lic.1.3/liblic/Query.c' <<'END_OF_FILE'
- X/*
- X * $Header: /usr/local/src/lic/liblic/RCS/Query.c,v 1.1 1993/05/18 17:01:31 casey Exp $
- X */
- X
- X/*
- X * Copyright (c) 1993 The Regents of the University of California.
- X * All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by the University of
- X * California, Lawrence Livermore National Laboratory and its
- X * contributors.
- X * 4. Neither the name of the University nor the names of its contributors
- X * may be used to endorse or promote products derived from this software
- X * without specific prior written permission.
- X *
- X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X * SUCH DAMAGE.
- X */
- X
- X#ifndef lint
- X static char rcsid[] = "$Header: /usr/local/src/lic/liblic/RCS/Query.c,v 1.1 1993/05/18 17:01:31 casey Exp $";
- X static char copyright[] =
- X "Copyright (c) 1993 The Regents of the University of California.\n"
- X "All rights reserved.\n";
- X#endif
- X
- X
- X#include "liblic.h"
- X
- X
- Xint
- XLIC_ConfiguredPixelSize(void)
- X{
- X return(PixelSize);
- X}
- X
- X
- Xconst char *
- XLIC_ConfiguredPixelType(void)
- X{
- X return(PixelType);
- X}
- END_OF_FILE
- if test 2365 -ne `wc -c <'lic.1.3/liblic/Query.c'`; then
- echo shar: \"'lic.1.3/liblic/Query.c'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/liblic/Query.c'
- fi
- if test -f 'lic.1.3/test/CircleField.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/test/CircleField.c'\"
- else
- echo shar: Extracting \"'lic.1.3/test/CircleField.c'\" \(4807 characters\)
- sed "s/^X//" >'lic.1.3/test/CircleField.c' <<'END_OF_FILE'
- X/*
- X * $Header: /usr/local/src/lic/test/RCS/CircleField.c,v 1.5 1993/11/05 01:43:30 casey Exp $
- X */
- X
- X/*
- X * Copyright (c) 1993 The Regents of the University of California.
- X * All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by the University of
- X * California, Lawrence Livermore National Laboratory and its
- X * contributors.
- X * 4. Neither the name of the University nor the names of its contributors
- X * may be used to endorse or promote products derived from this software
- X * without specific prior written permission.
- X *
- X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X * SUCH DAMAGE.
- X */
- X
- X#ifndef lint
- X static char rcsid[] = "$Header: /usr/local/src/lic/test/RCS/CircleField.c,v 1.5 1993/11/05 01:43:30 casey Exp $";
- X static char copyright[] =
- X "Copyright (c) 1993 The Regents of the University of California.\n"
- X "All rights reserved.\n";
- X#endif
- X
- X
- X#include <stdlib.h>
- X#include <unistd.h>
- X#include <errno.h>
- X#include <fcntl.h>
- X#include <string.h>
- X#include <stdio.h>
- X
- X
- X/*
- X * Create a two-dimensional floating point circular vector field. Each
- X * vector will point 90 degrees, clockwise, away from the center of the
- X * field. v(x, y) = (x, -y). Note that the vector magnitudes are *not*
- X * equal to 1.0.
- X */
- X
- X
- X#ifdef NEED_STRERROR
- X /*
- X * strerror is supposed to be defined in <string.h> and supplied in the
- X * standard C library according to the ANSI C X3.159-1989 specification,
- X * but Sun OS 4.1.1 fails to define or supply it ... Unfortunately the
- X * only way we can control this is with an externally supplied define.
- X */
- X extern int errno; /* system error number */
- X extern char *sys_errlist[]; /* system error messages */
- X extern int sys_nerr; /* number of entries in sys_errlist */
- X
- X char *
- X strerror(int err)
- X {
- X if (err < 0 || err >= sys_nerr) {
- X static char msg[100];
- X
- X sprintf(msg, "system error number %d", err);
- X return(msg);
- X }
- X return(sys_errlist[err]);
- X }
- X#endif
- X
- X
- Xmain(int argc, char *argv[])
- X{
- X char *myname;
- X char *file;
- X int Xres, Yres;
- X float *VectorField;
- X register float fx, fy;
- X register int i, j;
- X int fd, cc;
- X
- X myname = argv[0];
- X if (argc != 4)
- X {
- X (void)fprintf(stderr, "usage: %s file-name x-res y-res\n", myname);
- X exit(EXIT_FAILURE);
- X }
- X
- X /* grab arguments */
- X file = argv[1];
- X Xres = atoi(argv[2]);
- X Yres = atoi(argv[3]);
- X
- X VectorField = (float *)malloc(sizeof(float)*Yres*Xres*2);
- X if (VectorField == NULL)
- X {
- X (void)fprintf(stderr, "%s: insufficient memory for creating the circle"
- X " field\n", myname);
- X exit(EXIT_FAILURE);
- X }
- X
- X for (j = 0; j < Yres; j++)
- X {
- X fy = (float)j/(float)(Yres-1) - 0.5;
- X for (i = 0; i < Xres; i++)
- X {
- X fx = (float)i/(float)(Xres-1) - 0.5;
- X VectorField[2*((Yres-1 - j)*Xres + i) + 0] = fy;
- X VectorField[2*((Yres-1 - j)*Xres + i) + 1] = -fx;
- X }
- X }
- X
- X fd = open(file, O_CREAT|O_TRUNC|O_WRONLY, 0666);
- X if (fd < 0)
- X {
- X (void)fprintf(stderr, "%s: unable to open %s: %s\n", myname, file,
- X strerror(errno));
- X exit(EXIT_FAILURE);
- X }
- X
- X cc = write(fd, VectorField, 2*sizeof(float)*Xres*Yres);
- X if (cc != 2*sizeof(float)*Xres*Yres)
- X {
- X (void)fprintf(stderr, "%s: write returned short: %s\n", myname,
- X strerror(errno));
- X (void)close(fd);
- X exit(EXIT_FAILURE);
- X }
- X (void)close(fd);
- X exit(EXIT_SUCCESS);
- X}
- END_OF_FILE
- if test 4807 -ne `wc -c <'lic.1.3/test/CircleField.c'`; then
- echo shar: \"'lic.1.3/test/CircleField.c'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/test/CircleField.c'
- fi
- if test -f 'lic.1.3/test/Makefile.tmpl' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/test/Makefile.tmpl'\"
- else
- echo shar: Extracting \"'lic.1.3/test/Makefile.tmpl'\" \(2929 characters\)
- sed "s/^X//" >'lic.1.3/test/Makefile.tmpl' <<'END_OF_FILE'
- X#
- X# $Header: /usr/local/src/lic/test/RCS/Makefile.tmpl,v 1.9 1993/11/03 21:01:12 casey Exp $
- X#
- X DEFINES = $(MMAP_DEFINES)
- X
- X SRCS1 = WhiteNoise.c
- X OBJS1 = WhiteNoise.o
- X DEPLIBS1 = $(LIBLIC)
- X SYSLIBS1 =
- X PROGRAM1 = WhiteNoise
- X
- X SRCS2 = SpotNoise.c
- X OBJS2 = SpotNoise.o
- X DEPLIBS2 = $(LIBLIC)
- X SYSLIBS2 = -lm
- X PROGRAM2 = SpotNoise
- X
- X SRCS3 = BasketWeave.c
- X OBJS3 = BasketWeave.o
- X DEPLIBS3 =
- X SYSLIBS3 =
- X PROGRAM3 = BasketWeave
- X
- X SRCS4 = CircleField.c
- X OBJS4 = CircleField.o
- X DEPLIBS4 =
- X SYSLIBS4 =
- X PROGRAM4 = CircleField
- X
- X SRCS5 = SpiralField.c
- X OBJS5 = SpiralField.o
- X DEPLIBS5 =
- X SYSLIBS5 =
- X PROGRAM5 = SpiralField
- X
- X SRCS6 = ElectroStatic.c
- X OBJS6 = ElectroStatic.o
- X DEPLIBS6 =
- X SYSLIBS6 = -lm
- X PROGRAM6 = ElectroStatic
- X
- X# Small, quickly hacked together GL program to display raw image files.
- X# Not generally useful, but may help you if you have GL and just want to
- X# get started seeing what LIC does ...
- X#
- X SRCS7 = gl-disp.c
- X OBJS7 = gl-disp.o
- X DEPLIBS7 = $(LIBLIC)
- X SYSLIBS7 = -lgl_s
- X PROGRAM7 = gl-disp
- X
- X SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) $(SRCS6) $(SRCS7)
- X ALL = $(PROGRAM1) $(PROGRAM2) $(PROGRAM3) $(PROGRAM4) $(PROGRAM5) \
- X $(PROGRAM6) # $(PROGRAM7)
- X
- Xall: $(ALL)
- X
- Xincludes:
- X
- X$(PROGRAM1): $(OBJS1) $(DEPLIBS1)
- X $(CC) $(CFLAGS) -o $(PROGRAM1) $(OBJS1) $(DEPLIBS1) $(SYSLIBS1)
- X
- X$(PROGRAM2): $(OBJS2) $(DEPLIBS2)
- X $(CC) $(CFLAGS) -o $(PROGRAM2) $(OBJS2) $(DEPLIBS2) $(SYSLIBS2)
- X
- X$(PROGRAM3): $(OBJS3) $(DEPLIBS3)
- X $(CC) $(CFLAGS) -o $(PROGRAM3) $(OBJS3) $(DEPLIBS3) $(SYSLIBS3)
- X
- X$(PROGRAM4): $(OBJS4) $(DEPLIBS4)
- X $(CC) $(CFLAGS) -o $(PROGRAM4) $(OBJS4) $(DEPLIBS4) $(SYSLIBS4)
- X
- X$(PROGRAM5): $(OBJS5) $(DEPLIBS5)
- X $(CC) $(CFLAGS) -o $(PROGRAM5) $(OBJS5) $(DEPLIBS5) $(SYSLIBS5)
- X
- X$(PROGRAM6): $(OBJS6) $(DEPLIBS6)
- X $(CC) $(CFLAGS) -o $(PROGRAM6) $(OBJS6) $(DEPLIBS6) $(SYSLIBS6)
- X
- X$(PROGRAM7): $(OBJS7) $(DEPLIBS7)
- X $(CC) $(CFLAGS) -o $(PROGRAM7) $(OBJS7) $(DEPLIBS7) $(SYSLIBS7)
- X
- Xtest: $(ALL)
- X rm -f noise.out weave.out lic.out
- X ./WhiteNoise noise.out 256 256
- X ./BasketWeave weave.out 256 256 8 8
- X $(TOP)/lic/lic -v -x 256 -y 256 -N -n fixed -a 0 -r 0 -g 0 -b 0 \
- X noise.out weave.out lic.out
- X
- Xinstall:
- X
- Xclean:
- X rm -f $(PROGRAM1) $(OBJS1)
- X rm -f $(PROGRAM2) $(OBJS2)
- X rm -f $(PROGRAM3) $(OBJS3)
- X rm -f $(PROGRAM4) $(OBJS4)
- X rm -f $(PROGRAM5) $(OBJS5)
- X rm -f $(PROGRAM6) $(OBJS6)
- X rm -f $(PROGRAM7) $(OBJS7)
- X rm -f noise.out weave.out lic.out
- X rm -f *~ *.o core a.out MAKELOG
- X
- Xlint:
- X lint -x $(ALLDEFINES) $(SRCS)
- X
- Xdepend:
- X
- XWhiteNoise.o: WhiteNoise.c $(BUILDINCTOP)/lic.h
- XSpotNoise.o: SpotNoise.c $(BUILDINCTOP)/lic.h
- XBasketWeave.o: BasketWeave.c
- XCircleField.o: CircleField.c
- XSpiralField.o: SpiralField.c
- XElectroStatic.o: ElectroStatic.c
- Xgl-disp.o: gl-disp.c $(BUILDINCTOP)/lic.h
- END_OF_FILE
- if test 2929 -ne `wc -c <'lic.1.3/test/Makefile.tmpl'`; then
- echo shar: \"'lic.1.3/test/Makefile.tmpl'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/test/Makefile.tmpl'
- fi
- if test -f 'lic.1.3/test/WhiteNoise.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lic.1.3/test/WhiteNoise.c'\"
- else
- echo shar: Extracting \"'lic.1.3/test/WhiteNoise.c'\" \(4620 characters\)
- sed "s/^X//" >'lic.1.3/test/WhiteNoise.c' <<'END_OF_FILE'
- X/*
- X * $Header: /usr/local/src/lic/test/RCS/WhiteNoise.c,v 1.7 1993/11/04 02:24:20 casey Exp $
- X */
- X
- X/*
- X * Copyright (c) 1993 The Regents of the University of California.
- X * All rights reserved.
- X *
- X * Redistribution and use in source and binary forms, with or without
- X * modification, are permitted provided that the following conditions
- X * are met:
- X * 1. Redistributions of source code must retain the above copyright
- X * notice, this list of conditions and the following disclaimer.
- X * 2. Redistributions in binary form must reproduce the above copyright
- X * notice, this list of conditions and the following disclaimer in the
- X * documentation and/or other materials provided with the distribution.
- X * 3. All advertising materials mentioning features or use of this software
- X * must display the following acknowledgement:
- X * This product includes software developed by the University of
- X * California, Lawrence Livermore National Laboratory and its
- X * contributors.
- X * 4. Neither the name of the University nor the names of its contributors
- X * may be used to endorse or promote products derived from this software
- X * without specific prior written permission.
- X *
- X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- X * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- X * SUCH DAMAGE.
- X */
- X
- X#ifndef lint
- X static char rcsid[] = "$Header: /usr/local/src/lic/test/RCS/WhiteNoise.c,v 1.7 1993/11/04 02:24:20 casey Exp $";
- X static char copyright[] =
- X "Copyright (c) 1993 The Regents of the University of California.\n"
- X "All rights reserved.\n";
- X#endif
- X
- X
- X#include <stdlib.h>
- X#include <unistd.h>
- X#include <errno.h>
- X#include <fcntl.h>
- X#include <string.h>
- X#include <stdio.h>
- X#include <sys/types.h>
- X
- X#include <lic.h>
- X
- X
- X/*
- X * Create a simple white noise image.
- X */
- X
- X
- X#ifdef NEED_STRERROR
- X /*
- X * strerror is supposed to be defined in <string.h> and supplied in the
- X * standard C library according to the ANSI C X3.159-1989 specification,
- X * but Sun OS 4.1.1 fails to define or supply it ... Unfortunately the
- X * only way we can control this is with an externally supplied define.
- X */
- X extern int errno; /* system error number */
- X extern char *sys_errlist[]; /* system error messages */
- X extern int sys_nerr; /* number of entries in sys_errlist */
- X
- X char *
- X strerror(int err)
- X {
- X if (err < 0 || err >= sys_nerr) {
- X static char msg[100];
- X
- X sprintf(msg, "system error number %d", err);
- X return(msg);
- X }
- X return(sys_errlist[err]);
- X }
- X#endif
- X
- X
- Xmain(int argc, char *argv[])
- X{
- X char *myname;
- X char *file;
- X int Xres, Yres;
- X unsigned char *Noise;
- X size_t pixel, scanline;
- X register int i, j;
- X int fd, cc;
- X
- X myname = argv[0];
- X if (argc != 4)
- X {
- X (void)fprintf(stderr, "usage: %s file_name x_res y_res\n", myname);
- X exit(EXIT_FAILURE);
- X }
- X
- X /* grab arguments */
- X file = argv[1];
- X Xres = atoi(argv[2]);
- X Yres = atoi(argv[3]);
- X
- X pixel = LIC_ConfiguredPixelSize();
- X scanline = sizeof(unsigned char) * pixel * Xres;
- X
- X Noise = (unsigned char *)malloc(scanline);
- X if (Noise == NULL)
- X {
- X (void)fprintf(stderr, "%s: insufficient memory for creating the noise"
- X " field\n", myname);
- X exit(EXIT_FAILURE);
- X }
- X
- X srand(98639); /* Seed with a prime number */
- X
- X fd = open(file, O_CREAT|O_TRUNC|O_WRONLY, 0666);
- X if (fd < 0)
- X {
- X (void)fprintf(stderr, "%s: unable to open %s: %s\n", myname, file,
- X strerror(errno));
- X exit(EXIT_FAILURE);
- X }
- X
- X for (j = 0; j < Yres; j++)
- X {
- X for (i = 0; i < Xres; i++)
- X {
- X int p, r;
- X
- X r = rand() & 255;
- X for (p = 0; p < pixel; p++)
- X Noise[i*pixel + p] = r;
- X }
- X
- X cc = write(fd, Noise, scanline);
- X if (cc != scanline)
- X {
- X (void)fprintf(stderr, "%s: write returned short: %s\n", myname,
- X strerror(errno));
- X (void)close(fd);
- X exit(EXIT_FAILURE);
- X }
- X }
- X
- X (void)close(fd);
- X exit(EXIT_SUCCESS);
- X}
- END_OF_FILE
- if test 4620 -ne `wc -c <'lic.1.3/test/WhiteNoise.c'`; then
- echo shar: \"'lic.1.3/test/WhiteNoise.c'\" unpacked with wrong size!
- fi
- # end of 'lic.1.3/test/WhiteNoise.c'
- fi
- echo shar: End of archive 8 \(of 9\).
- cp /dev/null ark8isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 9 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-