1 /****************************************************************************** 2 * Project: GDAL 3 * Author: Raul Alonso Reyes <raul dot alonsoreyes at satcen dot europa dot eu> 4 * Author: Even Rouault, <even dot rouault at spatialys dot com> 5 * Purpose: JPEG-2000 driver based on Lurawave library, driver developed by SatCen 6 * 7 ****************************************************************************** 8 * Copyright (c) 2016, SatCen - European Union Satellite Centre 9 * Copyright (c) 2016, Even Rouault 10 * 11 * Permission is hereby granted, free of charge, to any person obtaining a 12 * copy of this software and associated documentation files (the "Software"), 13 * to deal in the Software without restriction, including without limitation 14 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 15 * and/or sell copies of the Software, and to permit persons to whom the 16 * Software is furnished to do so, subject to the following conditions: 17 * 18 * The above copyright notice and this permission notice shall be included 19 * in all copies or substantial portions of the Software. 20 * 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 * DEALINGS IN THE SOFTWARE. 28 ****************************************************************************/ 29 30 #ifndef JP2LURADATASET_H_INCLUDED 31 #define JP2LURADATASET_H_INCLUDED 32 33 #include "gdaljp2abstractdataset.h" 34 #include "jp2luracallbacks.h" 35 #include "gdaljp2metadata.h" 36 37 class JP2LuraDataset final: public GDALJP2AbstractDataset 38 { 39 friend class JP2LuraRasterBand; 40 41 VSILFILE *fp; // Large FILE API 42 43 int iLevel; 44 int nOverviewCount; 45 JP2LuraDataset** papoOverviewDS; 46 GDALJP2Lura_Output_Data sOutputData; 47 GDALColorTable* poCT; 48 JP2_Colorspace eColorspace; 49 int nRedIndex; 50 int nGreenIndex; 51 int nBlueIndex; 52 int nAlphaIndex; 53 54 #ifdef ENABLE_MEMORY_REGISTRAR 55 JP2LuraMemoryRegistrar oMemoryRegistrar; 56 #endif 57 58 public: 59 JP2LuraDataset(); 60 ~JP2LuraDataset(); 61 62 static int Identify(GDALOpenInfo * poOpenInfo); 63 static GDALDataset *Open(GDALOpenInfo *); 64 static GDALDataset *CreateCopy(const char * pszFilename, 65 GDALDataset *poSrcDS, 66 int bStrict, char ** papszOptions, 67 GDALProgressFunc pfnProgress, 68 void * pProgressData); 69 70 71 virtual CPLErr IRasterIO(GDALRWFlag eRWFlag, 72 int nXOff, int nYOff, int nXSize, int nYSize, 73 void * pData, int nBufXSize, int nBufYSize, 74 GDALDataType eBufType, 75 int nBandCount, int *panBandMap, 76 GSpacing nPixelSpace, GSpacing nLineSpace, 77 GSpacing nBandSpace, 78 GDALRasterIOExtraArg* psExtraArg) override; 79 80 81 static void WriteBox(VSILFILE* fp, GDALJP2Box* poBox); 82 static void WriteGDALMetadataBox(VSILFILE* fp, GDALDataset* poSrcDS, 83 char** papszOptions); 84 static void WriteXMLBoxes(VSILFILE* fp, GDALDataset* poSrcDS, 85 char** papszOptions); 86 static void WriteXMPBox(VSILFILE* fp, GDALDataset* poSrcDS, 87 char** papszOptions); 88 89 static const char* GetErrorMessage( long nErrorCode ); 90 }; 91 92 #endif 93