1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * Copyright by The HDF Group. * 3 * Copyright by the Board of Trustees of the University of Illinois. * 4 * All rights reserved. * 5 * * 6 * This file is part of HDF. The full HDF copyright notice, including * 7 * terms governing use, modification, and redistribution, is contained in * 8 * the COPYING file, which can be found at the root of the source code * 9 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * 10 * If you do not have access to either file, you may request a copy from * 11 * help@hdfgroup.org. * 12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 13 14 /* $Id$ */ 15 16 /*----------------------------------------------------------------------------- 17 * File: mfgr.h 18 * Purpose: header file for multi-file general raster information 19 * Dependencies: 20 * Invokes: 21 * Contents: 22 * Structure definitions: 23 * Constant definitions: 24 *---------------------------------------------------------------------------*/ 25 26 /* avoid re-inclusion */ 27 #ifndef __MFGR_H 28 #define __MFGR_H 29 30 #include "H4api_adpt.h" 31 32 /* Interlace types available */ 33 typedef int16 gr_interlace_t; 34 #define MFGR_INTERLACE_PIXEL 0 /* pixel interlacing scheme */ 35 #define MFGR_INTERLACE_LINE 1 /* line interlacing scheme */ 36 #define MFGR_INTERLACE_COMPONENT 2 /* component interlacing scheme */ 37 38 #if defined MFGR_MASTER | defined MFGR_TESTER 39 40 #include "hfile.h" 41 #include "tbbt.h" /* Get tbbt routines */ 42 43 /* This is the size of the hash tables used for GR & RI IDs */ 44 #define GRATOM_HASH_SIZE 32 45 46 /* The tag of the attribute data */ 47 #define RI_TAG DFTAG_VG /* Current RI groups are stored in Vgroups */ 48 #define ATTR_TAG DFTAG_VH /* Current GR attributes are stored in VDatas */ 49 50 /* The default threshhold for attributes which will be cached */ 51 #define GR_ATTR_THRESHHOLD 2048 52 53 #define VALIDRIINDEX(i,gp) ((i)>=0 && (i)<(gp)->gr_count) 54 55 /* 56 * Each gr_info_t maintains 2 threaded-balanced-binary-tress: one of 57 * raster images and one of global attributes 58 */ 59 60 typedef struct gr_info { 61 int32 hdf_file_id; /* the corresponding HDF file ID (must be first in the structure) */ 62 uint16 gr_ref; /* ref # of the Vgroup of the GR in the file */ 63 64 int32 gr_count; /* # of image entries in gr_tab so far */ 65 TBBT_TREE *grtree; /* Root of image B-Tree */ 66 uintn gr_modified; /* whether any images have been modified */ 67 68 int32 gattr_count; /* # of global attr entries in gr_tab so far */ 69 TBBT_TREE *gattree; /* Root of global attribute B-Tree */ 70 uintn gattr_modified; /* whether any global attributes have been modified */ 71 72 intn access; /* the number of active pointers to this file's GRstuff */ 73 uint32 attr_cache; /* the threshhold for the attribute sizes to cache */ 74 } gr_info_t; 75 76 typedef struct at_info { 77 int32 index; /* index of the attribute (needs to be first in the struct) */ 78 int32 nt; /* number type of the attribute */ 79 int32 len; /* length/order of the attribute */ 80 uint16 ref; /* ref of the attribute (stored in VData) */ 81 uintn data_modified; /* flag to indicate whether the attribute data has been modified */ 82 uintn new_at; /* flag to indicate whether the attribute was added to the Vgroup */ 83 char *name; /* name of the attribute */ 84 void * data; /* data for the attribute */ 85 } at_info_t; 86 87 typedef struct dim_info { 88 uint16 dim_ref; /* reference # of the Dim record */ 89 int32 xdim,ydim, /* dimensions of the image */ 90 ncomps, /* number of components of each pixel in image */ 91 nt, /* number type of the components */ 92 file_nt_subclass; /* number type subclass of data on disk */ 93 gr_interlace_t il; /* interlace of the components (stored on disk) */ 94 uint16 nt_tag,nt_ref; /* tag & ref of the number-type info */ 95 uint16 comp_tag,comp_ref; /* tag & ref of the compression info */ 96 } dim_info_t; 97 98 typedef struct ri_info { 99 int32 index; /* index of this image (needs to be first in the struct) */ 100 uint16 ri_ref; /* ref # of the RI Vgroup */ 101 uint16 rig_ref; /* ref # of the RIG group */ 102 gr_info_t *gr_ptr; /* ptr to the GR info that this ri_info applies to */ 103 dim_info_t img_dim; /* image dimension information */ 104 dim_info_t lut_dim; /* palette dimension information */ 105 uint16 img_tag,img_ref; /* tag & ref of the image data */ 106 int32 img_aid; /* AID for the image data */ 107 intn acc_perm; /* Access permission (read/write) for image AID */ 108 uint16 lut_tag,lut_ref; /* tag & ref of the palette data */ 109 gr_interlace_t im_il; /* interlace of image when next read (default PIXEL) */ 110 gr_interlace_t lut_il; /* interlace of LUT when next read */ 111 uintn data_modified; /* whether the image or palette data has been modified */ 112 uintn meta_modified; /* whether the image or palette meta-info has been modified */ 113 uintn attr_modified; /* whether the attributes have been modified */ 114 char *name; /* name of the image */ 115 int32 lattr_count; /* # of local attr entries in ri_info so far */ 116 TBBT_TREE *lattree; /* Root of the local attribute B-Tree */ 117 intn access; /* the number of times this image has been selected */ 118 uintn use_buf_drvr; /* access to image needs to be through the buffered special element driver */ 119 uintn use_cr_drvr; /* access to image needs to be through the compressed raster special element driver */ 120 uintn comp_img; /* whether to compress image data */ 121 comp_coder_t comp_type; /* compression type */ 122 comp_info cinfo; /* compression information */ 123 uintn ext_img; /* whether to make image data external */ 124 char *ext_name; /* name of the external file */ 125 int32 ext_offset; /* offset in the external file */ 126 uintn acc_img; /* whether to make image data a different access type */ 127 uintn acc_type; /* type of access-mode to get image data with */ 128 uintn fill_img; /* whether to fill image, or just store fill value */ 129 void * fill_value; /* pointer to the fill value (NULL means use default fill value of 0) */ 130 uintn store_fill; /* whether to add fill value attribute or not */ 131 intn name_generated; /* whether the image has name that was given by app. or was generated by the library like the DFR8 images (added for hmap)*/ 132 } ri_info_t; 133 134 /* Useful raster routines for generally private use */ 135 136 HDFLIBAPI intn GRIil_convert(const void * inbuf,gr_interlace_t inil,void * outbuf, 137 gr_interlace_t outil,int32 dims[2],int32 ncomp,int32 nt); 138 139 HDFLIBAPI VOID GRIgrdestroynode(void * n); 140 141 HDFLIBAPI VOID GRIattrdestroynode(void * n); 142 143 HDFLIBAPI VOID GRIridestroynode(void * n); 144 145 #endif /* MFGR_MASTER | MFGR_TESTER */ 146 147 #endif /* __MFGR_H */ 148