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 
jxr_get_IMAGE_WIDTH(jxr_image_t image)51 unsigned jxr_get_IMAGE_WIDTH(jxr_image_t image)
52 {
53     return image->width1 + 1;
54 }
55 
jxr_get_IMAGE_HEIGHT(jxr_image_t image)56 unsigned jxr_get_IMAGE_HEIGHT(jxr_image_t image)
57 {
58     return image->height1 + 1;
59 }
60 
jxr_get_EXTENDED_IMAGE_WIDTH(jxr_image_t image)61 unsigned jxr_get_EXTENDED_IMAGE_WIDTH(jxr_image_t image)
62 {
63     return image->extended_width;
64 }
65 
jxr_get_EXTENDED_IMAGE_HEIGHT(jxr_image_t image)66 unsigned jxr_get_EXTENDED_IMAGE_HEIGHT(jxr_image_t image)
67 {
68     return image->extended_height;
69 }
70 
jxr_get_TILING_FLAG(jxr_image_t image)71 int jxr_get_TILING_FLAG(jxr_image_t image)
72 {
73     if (TILING_FLAG(image))
74         return 1;
75     else
76         return 0;
77 }
78 
jxr_get_TILE_COLUMNS(jxr_image_t image)79 unsigned jxr_get_TILE_COLUMNS(jxr_image_t image)
80 {
81     return image->tile_columns + 1;
82 }
83 
jxr_get_TILE_ROWS(jxr_image_t image)84 unsigned jxr_get_TILE_ROWS(jxr_image_t image)
85 {
86     return image->tile_rows + 1;
87 }
88 
jxr_get_TILE_WIDTH(jxr_image_t image,unsigned column)89 int jxr_get_TILE_WIDTH(jxr_image_t image, unsigned column)
90 {
91     if (column > image->tile_columns) {
92         return 0;
93     } else if (column == image->tile_columns) {
94         if (column == 0)
95             return EXTENDED_WIDTH_BLOCKS(image);
96         else
97             return EXTENDED_WIDTH_BLOCKS(image) - image->tile_column_position[column-1];
98     } else {
99         return image->tile_column_width[column];
100     }
101 }
102 
jxr_get_TILE_HEIGHT(jxr_image_t image,unsigned row)103 int jxr_get_TILE_HEIGHT(jxr_image_t image, unsigned row)
104 {
105     if (row > image->tile_rows) {
106         return 0;
107     } else if (row == image->tile_rows) {
108         if (row == 0)
109             return EXTENDED_HEIGHT_BLOCKS(image);
110         else
111             return EXTENDED_HEIGHT_BLOCKS(image) - image->tile_row_position[row-1];
112     } else {
113         return image->tile_row_height[row];
114     }
115 }
116 
jxr_get_ALPHACHANNEL_FLAG(jxr_image_t image)117 int jxr_get_ALPHACHANNEL_FLAG(jxr_image_t image)
118 {
119     if (ALPHACHANNEL_FLAG(image))
120         return 1;
121     else
122         return 0;
123 }
124 
jxr_get_pixel_format(jxr_image_t image)125 jxrc_t_pixelFormat jxr_get_pixel_format(jxr_image_t image)
126 {
127     return image->ePixelFormat;
128 }
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 
156