1 // ---------------------------------------------------------------------------- 2 // MODULE : PTileFlashPix 3 // LANGUAGE : C++ 4 // CREATOR : Philippe BOSSUT 5 // CREAT. DATE : Wednesday, March 20, 1996 6 // DESCRIPTION : 7 // COMMENTS : 8 // SCCSID : @(#)ptil_fpx.h 1.2 14:44:16 06 Jan 1997 9 // ---------------------------------------------------------------------------- 10 // Copyright (c) 1999 Digital Imaging Group, Inc. 11 // For conditions of distribution and use, see copyright notice 12 // in Flashpix.h 13 // ---------------------------------------------------------------------------- 14 #ifndef PTileFlashPix_h 15 #define PTileFlashPix_h 16 #ifndef Commun_h 17 #include "common.h" 18 #endif 19 // ---------------------------------------------------------------------------- 20 21 // Includes 22 // -------- 23 #ifndef PTile_h 24 #include "ptile.h" 25 #endif 26 27 #ifndef FPXBaselineIO_h 28 #include "fpxlibio.h" 29 #endif 30 31 // Constants 32 // --------- 33 34 // Types Declarations 35 // ------------------ 36 typedef struct { 37 double capture; // capture MTF, MTFc(s) 38 double prefilter; // prefilter MTF, MTFd(s) 39 double printer; // printer and media MTF, MTFd(s) 40 double fraction; // relative size of viewed picture, w 41 long level; // resolution level to which filtering is applied. 42 // level = 0 is the top (full) resolution layer. 43 // Note that this is referred as k in the FPX Spec 44 long height_o; // height in pixels of the full-resolution image in 45 // the hierarchy (No) 46 long height_p; // height in pixels of the image requested by the 47 // application ie. the displayed or printed image (Np) 48 long height_r; // height in pixels of image level, FiltP.level (Nk) 49 double delta_A; // change in acutance 50 double total; // Total system MTF, MTFt(s) 51 FPXBaselineColorSpace colorSpace; // defines color space for filtering. 52 } filtParmS, *filtParmP; 53 54 55 typedef struct { 56 double width; // Gaussian filter width 57 long elements; // number of elements, n, in filter 58 double kernel[9]; // n elements specifies a (2n-1) point kernel 59 } firS, *firP; 60 61 62 typedef struct { // packed lut structure 63 long lut0[256]; // stage 0 for 5-pt kernel 64 long lut1[256]; // stage 1 for 11-pt kernel 65 long lut2[256]; // stage 2 for 17-pt kernel 66 long bias; // accumulated stage biases 67 long stages; // # of stages used: 1,2,3 68 } lutS, *lutP; 69 70 71 72 // Types Definitions 73 // ----------------- 74 75 // Classes Declarations 76 // -------------------- 77 class PResolutionFlashPix; 78 class PFlashPixFile; 79 class PTileFlashPix; 80 81 // Classes Definitions 82 // ------------------- 83 // Block class. Block keep memory of the pixels themselves. 84 class PTileFlashPix : public PTile { 85 86 friend class PHierarchicalImage; 87 friend class PResolutionLevel; 88 friend class PResolutionFlashPix; 89 90 public: 91 PTileFlashPix(); 92 ~PTileFlashPix(); 93 94 // Public interface: Methods implementing the file specific tile description: 95 // -------------------------------------------------------------------------- 96 97 // Read and write a tile: 98 virtual FPXStatus Read(); // Read display-modified pixels from file 99 100 FPXStatus makePaddedRawPixels(long padLen, Pixel **paddedRawPixels); 101 102 virtual FPXStatus Write(); // Write pixels in file 103 104 // Set information tools 105 virtual void InitializeRead (PResolutionLevel* father, long offset, 106 long sizetile, long id, 107 long compression = 0, 108 long theCompressionSubtype = 0); // Init tile in read mode 109 110 // Read jpeg header from image content property set 111 Boolean ReadHeader(PFlashPixFile* filePtr, 112 unsigned char** pJpegHeader, 113 unsigned long* headerSize); 114 115 // Write jpeg table to image content property set 116 Boolean WriteHeader(PFlashPixFile* filePtr, 117 unsigned char* jpegHeader, unsigned long headerSize); 118 119 // Convert the FPX compression code to index of compressor 120 virtual TLC_IdCodec ConvertCompressionOption (); 121 FPXStatus Contrast(double k,FPXBaselineColorSpace colorSpace, 122 Pixel *pixels,long count); 123 124 FPXStatus ApplyFilter(FPXBaselineColorSpace colorSpace); // in filter.cpp 125 126 // Raw data read and write functions 127 FPXStatus ReadRawPixels(); 128 129 // Raw tile read and write functions 130 FPXStatus ReadRawTile (FPXCompressionOption* compressOption, 131 unsigned char* compressQuality, 132 long* compressSubtype, 133 unsigned int* dataLength, 134 void** data); 135 FPXStatus WriteRawTile (FPXCompressionOption compressOption, 136 unsigned char compressQuality, 137 long compressSubtype, 138 unsigned int dataLength, 139 void* data); 140 protected: 141 FPXStatus UnsharpMask(filtParmS *FiltP); // in filter.cpp 142 FPXStatus BlurFilter(filtParmS *FiltP); // in filter.cpp 143 FPXStatus Convolve(unsigned char *in, long pad, lutS *luts, 144 unsigned char * out); // in filter.cpp 145 FPXStatus InitPackedLuts(double *kernel, long n); // in filter.cpp 146 void Fastconv( unsigned char *src, long len, long padLen, 147 long stride, lutS *luts, unsigned char *dst); 148 long GetFilterKernels(firS *Gauss_array, long *NumKernels); // in filter.cpp 149 150 }; 151 152 153 154 // 'inline' Functions 155 // ------------------ 156 157 158 // 'extern' Functions 159 // ------------------ 160 161 // 'extern' Variables 162 // ------------------ 163 164 // ---------------------------------------------------------------------------- 165 #endif // PTileFlashPix_h 166 // ---------------------------------------------------------------------------- 167 168