1 : /******************************************************************************
2 : *
3 : * Purpose: Implementation of the PCIDSKInterfaces class.
4 : *
5 : ******************************************************************************
6 : * Copyright (c) 2009
7 : * PCI Geomatics, 50 West Wilmot Street, Richmond Hill, Ont, Canada
8 : *
9 : * Permission is hereby granted, free of charge, to any person obtaining a
10 : * copy of this software and associated documentation files (the "Software"),
11 : * to deal in the Software without restriction, including without limitation
12 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 : * and/or sell copies of the Software, and to permit persons to whom the
14 : * Software is furnished to do so, subject to the following conditions:
15 : *
16 : * The above copyright notice and this permission notice shall be included
17 : * in all copies or substantial portions of the Software.
18 : *
19 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 : * DEALINGS IN THE SOFTWARE.
26 : ****************************************************************************/
27 :
28 : #include "pcidsk_config.h"
29 : #include "pcidsk_types.h"
30 : #include "pcidsk_utils.h"
31 : #include "pcidsk_interfaces.h"
32 : #include "pcidsk_mutex.h"
33 :
34 : using namespace PCIDSK;
35 :
36 : /************************************************************************/
37 : /* PCIDSKInterfaces() */
38 : /* */
39 : /* This constructor just defaults all the interfaces and */
40 : /* functions to the default implementation. */
41 : /************************************************************************/
42 :
43 278 : PCIDSKInterfaces::PCIDSKInterfaces()
44 :
45 : {
46 278 : io = GetDefaultIOInterfaces();
47 278 : OpenEDB = DefaultOpenEDB;
48 278 : CreateMutex = DefaultCreateMutex;
49 278 : Debug = DefaultDebug;
50 :
51 : #if defined(HAVE_LIBJPEG)
52 278 : JPEGDecompressBlock = LibJPEG_DecompressBlock;
53 278 : JPEGCompressBlock = LibJPEG_CompressBlock;
54 : #else
55 : JPEGDecompressBlock = NULL;
56 : JPEGCompressBlock = NULL;
57 : #endif
58 :
59 278 : }
60 :
61 : /**
62 :
63 : \var const IOInterfaces *PCIDSKInterfaces::io;
64 :
65 : \brief Pointer to IO Interfaces.
66 :
67 : ***************************************************************************/
68 :
69 : /**
70 :
71 : \var Mutex *(*PCIDSKInterfaces::CreateMutex)(void);
72 :
73 : \brief Function to create a mutex
74 :
75 : ***************************************************************************/
76 :
77 : /**
78 :
79 : \var void (*PCIDSKInterfaces::JPEGDecompressBlock)(uint8 *src_data, int src_bytes, uint8 *dst_data, int dst_bytes, int xsize, int ysize, eChanType pixel_type);
80 :
81 : \brief Function to decompress a jpeg block
82 :
83 : This function may be NULL if there is no jpeg interface available.
84 :
85 : The default implementation is implemented using libjpeg.
86 :
87 : The function decodes the jpeg compressed image in src_data (src_bytes long)
88 : into dst_data (dst_bytes long) as image data. The result should be exactly
89 : dst_bytes long, and will be an image of xsize x ysize of type pixel_type
90 : (currently on CHN_8U is allowed).
91 :
92 : Errors should be thrown as exceptions.
93 :
94 : ***************************************************************************/
95 :
96 : /**
97 :
98 : \var void (*PCIDSKInterfaces::JPEGCompressBlock)(uint8 *src_data, int src_bytes, uint8 *dst_data, int &dst_bytes, int xsize, int ysize, eChanType pixel_type);
99 :
100 : \brief Function to compress a jpeg block
101 :
102 : This function may be NULL if there is no jpeg interface available.
103 :
104 : The default implementation is implemented using libjpeg.
105 :
106 : The function encodes the image in src_data (src_bytes long)
107 : into dst_data as compressed jpeg data. The passed in value of dst_bytes is the
108 : size of the passed in dst_data array (it should be large enough to hold
109 : any compressed result0 and dst_bytes will be returned with the resulting
110 : actual number of bytes used.
111 :
112 : Errors should be thrown as exceptions.
113 :
114 : ***************************************************************************/
115 :
|