Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Purpose: Implementation of the PCIDSKInterfaces class. 4 : * 5 : ****************************************************************************** 6 : * Copyright (c) 2009 7 : * PCI Geomatics, 90 Allstate Parkway, Markham, Ontario, Canada. 8 : * 9 : * SPDX-License-Identifier: MIT 10 : ****************************************************************************/ 11 : 12 : #include "pcidsk_config.h" 13 : #include "pcidsk_types.h" 14 : #include "pcidsk_utils.h" 15 : #include "pcidsk_interfaces.h" 16 : #include "pcidsk_mutex.h" 17 : #include "core/pcidsk_utils.h" 18 : 19 : using namespace PCIDSK; 20 : 21 : /************************************************************************/ 22 : /* PCIDSKInterfaces() */ 23 : /* */ 24 : /* This constructor just defaults all the interfaces and */ 25 : /* functions to the default implementation. */ 26 : /************************************************************************/ 27 : 28 641 : PCIDSKInterfaces::PCIDSKInterfaces() 29 : 30 : { 31 641 : io = GetDefaultIOInterfaces(); 32 641 : OpenEDB = DefaultOpenEDB; 33 641 : MergeRelativePath = DefaultMergeRelativePath; 34 641 : CreateMutex = DefaultCreateMutex; 35 641 : Debug = DefaultDebug; 36 : 37 : #if defined(HAVE_LIBJPEG) 38 641 : JPEGDecompressBlock = LibJPEG_DecompressBlock; 39 641 : JPEGCompressBlock = LibJPEG_CompressBlock; 40 : #else 41 : JPEGDecompressBlock = NULL; 42 : JPEGCompressBlock = NULL; 43 : #endif 44 641 : } 45 : 46 : /** 47 : 48 : \var const IOInterfaces *PCIDSKInterfaces::io; 49 : 50 : \brief Pointer to IO Interfaces. 51 : 52 : ***************************************************************************/ 53 : 54 : /** 55 : 56 : \var Mutex *(*PCIDSKInterfaces::CreateMutex)(void); 57 : 58 : \brief Function to create a mutex 59 : 60 : ***************************************************************************/ 61 : 62 : /** 63 : 64 : \var void (*PCIDSKInterfaces::JPEGDecompressBlock)(uint8 *src_data, int src_bytes, uint8 *dst_data, int dst_bytes, int xsize, int ysize, eChanType pixel_type); 65 : 66 : \brief Function to decompress a jpeg block 67 : 68 : This function may be NULL if there is no jpeg interface available. 69 : 70 : The default implementation is implemented using libjpeg. 71 : 72 : The function decodes the jpeg compressed image in src_data (src_bytes long) 73 : into dst_data (dst_bytes long) as image data. The result should be exactly 74 : dst_bytes long, and will be an image of xsize x ysize of type pixel_type 75 : (currently on CHN_8U is allowed). 76 : 77 : Errors should be thrown as exceptions. 78 : 79 : ***************************************************************************/ 80 : 81 : /** 82 : 83 : \var void (*PCIDSKInterfaces::JPEGCompressBlock)(uint8 *src_data, int src_bytes, uint8 *dst_data, int &dst_bytes, int xsize, int ysize, eChanType pixel_type); 84 : 85 : \brief Function to compress a jpeg block 86 : 87 : This function may be NULL if there is no jpeg interface available. 88 : 89 : The default implementation is implemented using libjpeg. 90 : 91 : The function encodes the image in src_data (src_bytes long) 92 : into dst_data as compressed jpeg data. The passed in value of dst_bytes is the 93 : size of the passed in dst_data array (it should be large enough to hold 94 : any compressed result0 and dst_bytes will be returned with the resulting 95 : actual number of bytes used. 96 : 97 : Errors should be thrown as exceptions. 98 : 99 : ***************************************************************************/ 100 :