MrSID Decode SDK for Raster Reference Manual  9.5.5.5244
lti_sceneBuffer.h
Go to the documentation of this file.
1 //
2 // This code is property of Celartem, Inc dba Extensis.
3 // Copyright (c) 1995-2023. All rights reserved.
4 // Use permitted only under license from Extensis.
5 //
6 /* PUBLIC */
7 
8 #ifndef LTI_SCENEBUFFER_H
9 #define LTI_SCENEBUFFER_H
10 
11 // lt_lib_mrsid_core
12 #include "lti_types.h"
13 #include "lti_pixel.h"
14 
15 
16 LT_BEGIN_LIZARDTECH_NAMESPACE
17 
54 {
55  LT_DISALLOW_COPY_CONSTRUCTOR(LTISceneBuffer);
56 public:
57 #if __cplusplus >= 201103L
58  LTISceneBuffer(LTISceneBuffer &&other) noexcept;
59  LTISceneBuffer &operator=(LTISceneBuffer &&other) noexcept;
60 #endif
61 
62 public:
63  static const double DefaultFuzzyThreshold;
64 
72 
88  LTISceneBuffer(const LTIPixel &pixelProps,
89  lt_uint32 numCols,
90  lt_uint32 numRows,
91  void **bsqData,
92  lt_uint32 totalNumCols = 0);
93  LT_STATUS initialize(const LTIPixel &pixelProps,
94  lt_uint32 numCols,
95  lt_uint32 numRows,
96  void **bsqData,
97  lt_uint32 totalNumCols = 0);
98 
99 
120  LTISceneBuffer(const LTIPixel &pixelProps,
121  lt_uint32 totalNumCols,
122  lt_uint32 totalNumRows,
123  lt_uint32 colOffset,
124  lt_uint32 rowOffset,
125  lt_uint32 numCols,
126  lt_uint32 numRows,
127  void **bsqData);
128  LT_STATUS initialize(const LTIPixel &pixelProps,
129  lt_uint32 totalNumCols,
130  lt_uint32 totalNumRows,
131  lt_uint32 colOffset,
132  lt_uint32 rowOffset,
133  lt_uint32 numCols,
134  lt_uint32 numRows,
135  void **bsqData);
136 
137 
154  lt_uint32 colOffset,
155  lt_uint32 rowOffset,
156  lt_uint32 numCols,
157  lt_uint32 numRows);
159  lt_uint32 colOffset,
160  lt_uint32 rowOffset,
161  lt_uint32 numCols,
162  lt_uint32 numRows);
163 
164 #if 0
177  LTISceneBuffer(const LTISceneBuffer &original,
178  lt_uint32 colOffset,
179  lt_uint32 rowOffset);
180 
181  LT_STATUS initialize(const LTISceneBuffer &original,
182  lt_uint32 colOffset,
183  lt_uint32 rowOffset);
184 #endif
185 
192 
201 
210 
220 
221 
232 
240  const LTIPixel &getPixelProps() const;
241 
252 
254 
255  // return -1 for not wanted
256  int getDestinationBandIndex(lt_uint16 srcBand) const;
263 
264 
273  void **getBSQData() const;
274 
283  void *getBandData(lt_uint16 band) const;
284 
296  void *getSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const;
297 
309 
319  LT_STATUS importData(const LTISceneBuffer &sourceData);
320 
333  const LTISceneBuffer& sourceData,
334  lt_uint16 srcBand);
335 
356  const LTISceneBuffer& srcBuf,
357  const LTIPixel *srcNodata,
358  const LTIPixel *dstNodata,
359  double mag,
360  double fuzzyThreshold,
361  bool blend,
362  float scaleAlpha/* = 1.0f*/);
363 
374  LT_STATUS importDataBSQ(void** data);
375 
386 
397  LT_STATUS importDataBIP(void* data, lt_uint16 firstNumBands);
398 
409 
422  // for LizardTech internal use only
423  LT_STATUS importData(const LTIMask *binaryMask,
424  const LTISceneBuffer &sourceData,
425  bool blend,
426  float scaleAlpha/* = 1.0f*/);
427 
428  // for LizardTech internal use only
430  const LTISceneBuffer& sourceData,
431  lt_uint16 srcBand,
432  const LTIMask *binaryMask);
433 
434  // for LizardTech internal use only
436  const LTISceneBuffer& srcBuf,
437  const LTIPixel *srcNodata,
438  const LTIPixel *dstNodata,
439  LTIMaskSource *mask,
440  const LTIScene &scene,
441  double fuzzyThreshold,
442  bool blend,
443  float scaleAlpha/* = 1.0f*/);
444 
454 
469  LT_STATUS exportDataBSQ(void**& data) const;
470 
485  LT_STATUS exportDataBSQ(void*& data) const;
486 
501  LT_STATUS exportDataBIP(void*& data) const;
502  LT_STATUS exportDataBIP(void *data, lt_uint16 fistNumBands) const;
503 
514 
525 
544  LT_STATUS exportData(void* data,
545  lt_uint32 pixelBytes,
546  lt_uint32 rowBytes,
547  lt_uint32 bandBytes) const;
550  void byteSwap();
551 
552  // for LizardTech internal use only
553  LT_STATUS applyMask(const LTIMask &mask, const LTIPixel &color);
554  void applyMask(const LTIMask &mask, const LTIPixel &color, lt_uint16 band);
555 
556  LT_STATUS fill(const LTIPixel &color);
557  void fill(const LTIPixel &color, lt_uint16 band);
558 
559  void zero(void);
560  void zero(lt_uint16 band);
561 
562 
578  static lt_uint32 addAlignment(lt_uint32 value, lt_uint32 byteAlignment);
579 
580  // for LizardTech internal use only
582  double mag,
583  double fuzzyThreshold,
584  bool blend,
585  const LTISceneBuffer &dstBuffer,
586  const LTIPixel *dstNodata,
587  const LTISceneBuffer &srcBuffer,
588  const LTIPixel *srcNodata,
589  LTIMask &binaryMask);
591  double mag,
592  double fuzzyThreshold,
593  bool blend,
594  const LTIPixel *srcNodata,
595  LTIMask &mask) const;
596  static void shiftNoDataValue(LTIPixelFillMethod fillMethod,
597  double fuzzyThreshold,
598  double mag,
599  const LTIPixel &dstMin,
600  const LTIPixel &dstMax,
601  const LTIPixel &dstNoData,
602  LTIPixel &shiftedValue);
604 
605 
606 #if !defined(SWIG) && 1
607 #define DEPRECATE(OLD, NEW) LT_DEPRECATED(NEW) OLD { return NEW; }
608  DEPRECATE(lt_int32 getTotalNumRows() const, getNumRows());
609  DEPRECATE(lt_int32 getWindowColOffset() const, 0);
610  DEPRECATE(lt_int32 getWindowRowOffset() const, 0);
611  DEPRECATE(lt_int32 getWindowNumCols() const, getNumCols());
612  DEPRECATE(lt_int32 getWindowNumRows() const, getNumRows());
613  DEPRECATE(lt_int32 getTotalNumPixels() const, getNumPixels());
614  DEPRECATE(lt_int32 getWindowNumPixels() const, getNumPixels());
615  DEPRECATE(void** getTotalBSQData() const, getBSQData());
616  DEPRECATE(void* getTotalBandData(lt_uint16 band) const, getBandData(band));
617  DEPRECATE(void** getWindowBSQData() const, getBSQData());
618  DEPRECATE(void* getWindowBandData(lt_uint16 band) const, getBandData(band));
619  DEPRECATE(void* getTotalSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const, getSample(x, y, band));
620  DEPRECATE(void* getWindowSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const, getSample(x, y, band));
621  DEPRECATE(bool inWindow(lt_int32 x, lt_int32 y) const, (x < getNumCols() && y < getNumRows()));
622 #undef DEPRECATE
623 #endif
624 protected:
629 
630 private:
631  void cleanup(void);
632 
633  lt_uint16 m_numBands;
634  LTIPixel m_pixelProps;
635 
636  lt_uint32 m_numCols;
637  lt_uint32 m_numRows;
638  lt_uint32 m_totalNumCols;
639 
640  void **m_data;
641  bool m_ownsData;
642 
643 
644  bool operator==(const LTISceneBuffer&) const;
645  bool operator!=(const LTISceneBuffer&) const;
646 };
647 
648 LT_END_LIZARDTECH_NAMESPACE
649 
650 #endif // LTI_SCENEBUFFER_H
lt_uint32 LT_STATUS
An integral status code.
Definition: lt_status.h:30
unsigned short lt_uint16
unsigned 16-bit integer
Definition: lt_types.h:40
unsigned int lt_uint32
unsigned 32-bit integer
Definition: lt_types.h:44
signed int lt_int32
signed 32-bit integer
Definition: lt_types.h:42
#define DEPRECATE(OLD, NEW)
This file contains a number of enums, typedefs, etc, that are used throughout the MrSID SDK.
LTIPixelFillMethod
constants representing pixel filling methods
Definition: lti_types.h:183
Abstract definition of a stream.
basic properties of a pixel
Definition: lti_pixel.h:32
representation of a scene
Definition: lti_scene.h:60
class to hold data passed between image stages
LT_STATUS exportDataBSQ(void *&data) const
export to memory (BSQ)
void applyMask(const LTIMask &mask, const LTIPixel &color, lt_uint16 band)
export to memory (BSQ)
lt_int32 getNumPixels() const
get size of exposed window
static lt_uint32 addAlignment(lt_uint32 value, lt_uint32 byteAlignment)
compute alignment constraint
LT_STATUS fill(const LTIPixel &color)
export to memory (BSQ)
lt_uint16 getSourceBandIndex(lt_uint16 dstBand) const
get width of buffer
LT_STATUS importDataBIP(void *data, lt_uint16 firstNumBands)
import from another LTISceneBuffer
LT_STATUS importDataBand(lt_uint16 dstBand, const LTISceneBuffer &sourceData, lt_uint16 srcBand, const LTIMask *binaryMask)
import from another LTISceneBuffer
LT_STATUS importDataBSQ(LTIOStreamInf &stream)
import from stream (BSQ)
LT_STATUS exportDataBIP(LTIOStreamInf &stream) const
export to stream (BIP)
lt_int32 getNumRows() const
get height of buffer
LT_STATUS exportDataBSQ(void **&data) const
export to memory (BSQ)
LT_STATUS importDataBIP(void *data)
import from memory (BIP)
int getDestinationBandIndex(lt_uint16 srcBand) const
get width of buffer
LT_STATUS mergeData(LTIPixelFillMethod fillMethod, const LTISceneBuffer &srcBuf, const LTIPixel *srcNodata, const LTIPixel *dstNodata, LTIMaskSource *mask, const LTIScene &scene, double fuzzyThreshold, bool blend, float scaleAlpha)
import from another LTISceneBuffer
LTISceneBuffer(const LTIPixel &pixelProps, lt_uint32 totalNumCols, lt_uint32 totalNumRows, lt_uint32 colOffset, lt_uint32 rowOffset, lt_uint32 numCols, lt_uint32 numRows, void **bsqData)
constructor with explicit window
void zero(lt_uint16 band)
export to memory (BSQ)
LTISceneBuffer(const LTISceneBuffer &original, lt_uint32 colOffset, lt_uint32 rowOffset, lt_uint32 numCols, lt_uint32 numRows)
constructor to overlay existing LTISceneBuffer
LT_STATUS exportData(void *data, lt_uint32 pixelBytes, lt_uint32 rowBytes, lt_uint32 bandBytes) const
export to (arbitrary) memory
LTISceneBuffer(const LTIPixel &pixelProps, lt_uint32 numCols, lt_uint32 numRows, void **bsqData, lt_uint32 totalNumCols=0)
constructor with default window
const LTIPixel & getPixelProps() const
get pixel type of buffer
LT_STATUS exportDataBIP(void *&data) const
export to memory (BIP)
LT_STATUS initialize(const LTISceneBuffer &original, lt_uint32 colOffset, lt_uint32 rowOffset, lt_uint32 numCols, lt_uint32 numRows)
destructor
static const double DefaultFuzzyThreshold
void ** getBSQData() const
get pointer to data (for all bands)
static LT_STATUS buildMask(LTIPixelFillMethod fillMethod, double mag, double fuzzyThreshold, bool blend, const LTISceneBuffer &dstBuffer, const LTIPixel *dstNodata, const LTISceneBuffer &srcBuffer, const LTIPixel *srcNodata, LTIMask &binaryMask)
export to memory (BSQ)
lt_int32 getTotalNumCols() const
get width of (entire) buffer
LT_STATUS importDataBSQ(void **data)
import from memory (BSQ)
LT_STATUS checkImpedance(const LTIPixel &p) const
verify that a buffer with the given pixel props could be imported
LTISceneBuffer()
destructor
LT_STATUS calculateMask(LTIPixelFillMethod fillMethod, double mag, double fuzzyThreshold, bool blend, const LTIPixel *srcNodata, LTIMask &mask) const
export to memory (BSQ)
LT_STATUS realloc(lt_uint32 numCols, lt_uint32 numRows)
export to memory (BSQ)
LT_STATUS mergeData(LTIPixelFillMethod fillMethod, const LTISceneBuffer &srcBuf, const LTIPixel *srcNodata, const LTIPixel *dstNodata, double mag, double fuzzyThreshold, bool blend, float scaleAlpha)
Merge pixels from another LTISceneBuffer, observing transparency.
LT_STATUS importDataBSQ(void *data)
import from memory (BSQ)
lt_uint16 getNumBands() const
get number of bands
LT_STATUS exportDataBSQ(LTIOStreamInf &stream) const
export to stream (BSQ)
~LTISceneBuffer()
destructor
LT_STATUS importData(const LTIMask *binaryMask, const LTISceneBuffer &sourceData, bool blend, float scaleAlpha)
import from another LTISceneBuffer
LT_STATUS initialize(const LTIPixel &pixelProps, lt_uint32 totalNumCols, lt_uint32 totalNumRows, lt_uint32 colOffset, lt_uint32 rowOffset, lt_uint32 numCols, lt_uint32 numRows, void **bsqData)
destructor
void byteSwap()
export to memory (BSQ)
void fill(const LTIPixel &color, lt_uint16 band)
export to memory (BSQ)
LT_STATUS importDataBIP(LTIOStreamInf &stream)
import from stream (BIP)
lt_int32 getNumCols() const
get width of buffer
LT_STATUS exportDataBIP(void *data, lt_uint16 fistNumBands) const
export to memory (BSQ)
LT_STATUS initialize(const LTIPixel &pixelProps, lt_uint32 numCols, lt_uint32 numRows, void **bsqData, lt_uint32 totalNumCols=0)
destructor
void * getBandData(lt_uint16 band) const
get pointer to data (for 1 band)
void zero(void)
export to memory (BSQ)
LT_STATUS importData(const LTISceneBuffer &sourceData)
import from another LTISceneBuffer
LT_STATUS applyMask(const LTIMask &mask, const LTIPixel &color)
export to memory (BSQ)
void * getSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const
get pointer to sample
lt_uint32 y
export to memory (BSQ)
LT_STATUS importDataBand(lt_uint16 dstBand, const LTISceneBuffer &sourceData, lt_uint16 srcBand)
import one band from another LTISceneBuffer
static void shiftNoDataValue(LTIPixelFillMethod fillMethod, double fuzzyThreshold, double mag, const LTIPixel &dstMin, const LTIPixel &dstMax, const LTIPixel &dstNoData, LTIPixel &shiftedValue)
export to memory (BSQ)

Extensis