/src/ghostpdl/jpegxr/flags.c
Line | Count | Source |
1 | | |
2 | | /************************************************************************* |
3 | | * |
4 | | * This software module was originally contributed by Microsoft |
5 | | * Corporation in the course of development of the |
6 | | * ITU-T T.832 | ISO/IEC 29199-2 ("JPEG XR") format standard for |
7 | | * reference purposes and its performance may not have been optimized. |
8 | | * |
9 | | * This software module is an implementation of one or more |
10 | | * tools as specified by the JPEG XR standard. |
11 | | * |
12 | | * ITU/ISO/IEC give You a royalty-free, worldwide, non-exclusive |
13 | | * copyright license to copy, distribute, and make derivative works |
14 | | * of this software module or modifications thereof for use in |
15 | | * products claiming conformance to the JPEG XR standard as |
16 | | * specified by ITU-T T.832 | ISO/IEC 29199-2. |
17 | | * |
18 | | * ITU/ISO/IEC give users the same free license to this software |
19 | | * module or modifications thereof for research purposes and further |
20 | | * ITU/ISO/IEC standardization. |
21 | | * |
22 | | * Those intending to use this software module in products are advised |
23 | | * that its use may infringe existing patents. ITU/ISO/IEC have no |
24 | | * liability for use of this software module or modifications thereof. |
25 | | * |
26 | | * Copyright is not released for products that do not conform to |
27 | | * to the JPEG XR standard as specified by ITU-T T.832 | |
28 | | * ISO/IEC 29199-2. |
29 | | * |
30 | | * Microsoft Corporation retains full right to modify and use the code |
31 | | * for its own purpose, to assign or donate the code to a third party, |
32 | | * and to inhibit third parties from using the code for products that |
33 | | * do not conform to the JPEG XR standard as specified by ITU-T T.832 | |
34 | | * ISO/IEC 29199-2. |
35 | | * |
36 | | * This copyright notice must be included in all copies or derivative |
37 | | * works. |
38 | | * |
39 | | * Copyright (c) ITU-T/ISO/IEC 2008, 2009. |
40 | | ***********************************************************************/ |
41 | | |
42 | | #ifdef _MSC_VER |
43 | | #pragma comment (user,"$Id: flags.c,v 1.5 2008/03/06 02:05:48 steve Exp $") |
44 | | #else |
45 | | #ident "$Id: flags.c,v 1.5 2008/03/06 02:05:48 steve Exp $" |
46 | | #endif |
47 | | |
48 | | # include "jxr_priv.h" |
49 | | # include <assert.h> |
50 | | |
51 | | unsigned jxr_get_IMAGE_WIDTH(jxr_image_t image) |
52 | 0 | { |
53 | 0 | return image->width1 + 1; |
54 | 0 | } |
55 | | |
56 | | unsigned jxr_get_IMAGE_HEIGHT(jxr_image_t image) |
57 | 0 | { |
58 | 0 | return image->height1 + 1; |
59 | 0 | } |
60 | | |
61 | | unsigned jxr_get_EXTENDED_IMAGE_WIDTH(jxr_image_t image) |
62 | 0 | { |
63 | 0 | return image->extended_width; |
64 | 0 | } |
65 | | |
66 | | unsigned jxr_get_EXTENDED_IMAGE_HEIGHT(jxr_image_t image) |
67 | 0 | { |
68 | 0 | return image->extended_height; |
69 | 0 | } |
70 | | |
71 | | int jxr_get_TILING_FLAG(jxr_image_t image) |
72 | 0 | { |
73 | 0 | if (TILING_FLAG(image)) |
74 | 0 | return 1; |
75 | 0 | else |
76 | 0 | return 0; |
77 | 0 | } |
78 | | |
79 | | unsigned jxr_get_TILE_COLUMNS(jxr_image_t image) |
80 | 0 | { |
81 | 0 | return image->tile_columns + 1; |
82 | 0 | } |
83 | | |
84 | | unsigned jxr_get_TILE_ROWS(jxr_image_t image) |
85 | 0 | { |
86 | 0 | return image->tile_rows + 1; |
87 | 0 | } |
88 | | |
89 | | int jxr_get_TILE_WIDTH(jxr_image_t image, unsigned column) |
90 | 0 | { |
91 | 0 | if (column > image->tile_columns) { |
92 | 0 | return 0; |
93 | 0 | } else if (column == image->tile_columns) { |
94 | 0 | if (column == 0) |
95 | 0 | return EXTENDED_WIDTH_BLOCKS(image); |
96 | 0 | else |
97 | 0 | return EXTENDED_WIDTH_BLOCKS(image) - image->tile_column_position[column-1]; |
98 | 0 | } else { |
99 | 0 | return image->tile_column_width[column]; |
100 | 0 | } |
101 | 0 | } |
102 | | |
103 | | int jxr_get_TILE_HEIGHT(jxr_image_t image, unsigned row) |
104 | 0 | { |
105 | 0 | if (row > image->tile_rows) { |
106 | 0 | return 0; |
107 | 0 | } else if (row == image->tile_rows) { |
108 | 0 | if (row == 0) |
109 | 0 | return EXTENDED_HEIGHT_BLOCKS(image); |
110 | 0 | else |
111 | 0 | return EXTENDED_HEIGHT_BLOCKS(image) - image->tile_row_position[row-1]; |
112 | 0 | } else { |
113 | 0 | return image->tile_row_height[row]; |
114 | 0 | } |
115 | 0 | } |
116 | | |
117 | | int jxr_get_ALPHACHANNEL_FLAG(jxr_image_t image) |
118 | 0 | { |
119 | 0 | if (ALPHACHANNEL_FLAG(image)) |
120 | 0 | return 1; |
121 | 0 | else |
122 | 0 | return 0; |
123 | 0 | } |
124 | | |
125 | | jxrc_t_pixelFormat jxr_get_pixel_format(jxr_image_t image) |
126 | 0 | { |
127 | 0 | return image->ePixelFormat; |
128 | 0 | } |
129 | | |
130 | | /* |
131 | | * $Log: flags.c,v $ |
132 | | * |
133 | | * Revision 1.7 2009/05/29 12:00:00 microsoft |
134 | | * Reference Software v1.6 updates. |
135 | | * |
136 | | * Revision 1.6 2009/04/13 12:00:00 microsoft |
137 | | * Reference Software v1.5 updates. |
138 | | * |
139 | | * Revision 1.5 2008/03/06 02:05:48 steve |
140 | | * Distributed quantization |
141 | | * |
142 | | * Revision 1.4 2008/02/26 23:52:44 steve |
143 | | * Remove ident for MS compilers. |
144 | | * |
145 | | * Revision 1.3 2008/02/26 23:28:53 steve |
146 | | * Remove C99 requirements from the API. |
147 | | * |
148 | | * Revision 1.2 2007/11/26 01:47:15 steve |
149 | | * Add copyright notices per MS request. |
150 | | * |
151 | | * Revision 1.1 2007/06/06 17:19:12 steve |
152 | | * Introduce to CVS. |
153 | | * |
154 | | */ |
155 | | |