Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/* Copyright (C) 1997, 1999 Aladdin Enterprises.  All rights reserved.
2
 
3
  This software is provided AS-IS with no warranty, either express or
4
  implied.
5
 
6
  This software is distributed under license and may not be copied,
7
  modified or distributed except as expressly authorized under the terms
8
  of the license contained in the file LICENSE in this distribution.
9
 
10
  For more information about licensing, please refer to
11
  http://www.ghostscript.com/licensing/. For information on
12
  commercial licensing, go to http://www.artifex.com/licensing/ or
13
  contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14
  San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
*/
16
 
17
/* $Id: gxsample.h,v 1.7 2005/06/08 14:38:21 igor Exp $ */
18
/* Sample lookup and expansion */
19
 
20
#ifndef gxsample_INCLUDED
21
#  define gxsample_INCLUDED
22
 
23
/*
24
 * The following union implements the expansion of sample
25
 * values from N bits to 8, and a possible linear transformation.
26
 */
27
typedef union sample_lookup_s {
28
    bits32 lookup4x1to32[16];	/* 1 bit/sample, not spreading */
29
    bits16 lookup2x2to16[16];	/* 2 bits/sample, not spreading */
30
    byte lookup8[256];		/* 1 bit/sample, spreading [2] */
31
    /* 2 bits/sample, spreading [4] */
32
    /* 4 bits/sample [16] */
33
    /* 8 bits/sample [256] */
34
} sample_lookup_t;
35
 
36
/*
37
 * Define identity and inverted expansion lookups for 1-bit input values.
38
 * These can be cast to a const sample_lookup_t.
39
 */
40
extern const bits32 lookup4x1to32_identity[16];
41
extern const bits32 lookup4x1to32_inverted[16];
42
 
43
#ifndef sample_map_DEFINED
44
#define sample_map_DEFINED
45
typedef struct sample_map_s sample_map;
46
#endif
47
 
48
/*
49
 * Define procedures to unpack and shuffle image data samples.  The Unix C
50
 * compiler can't handle typedefs for procedure (as opposed to
51
 * pointer-to-procedure) types, so we have to do it with macros instead.
52
 *
53
 * The original data start at sample data_x relative to data.
54
 * bptr points to the buffer normally used to deliver the unpacked data.
55
 * The unpacked data are at sample *pdata_x relative to the return value.
56
 *
57
 * Note that this procedure may return either a pointer to the buffer, or
58
 * a pointer to the original data.
59
 */
60
#define SAMPLE_UNPACK_PROC(proc)\
61
  const byte *proc(byte *bptr, int *pdata_x, const byte * data, int data_x,\
62
		   uint dsize, const sample_map *smap, int spread,\
63
		   int num_components_per_plane)
64
typedef SAMPLE_UNPACK_PROC((*sample_unpack_proc_t));
65
 
66
/*
67
 * Declare the 1-for-1 unpacking procedure.
68
 */
69
SAMPLE_UNPACK_PROC(sample_unpack_copy);
70
/*
71
 * Declare unpacking procedures for 1, 2, 4, and 8 bits per pixel,
72
 * with optional spreading of the result.
73
 */
74
SAMPLE_UNPACK_PROC(sample_unpack_1);
75
SAMPLE_UNPACK_PROC(sample_unpack_2);
76
SAMPLE_UNPACK_PROC(sample_unpack_4);
77
SAMPLE_UNPACK_PROC(sample_unpack_8);
78
 
79
SAMPLE_UNPACK_PROC(sample_unpack_1_interleaved);
80
SAMPLE_UNPACK_PROC(sample_unpack_2_interleaved);
81
SAMPLE_UNPACK_PROC(sample_unpack_4_interleaved);
82
SAMPLE_UNPACK_PROC(sample_unpack_8_interleaved);
83
 
84
#endif /* gxsample_INCLUDED */