Statistics
| Revision:

svn-gvsig-desktop / tags / gvSIGv0_6_1RELEASE / libraries / libjni-ecwcompress / include / NCSECWClient.h @ 28800

History | View | Annotate | Download (30 KB)

1
/********************************************************** 
2
** Copyright 1999 Earth Resource Mapping Pty Ltd.
3
** This document contains unpublished source code of
4
** Earth Resource Mapping Pty Ltd. This notice does
5
** not indicate any intention to publish the source
6
** code contained herein.
7
** 
8
** FILE:           NCSECWClient.wc
9
** CREATED:        08 May 1999
10
** AUTHOR:         TIS
11
** PURPOSE:        Public Client Interface library to Image Web Server ECW image decompression library
12
** EDITS:
13
** [01] tis        01-May-99 Created file
14
** [02] sjc 09-Jul-99 added SetFileViewEx() call.
15
** [03] sjc 30-Sep-99 added NCScbmCloseFileViewEx() call.
16
** [04] sjc 26-Oct-00 Added NCSecwSetIOCallbacks()
17
** [05] ddi 14-Nov-00 Added NCScbmReadViewLineIEEE4() and NCScbmReadViewLineUINT16()
18
** [06] sjc 22-Jan-02 New config get/set routines and enum
19
** [07] sjc 04-Feb-02 Added MAXOPEN
20
** [08] sjc 20-Feb-02 Added a bunch of tuneable parameters
21
** [09] sjc 30-Apr-03 Added low-mem compression config option
22
** [10] rar 02-Sep-03 Added option to try ecwp re-connection if connection lost
23
** [11] tfl 02-Jul-04 Moved declaration of NCSEcwCellType from here to NCSTypes.h
24
** [12] tfl 05-Jul-04 Added #define of allowed JPEG2000 file extensions
25
**
26
** NOTES
27
**
28
**        (1)        This file must be kept in synch with NCSECW.H
29
** 
30
**
31
********************************************************/
32

    
33
/** @file NCSECWClient.h */
34

    
35
#ifndef NCSECWCLIENT_H
36
#define NCSECWCLIENT_H
37

    
38
#ifndef NCSDEFS_H
39
#include "NCSDefs.h"
40
#endif
41
#ifndef NCSERRORS_H
42
#include "NCSErrors.h"
43
#endif
44

    
45
#ifdef __cplusplus
46
extern "C" {
47
#endif
48

    
49
/** 
50
 *        @enum
51
 *  Enumerated type for the return status from read line routines.
52
 *        The application should treat CANCELLED operations as non-fatal,
53
 *        in that they most likely mean this view read was cancelled for
54
 *        performance reasons.
55
 */
56
typedef enum {
57
        /** Successful read */
58
        NCSECW_READ_OK                        = 0,
59
        /** Read failed due to an error */
60
        NCSECW_READ_FAILED                = 1,
61
        /** Read was cancelled, either because a new SetView arrived or a 
62
            library shutdown is in progress */
63
        NCSECW_READ_CANCELLED        = 2        
64
} NCSEcwReadStatus;
65

    
66
/** 
67
 *        @enum
68
 *  Enumerated type for the cell sizes supported by the SDK.
69
 */
70
typedef enum {
71
        /** Invalid cell units */
72
        ECW_CELL_UNITS_INVALID        =        0,
73
        /** Cell units are standard meters */
74
        ECW_CELL_UNITS_METERS        =        1,
75
        /** Degrees */
76
        ECW_CELL_UNITS_DEGREES        =        2,
77
        /** US Survey feet */
78
        ECW_CELL_UNITS_FEET                =        3,
79
        /** Unknown cell units */
80
        ECW_CELL_UNITS_UNKNOWN        =        4
81
} CellSizeUnits;
82

    
83
/*[11] NCSEcwCellType declaration moved to NCSTypes.h */
84

    
85
/** 
86
 *        @enum
87
 *        Enumerated type for all the possible argument types
88
 *        for the SDK configuration function NCSEcwSetConfig
89
 */
90
typedef enum {
91
        /** BOOLEAN value, whether to texture image */
92
        NCSCFG_TEXTURE_DITHER                        = 0,
93
        /** BOOLEAN value, whether to reopen file for each view opened */
94
        NCSCFG_FORCE_FILE_REOPEN                = 1,
95
        /** UINT32 value, target maximum memory cache size */
96
        NCSCFG_CACHE_MAXMEM                                = 2,
97
        /** UINT32 value, target maximum number of files to have open to use for cache */ /*[07]*/
98
        NCSCFG_CACHE_MAXOPEN                        = 3,
99
        /** NCSTimeStampMs value, time an ecwp:// blocking read will wait before returning - default 10000 ms */ /*[08]*/
100
        NCSCFG_BLOCKING_TIME_MS                        = 4,
101
        /** NCSTimeStampMs value, time delay between blocks arriving and the next refresh callback - default 500 ms */
102
        NCSCFG_REFRESH_TIME_MS                        = 5,
103
        /** NCSTimeStampMs value, minimum time delay between last cache purge and the next one - default 1000 ms */ /*[08]*/
104
        NCSCFG_PURGE_DELAY_MS                        = 6,
105
        /** NCSTimeStampMs value, time delay between last view closing and file being purged from cache - default 1800000ms */ /*[08]*/
106
        NCSCFG_FILE_PURGE_DELAY_MS                = 7,
107
        /** NCSTimeStampMs value, minimum time delay between last view closing and file being purged from cache - default 30000 ms */ /*[08]*/
108
        NCSCFG_MIN_FILE_PURGE_DELAY_MS        = 8,
109
        /** (char *) value, "server" name of ECWP proxy server */
110
        NCSCFG_ECWP_PROXY                                = 9,
111
        /** BOOLEAN value, whether to force a low-memory compression */ /*[09]*/
112
        NCSCFG_FORCE_LOWMEM_COMPRESS        = 10,
113
        /** BOOLEAN value, whether to try to reconnect if ECWP connection is lost */ /*[10]*/
114
        NCSCFG_TRY_ECWP_RECONNECT                = 11,
115
        /** BOOLEAN value, whether to manage ICC profiles on file read */
116
        NCSCFG_JP2_MANAGE_ICC                        = 12,
117
        /** UINT32 value, number of cahce bytes to use for JP2 file I/O caching - default 2^15 == 32768 */
118
        NCSCFG_JP2_FILEIO_CACHE_MAXMEM        = 13
119
} NCSEcwConfigType;                                        /*[06]*/
120

    
121
/** 
122
 *        @struct
123
 *        Structure containing file metadata for the ECW interface.
124
 *        SDK method NCScbmGetViewFileInfo returns a pointer to this file info structure for a view
125
 */
126
typedef struct {
127
        /** Dataset cells in X direction */
128
        UINT32        nSizeX;
129
        /** Dataset cells in Y direction */
130
        UINT32        nSizeY;                        
131
        /** Number of bands in the file, e.g. 3 for a RGB file */
132
        UINT16        nBands;
133
        /** Target compression rate, e,g, 20 == 20:1 compression.  May be zero */
134
        UINT16        nCompressionRate;
135
        /** Units used for pixel size */
136
        CellSizeUnits        eCellSizeUnits;
137
        /** Increment in eCellSizeUnits in X direction.  May be negative.  Never zero */
138
        IEEE8        fCellIncrementX;
139
        /** Increment in eCellSizeUnits in Y direction.  May be negative.  Never zero */
140
        IEEE8        fCellIncrementY;
141
        /** World X origin for top left corner of top left cell, in eCellSizeUnits */
142
        IEEE8        fOriginX;
143
        /** World Y origin for top left corner of top left cell, in eCellSizeUnits */
144
        IEEE8        fOriginY;
145
        /** ER Mapper style Datum name string, e.g. "RAW" or "NAD27".  Never NULL */
146
        char        *szDatum;
147
        /** ER Mapper style Projection name string, e.g. "RAW" or "WGS84".  Never NULL */
148
        char        *szProjection;
149
} NCSFileViewFileInfo;
150

    
151
/** 
152
 *        @struct
153
 *        Struct containing metadata for a specific band in the file.
154
 */
155
typedef struct {
156
        /** Bit depth used in band, including sign bit */
157
        UINT8        nBits;
158
        /** Whether band data is signed */
159
        BOOLEAN        bSigned;
160
        /** ASCII description of band, e.g. "Red" or "Band1" */
161
        char        *szDesc;
162
} NCSFileBandInfo;
163

    
164
/** 
165
 *        @defgroup banddescs
166
 *        These are the allowable ASCII descriptions in the current implementation.
167
 *  @{
168
 */
169
/** @def */
170
#define NCS_BANDDESC_Red                                                        "Red"
171
/** @def */
172
#define NCS_BANDDESC_Green                                                        "Green"
173
/** @def */
174
#define NCS_BANDDESC_Blue                                                        "Blue"
175
/** @def */
176
#define NCS_BANDDESC_All                                                        "All"
177
/** @def */
178
#define NCS_BANDDESC_RedOpacity                                                "RedOpacity"
179
/** @def */
180
#define NCS_BANDDESC_GreenOpacity                                        "GreenOpacity"
181
/** @def */
182
#define NCS_BANDDESC_BlueOpacity                                        "BlueOpacity"
183
/** @def */
184
#define NCS_BANDDESC_AllOpacity                                                "AllOpacity"
185
/** @def */
186
#define NCS_BANDDESC_RedOpacityPremultiplied                "RedOpacityPremultiplied"
187
/** @def */
188
#define NCS_BANDDESC_GreenOpacityPremultiplied                "GreenOpacityPremultiplied"
189
/** @def */
190
#define NCS_BANDDESC_BlueOpacityPremultiplied                "BlueOpacityPremultiplied"
191
/** @def */
192
#define NCS_BANDDESC_AllOpacityPremultiplied                "AllOpacityPremultiplied"
193
/** @def */
194
#define NCS_BANDDESC_Greyscale                                                "Greyscale"
195
/** @def */
196
#define NCS_BANDDESC_GreyscaleOpacity                                "GreyscaleOpacity"
197
/** @def */
198
#define NCS_BANDDESC_GreyscaleOpacityPremultiplied        "GreyscaleOpacityPremultiplied"
199
/** @def */
200
#define NCS_BANDDESC_Band                                                        "Band #%d"
201
/*@}*/
202

    
203
/** 
204
 *        @enum
205
 *        The color space used by a compressed file.
206
 *        For compatibility with ECW, these values cannot be changed or reordered.
207
 */
208
typedef enum {
209
        /** No color space */
210
        NCSCS_NONE                                                = 0,
211
        /** Greyscale image */
212
        NCSCS_GREYSCALE                                        = 1,        // Greyscale
213
        /** Luminance-chrominance color space */
214
        NCSCS_YUV                                                = 2,        // YUV - JPEG Digital, JP2 ICT
215
        /** Multiband image */
216
        NCSCS_MULTIBAND                                        = 3,        // Multi-band imagery
217
        /** sRGB color space */
218
        NCSCS_sRGB                                                = 4,        // sRGB
219
        /** Modified luminance-chrominance color space */
220
        NCSCS_YCbCr                                                = 5                // YCbCr - JP2 ONLY, Auto-converted to sRGB
221
} NCSFileColorSpace;
222

    
223
/** 
224
 *        @struct
225
 *        Extended file metadata structure for the JPEG 2000 interface.
226
 *        This structure is derived from a compressed JPEG 2000 file.
227
 *        It is important to note that the information contained within it 
228
 *        is informative, not normative.  For example, although the file may 
229
 *        contain metadata that indicates the image it contains is to be rotated,
230
 *        the SDK will not rotate that image itself.
231
 *        The SDK function NCScbmGetViewFileInfoEx() returns a pointer to this 
232
 *        file info structure for a given view.
233
 */
234
typedef struct {                
235
        /** Dataset cells in X direction */        
236
        UINT32        nSizeX;
237
        /** Dataset cells in X direction */
238
        UINT32        nSizeY;
239
        /** Number of bands in the file, e.g. 3 for a RGB file */
240
        UINT16        nBands;        
241
        /** Target compression rate, e,g, 20 == 20:1 compression.  May be zero */
242
        UINT16        nCompressionRate;
243
        /** Units used for pixel size */
244
        CellSizeUnits        eCellSizeUnits;        
245
        /** Increment in eCellSizeUnits in X direction.  May be negative.  Never zero */
246
        IEEE8        fCellIncrementX;
247
        /** Increment in eCellSizeUnits in Y direction.  May be negative.  Never zero */
248
        IEEE8        fCellIncrementY;
249
        /** World X origin for top left corner of top left cell, in eCellSizeUnits */
250
        IEEE8        fOriginX;
251
        /** World Y origin for top left corner of top left cell, in eCellSizeUnits */
252
        IEEE8        fOriginY;
253
        /** ER Mapper style Datum name string, e.g. "RAW" or "NAD27".  Never NULL */
254
        char        *szDatum;        
255
        /** ER Mapper style Projection name string, e.g. "RAW" or "WGS84".  Never NULL */
256
        char        *szProjection;
257
        /** Clockwise rotation of image in degrees */
258
        IEEE8        fCWRotationDegrees;
259
        /** Color space of image */
260
        NCSFileColorSpace eColorSpace;
261
        /** Cell type of image samples */
262
        NCSEcwCellType eCellType;
263
        /** A pointer to an array of band information structures for each band of the image */
264
        NCSFileBandInfo *pBands;
265
} NCSFileViewFileInfoEx;
266

    
267
/** 
268
 *        @struct
269
 *        Information about an open view into a compressed image file.
270
 *        This structure contains updated information about the extents and processing status
271
 *        of an open file view.  NCScbmGetViewSetInfo() will return a pointer to this structure 
272
 *        for a file view
273
 */
274
typedef struct {
275
        /** Client data */
276
        void        *pClientData;
277
        /** Number of bands to read */
278
        UINT32 nBands;                                
279
        /** Array of band indices being read from the file - the size of this array is nBands */
280
        UINT32 *pBandList;
281
        /** Top left of the view in image coordinates */
282
        UINT32 nTopX, nLeftY;
283
        /** Bottom right of the view in image coordinates */
284
        UINT32 nBottomX, nRightY;
285
        /** Size of the view in pixels */
286
        UINT32 nSizeX, nSizeY;                        
287
        /** Number of file blocks within the view area */
288
        UINT32 nBlocksInView;
289
        /** Number of these file blocks that are currently available */
290
        UINT32 nBlocksAvailable;
291
        /** Blocks of the file that were available at the time of the corresponding SetView */
292
        UINT32 nBlocksAvailableAtSetView;
293
        /** Number of blocks that were missed during the read of this view */
294
        UINT32 nMissedBlocksDuringRead;
295
        /** Top left of the view in world coordinates (if using SetViewEx) */
296
        IEEE8  fTopX, fLeftY;
297
        /** Bottom right of the view in world coordinates (if using SetViewEx) */ /*[02]*/
298
        IEEE8  fBottomX, fRightY;        
299
} NCSFileViewSetInfo;
300

    
301
/*
302
** The public library is included into the private library to pick up the public
303
** structures. If being included, we don't use the public function call definitions
304
*/
305

    
306
#ifndef ERS_WAVELET_DATASET_EXT
307
/** 
308
 *        @def 
309
 *        Allowed file extensions for ECW files
310
 */
311
#define ERS_WAVELET_DATASET_EXT        ".ecw"                /* compressed wavelet format file extension */
312
#endif
313
#ifndef ERS_JP2_DATASET_EXTS 
314
/**        
315
 *        @def
316
 *        Allowed file extensions for JPEG 2000 files
317
 */
318
#define ERS_JP2_DATASET_EXTS        { ".jp2" , ".j2k" , ".j2c" , ".jpc", ".jpx", ".jpf" } /*[12]*/
319
#endif
320

    
321
#ifndef ERS_JP2_WORLD_FILE_EXTS
322
#define ERS_JP2_WORLD_FILE_EXTS        { ".j2w" , ".jxw" , ".jfw" }  
323
#endif
324

    
325
#ifndef ERSWAVE_VERSION_STRING
326
/**        
327
 *        @def
328
 *        Current version of the ECW format
329
 */
330
#define ERSWAVE_VERSION_STRING        "2.0"                /* should be in sync with the above */
331
#endif
332
#ifndef NCS_ECW_PROXY_KEY
333
#define NCS_ECW_PROXY_KEY                "ECWP Proxy"
334
#endif // NCS_ECW_PROXY_KEY
335

    
336
/** 
337
 *        @typedef
338
 *        This type definition promotes properly transparent usage of the SDK structures.
339
 */
340
typedef struct NCSFileStruct NCSFile;
341
/** 
342
 *        @typedef
343
 *        This type definition promotes properly transparent usage of the SDK structures.
344
 */
345
typedef struct NCSFileViewStruct NCSFileView;
346

    
347
/*
348
**        Note:  routines return non-zero if there was an error
349
*/
350

    
351
/*
352
**        Do not call these unless directly including the NCSECW code rather than linking against the DLL
353
*/
354
/** 
355
 *        Initialise the SDK libraries.  Should not be called directly unless you are directly including 
356
 *        the SDK code rather than linking against the DLL. 
357
 */
358
extern void NCS_CALL NCSecwInit(void);                // DO NOT call if linking against the DLL
359
/** 
360
 *        Initialise the SDK libraries.  Should not be called directly unless you are directly including 
361
 *        the SDK code rather than linking against the DLL. 
362
 */
363
extern void NCS_CALL NCSecwShutdown(void);        // DO NOT call if linking against the DLL
364

    
365
/*[04]*/
366
/** 
367
 *        Set custom functions to be used by the SDK library to open, close, read, seek and tell input files.
368
 *        This can be used to manage "wrapper" files which encapsulate the ordinary compressed files 
369
 *  handled by the SDK.
370
 *
371
 *        @param[in]        pOpenCB                Callback function for opening input files
372
 *        @param[in]        pCloseCB        Callback function for closing input files
373
 *        @param[in]        pReadCB                Callback function for reading input files
374
 *        @param[in]        pSeekCB                Callback function for seeking input files
375
 *        @param[in]        pTellCB                Callback function for telling input files
376
 *        @return                                        NCSError value, NCS_SUCCESS or the code of any applicable error
377
 */
378
extern NCSError NCSecwSetIOCallbacks(NCSError (NCS_CALL *pOpenCB)(char *szFileName, void **ppClientData),
379
                                                                          NCSError (NCS_CALL *pCloseCB)(void *pClientData),
380
                                                                          NCSError (NCS_CALL *pReadCB)(void *pClientData, void *pBuffer, UINT32 nLength),
381
                                                                          NCSError (NCS_CALL *pSeekCB)(void *pClientData, UINT64 nOffset),
382
                                                                          NCSError (NCS_CALL *pTellCB)(void *pClientData, UINT64 *pOffset));
383

    
384
/*
385
**        This is used for multi-client load testing and texture management. Never call this routine.
386
*/
387
extern void NCS_CALL NCSecwConfig(BOOLEAN bNoTextureDither, BOOLEAN bForceFileReopen);
388

    
389
/** 
390
 *        Reports if this is a local or remote file, and breaks URL down into sections
391
 *
392
 *        @param[in]        szUrlPath                        The URL to be broken down and analysed
393
 *        @param[out]        ppProtocol                        The protocol of the URL (pointer to char *)
394
 *        @param[out]        pnProtocolLength        The length of the protocol
395
 *        @param[out]        ppHost                                The hostname specified in the URL
396
 *        @param[out] pnHostLength                The length of the specified hostname
397
 *        @param[out]        ppFilename                        The filename specified by the URL
398
 *        @param[out]        pnFilenameLength        The length of the specified filename
399
 *        @return                                                        BOOLEAN value, if this is a local file
400
 */
401
extern BOOLEAN NCS_CALL NCSecwNetBreakdownUrl( char *szUrlPath,
402
                                                   char **ppProtocol,        int *pnProtocolLength,
403
                                                   char **ppHost,                int *pnHostLength,
404
                                                   char **ppFilename,        int *pnFilenameLength);
405

    
406
/** 
407
 *        Opens a file view.  After calling this function, call GetViewFileInfo to obtain file metadata
408
 *
409
 *        @param[in]        szUrlPath                        The location of the file on which to open a view
410
 *        @param[out]        ppNCSFileView                The NCSFileView structure to initialise
411
 *        @param[in]        pRefreshCallback        The refresh callback with which to handle progressive reads (may be NULL for the blocking interface)
412
 *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
413
 */
414
extern NCSError NCS_CALL NCScbmOpenFileView(char *szUrlPath, NCSFileView **ppNCSFileView,
415
                                           NCSEcwReadStatus (*pRefreshCallback)(NCSFileView *pNCSFileView));
416

    
417
/**        
418
 *        Closes a file view.  This can be called at any time after NCScbmOpenFileView is called to clean up an open file view.
419
 *
420
 *        @param[in]        pNCSFileView                The file view to close
421
 *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
422
 */
423
extern NCSError NCS_CALL NCScbmCloseFileView(NCSFileView *pNCSFileView);
424

    
425
/**        
426
 *        Closes a file view.  This can be called at any time after NCScbmOpenFileView is called to clean up an open file view.
427
 *
428
 *        This version allows the developer to forcibly close a file and free the resources allocated to it.
429
 *        @param[in]        pNCSFileView                The file view to close
430
 *        @param[in]        bFreeCachedFile                Whether to force the freeing of the file's memory cache
431
 *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
432
 */
433
extern NCSError NCS_CALL NCScbmCloseFileViewEx(NCSFileView *pNCSFileView, BOOLEAN bFreeCachedFile);        /*[03]*/
434

    
435

    
436
/** 
437
 *        Populates a structure with information about an open image file.  Use this version when dealing with ECW files only.
438
 *
439
 *        @param[in]        pNCSFileView                        The file view open on the file whose metadata is being obtained
440
 *        @param[out]        ppNCSFileViewFileInfo        A pointer to a pointer to the NCSFileViewFileInfo struct to populate with the metadata
441
 *        @return                                                                NCSError value, NCS_SUCCESS or any applicable error code
442
 */
443
extern NCSError NCS_CALL NCScbmGetViewFileInfo(NCSFileView *pNCSFileView, NCSFileViewFileInfo **ppNCSFileViewFileInfo);
444

    
445
/** 
446
 *        Populates a structure with information about an open image file.  This is the extended version which will return additional 
447
 *
448
 *        metadata for a JPEG 2000 file that is irrelevant in the case of ECW input.  Note the different parameter type.
449
 *        @param[in]        pNCSFileView                        The file view open on the file whose metadata is being obtained
450
 *        @param[out]        ppNCSFileViewFileInfo        A pointer to a pointer to the NCSFileViewFileInfoEx struct to populate with the metadata
451
 *        @return                                                                NCSError value, NCS_SUCCESS or any applicable error code
452
 */
453
extern NCSError NCS_CALL NCScbmGetViewFileInfoEx(NCSFileView *pNCSFileView, NCSFileViewFileInfoEx **ppNCSFileViewFileInfo);
454

    
455
/** 
456
 *        Obtains information about the current request to set the view, including statistics about the data being processed
457
 *
458
 *        @param[in]        pNCSFileView                        The open file view the extents of which are currently being set
459
 *        @param[out]        ppNCSFileViewSetInfo        The information about the view being set
460
 *        @return                                                                NCSError value, either NCS_SUCCESS or an applicable error code
461
 */
462
extern NCSError NCS_CALL NCScbmGetViewInfo(NCSFileView *pNCSFileView, NCSFileViewSetInfo **ppNCSFileViewSetInfo);
463

    
464
/** 
465
 *        Sets the extents and band content of an open file view, and the output view size.  This function can be called at 
466
 *        any time after a successful call to NCScbmOpenFileView.  In progressive mode, multiple calls to NCScbmSetFileView 
467
 *        can be made, even if previous SetViews are still being processed, enhancing client interaction with the view.  After 
468
 *        the call to NCScbmSetFileView, the band list array pBandList can be freed if so desired.  It is used only during the 
469
 *  processing of the call, and not afterward.
470
 *
471
 *        @param[in]        pNCSFileView                        The open file view to set
472
 *        @param[in]        pBandList                                An array of integers specifying which bands of the image to read, and in which order
473
 *        @param[in]        nTopX                                        Left edge of the view in dataset cells
474
 *        @param[in]        nLeftY                                        Top edge of the view in dataset cells
475
 *        @param[in]        nBottomX                                Right edge of the view in dataset cells
476
 *        @param[in]        nRightY                                        Bottom edge of the view in dataset cells
477
 *        @param[in]        nSizeX                                        Width of the view to be constructed from the image subset
478
 *        @param[in]        nSizeY                                        Height of the view to be constructed from the image subset
479
 *        @return                                                                NCSError value, NCS_SUCCESS or any applicable error code
480
 */
481
extern NCSError NCS_CALL NCScbmSetFileView(NCSFileView *pNCSFileView,
482
                                                                                   UINT32 nBands,                                        
483
                                                                                   UINT32 *pBandList,                                
484
                                                                                   UINT32 nTopX, UINT32 nLeftY,        
485
                                                                                   UINT32 nBottomX, UINT32 nRightY,
486
                                                                                   UINT32 nSizeX, UINT32 nSizeY);        
487

    
488
/** 
489
 *        Sets the extents and band content of an open file view, and the output view size.  This function can be called at 
490
 *        any time after a successful call to NCScbmOpenFileView.  In progressive mode, multiple calls to NCScbmSetFileView 
491
 *        can be made, even if previous SetViews are still being processed, enhancing client interaction with the view.  After 
492
 *        the call to NCScbmSetFileView, the band list array pBandList can be freed if so desired.  It is used only during the 
493
 *  processing of the call, and not afterward.  This version also allows the calling program to specify world coordinates 
494
 *        for the view.
495
 *
496
 *        @param[in]        pNCSFileView                        The open file view to set
497
 *        @param[in]        pBandList                                An array of integers specifying which bands of the image to read, and in which order
498
 *        @param[in]        nTopX                                        Left edge of the view in dataset cells
499
 *        @param[in]        nLeftY                                        Top edge of the view in dataset cells
500
 *        @param[in]        nBottomX                                Bottom edge of the view in dataset cells
501
 *        @param[in]        nRightY                                        Right edge of the view in dataset cells
502
 *        @param[in]        nSizeX                                        Width of the view to be constructed from the image subset
503
 *        @param[in]        nSizeY                                        Height of the view to be constructed from the image subset
504
 *        @param[in]        fTopX                                        Left edge of the view in world coordinates
505
 *        @param[in]        fLeftY                                        Top edge of the view in world coordinates
506
 *        @param[in]        fBottomX                                Right edge of the view in world coordinates
507
 *        @param[in]        fRightY                                        Bottom edge of the view in world coordinates
508
 *        @return                                                                NCSError value, NCS_SUCCESS or any applicable error code
509
 */
510
extern NCSError NCS_CALL NCScbmSetFileViewEx(NCSFileView *pNCSFileView,                /*[02]*/
511
                                                                                         UINT32 nBands,                                        
512
                                                                                         UINT32 *pBandList,                                
513
                                                                                         UINT32 nTopX, UINT32 nLeftY,        
514
                                                                                         UINT32 nBottomX, UINT32 nRightY,
515
                                                                                         UINT32 nSizeX, UINT32 nSizeY,        
516
                                                                                         IEEE8 fTopX, IEEE8 fLeftY,                
517
                                                                                         IEEE8 fBottomX, IEEE8 fRightY);        
518

    
519
/** 
520
 *        Read line by line in BIL format.
521
 *
522
 *        @param[in]        pNCSFileView                        The open file view from which to read view lines
523
 *        @param[out]        ppOutputLine                        The buffer into which to read the interleaved band information
524
 *        @return                                                                NCSEcwReadStatus value, NCSECW_READ_OK or any applicable error code
525
 */
526
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineBIL( NCSFileView *pNCSFileView, UINT8 **ppOutputLine);
527

    
528
/** 
529
 *        Read line by line in BIL format to different data types.  This extended version allows the client 
530
 *
531
 *        program to read in view lines made up of cells with sample bitdepth other than 8-bit.
532
 *        @param[in]        pNCSFileView                        The open file view from which to read view lines
533
 *        @param[in]        eType                                        The cell type of the view lines being read
534
 *        @param[out]        ppOutputLine                        The buffer into which to read the interleaved band information
535
 *        @return                                                                NCSEcwReadStatus value, NCSECW_READ_OK or any applicable error code
536
 */
537
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineBILEx( NCSFileView *pNCSFileView, NCSEcwCellType eType, void **ppOutputLine);        /**[05]**/
538

    
539
/** 
540
 *        Read line by line in RGB format.
541
 *
542
 *        @param[in]        pNCSFileView                        The open file view from which to read view lines
543
 *        @param[out]        pRGBTriplets                        The buffer into which to read the red-green-blue sample triplets.
544
 *        @return                                                                NCSEcwReadStatus value, NCSECW_READ_OK or any applicable error code
545
 */
546
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineRGB( NCSFileView *pNCSFileView, UINT8 *pRGBTriplets);
547

    
548
/** 
549
 *        Read line by line in BGR format.
550
 *
551
 *        @param[in]        pNCSFileView                        The open file view from which to read view lines
552
 *        @param[out]        pBGRTriplets                        The buffer into which to read the blue-red-green sample triplets.
553
 *        @return                                                                NCSEcwReadStatus value, NCSECW_READ_OK or any applicable error code
554
 */
555
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineBGR( NCSFileView *pNCSFileView, UINT8 *pBGRTriplets);
556

    
557
/**
558
 *        Read line by line in RGBA format.  Samples are read into a buffer of UINT32 values, each value comprising
559
 *        the four bytes of a red-green-blue-alpha sample.  Alpha values will be zero if the input file is in ECW
560
 *        format as this format does not 'understand' alpha channels.  SDK programmers wanting to compress and 
561
 *        decompress data in four bands are advised to use multiband compression and NCScbmReadViewLineBil(Ex) to 
562
 *        handle their data.
563
 *
564
 *        @param[in]        pNCSFileView                        The open file view from which to read view lines
565
 *        @param[out]        pRGBA                                        The buffer of packed UINT32 values.
566
 *        @return                                                                NCSEcwReadStatus value, NCSECW_READ_OK or any applicable error code
567
 */
568
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineRGBA( NCSFileView *pNCSFileView, UINT32 *pRGBA);
569

    
570
/**        
571
 *        Read line by line in BGRA format.  Samples are read into a buffer of UINT32 values, each value comprising
572
 *        the four bytes of a red-green-blue-alpha sample.  Alpha values will be zero if the input file is in ECW
573
 *        format as this format does not 'understand' alpha channels.  SDK programmers wanting to compress and 
574
 *        decompress data in four bands are advised to use multiband compression and NCScbmReadViewLineBil(Ex) to 
575
 *        handle their data.
576
 *
577
 *        @param[in]        pNCSFileView                        The open file view from which to read view lines
578
 *        @param[out]        pBGRA                                        The buffer of packed UINT32 values.
579
 *        @return                                                                NCSEcwReadStatus value, NCSECW_READ_OK or any applicable error code
580
 */
581
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineBGRA( NCSFileView *pNCSFileView, UINT32 *pBGRA);
582

    
583
/*
584
** Used for testing purposes, to simulate the Inverse DWT process
585
*/
586
NCSEcwReadStatus NCS_CALL NCScbmReadViewFake( NCSFileView *pNCSFileView);        // a fake reader, for performance testing
587

    
588
/** 
589
 *        Return the major and minor versions of this SDK.
590
 *
591
 *        @param[out]        nMajor                The major version
592
 *        @param[out] nMinor                The minor version
593
 */
594
void NCSGetLibVersion( INT32 *nMajor, INT32 *nMinor );
595

    
596
/**        
597
 *        Set configuration parameters for the SDK functions
598
 *
599
 *        @param[in]        eType                The configuration parameter to set, to be followed in the variable argument list by its desired value
600
 *        @return                                        NCSError value, NCS_SUCCESS or any applicable error code
601
 */
602
NCSError NCSecwSetConfig(NCSEcwConfigType eType, ...);
603

    
604
/**        
605
 *        Get configuration parameters for the SDK functions
606
 *
607
 *        @param[in]        eType                The configuration parameter to obtain, to be followed in the variable argument list by a value buffer
608
 *        @return                                        NCSError value, NCS_SUCCESS or any applicable error code
609
 */
610
NCSError NCSecwGetConfig(NCSEcwConfigType eType, ...);
611

    
612
/**        
613
 *        Purge the memory cache being used by the SDK for the current file view.
614
 *
615
 *        @param[in]        pView                The file view which should have its cache purged
616
 */
617

    
618
extern void NCScbmPurgeCache(NCSFileView *pView);
619

    
620
// JPC wrapper entry points
621
extern void NCS_CALL NCSecwInit_ECW(void);
622
extern void NCS_CALL NCSecwShutdown_ECW(void);
623
extern NCSError NCSecwSetIOCallbacks_ECW(NCSError (NCS_CALL *pOpenCB)(char *szFileName, void **ppClientData),
624
                                                                          NCSError (NCS_CALL *pCloseCB)(void *pClientData),
625
                                                                          NCSError (NCS_CALL *pReadCB)(void *pClientData, void *pBuffer, UINT32 nLength),
626
                                                                          NCSError (NCS_CALL *pSeekCB)(void *pClientData, UINT64 nOffset),
627
                                                                          NCSError (NCS_CALL *pTellCB)(void *pClientData, UINT64 *pOffset));
628
extern void NCS_CALL NCSecwConfig_ECW(BOOLEAN bNoTextureDither, BOOLEAN bForceFileReopen);
629
extern BOOLEAN NCS_CALL NCSecwNetBreakdownUrl_ECW( char *szUrlPath,
630
                                                   char **ppProtocol,        int *pnProtocolLength,
631
                                                   char **ppHost,                int *pnHostLength,
632
                                                   char **ppFilename,        int *pnFilenameLength);
633
extern NCSError NCS_CALL NCScbmOpenFileView_ECW(char *szUrlPath, NCSFileView **ppNCSFileView,
634
                                           NCSEcwReadStatus (*pRefreshCallback)(NCSFileView *pNCSFileView));
635
extern NCSError NCS_CALL NCScbmCloseFileView_ECW(NCSFileView *pNCSFileView);
636
extern NCSError NCS_CALL NCScbmCloseFileViewEx_ECW(NCSFileView *pNCSFileView, BOOLEAN bFreeCachedFile);        /**[03]**/
637
extern NCSError NCS_CALL NCScbmGetViewFileInfo_ECW(NCSFileView *pNCSFileView, NCSFileViewFileInfo **ppNCSFileViewFileInfo);
638
extern NCSError NCS_CALL NCScbmGetViewFileInfoEx_ECW(NCSFileView *pNCSFileView, NCSFileViewFileInfoEx **ppNCSFileViewFileInfo);
639
extern NCSError NCS_CALL NCScbmGetViewInfo_ECW(NCSFileView *pNCSFileView, NCSFileViewSetInfo **ppNCSFileViewSetInfo);
640
extern NCSError NCS_CALL NCScbmSetFileView_ECW(NCSFileView *pNCSFileView,
641
                                UINT32 nBands,                                        // number of bands to read
642
                                UINT32 *pBandList,                                // index into actual band numbers from source file
643
                            UINT32 nTopX, UINT32 nLeftY,        // Top-Left in image coordinates
644
                                UINT32 nBottomX, UINT32 nRightY,// Bottom-Left in image coordinates
645
                                UINT32 nSizeX, UINT32 nSizeY);        // Output view size in window pixels
646

    
647
extern NCSError NCS_CALL NCScbmSetFileViewEx_ECW(NCSFileView *pNCSFileView,                /*[02]*/
648
                                UINT32 nBands,                                        // number of bands to read
649
                                UINT32 *pBandList,                                // index into actual band numbers from source file
650
                            UINT32 nTopX, UINT32 nLeftY,        // Top-Left in image coordinates
651
                                UINT32 nBottomX, UINT32 nRightY,// Bottom-Right in image coordinates
652
                                UINT32 nSizeX, UINT32 nSizeY,        // Output view size in window pixels
653
                                IEEE8 fTopX, IEEE8 fLeftY,                // Top-Left in world coordinates
654
                                IEEE8 fBottomX, IEEE8 fRightY);        // Bottom-Right in world coordinates
655
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineBIL_ECW( NCSFileView *pNCSFileView, UINT8 **p_p_output_line);
656
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineBILEx_ECW( NCSFileView *pNCSFileView, NCSEcwCellType eType, void **p_p_output_line);        /**[05]**/
657
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineRGB_ECW( NCSFileView *pNCSFileView, UINT8 *pRGBTriplets);
658
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineBGR_ECW( NCSFileView *pNCSFileView, UINT8 *pRGBTriplets);
659
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineRGBA_ECW( NCSFileView *pNCSFileView, UINT32 *pRGBA);
660
NCSEcwReadStatus NCS_CALL NCScbmReadViewLineBGRA_ECW( NCSFileView *pNCSFileView, UINT32 *pBGRA);
661
NCSEcwReadStatus NCS_CALL NCScbmReadViewFake_ECW( NCSFileView *pNCSFileView);        // a fake reader, for performance testing
662
NCSError NCSecwSetConfig_ECW(NCSEcwConfigType eType, ...);
663
NCSError NCSecwGetConfig_ECW(NCSEcwConfigType eType, ...);
664
extern NCSError NCSecwOpenFile_ECW(NCSFile **ppNCSFile,
665
                                                                        char *szInputFilename,                // input file name or network path
666
                                                                        BOOLEAN bReadOffsets,                // TRUE if the client wants the block Offset Table
667
                                                                        BOOLEAN bReadMemImage);                // TRUE if the client wants a Memory Image of the Header
668
extern int        NCSecwCloseFile_ECW( NCSFile *pNCSFile);
669
extern int        NCSecwReadLocalBlock_ECW( NCSFile *pNCSFile, UINT64 nBlockNumber, UINT8 **ppBlock, UINT32 *pBlockLength);
670
#ifdef MACINTOSH
671
Handle NCScbmReadFileBlockLocal_ECW(NCSFile *pNCSFile, NCSBlockId nBlock, UINT32 *pBlockLength );
672
#else
673
UINT8        *NCScbmReadFileBlockLocal_ECW(NCSFile *pNCSFile, NCSBlockId nBlock, UINT32 *pBlockLength );
674
#endif
675
extern BOOLEAN NCScbmGetFileBlockSizeLocal_ECW(NCSFile *pNCSFile, NCSBlockId nBlock, UINT32 *pBlockLength, UINT64 *pBlockOffset );
676
extern struct tagNCSEcwStatistics *NCSecwGetStatistics_ECW( void );
677
UINT32 get_qmf_tree_nr_blocks_ECW( struct qmf_level_struct *p_top_qmf );
678

    
679
void NCSInitFileInfoEx(NCSFileViewFileInfoEx *pDst);
680
void NCSFreeFileInfoEx(NCSFileViewFileInfoEx *pDst);
681
void NCSCopyFileInfoEx(NCSFileViewFileInfoEx *pDst, NCSFileViewFileInfoEx *pSrc);
682

    
683
#ifdef __cplusplus
684
}
685
#endif
686

    
687
#endif        // NCSECWCLIENT_H