/usr/include/ossim/imaging/ossimNormalizedU12RemapTable.h is in libossim-dev 2.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | //*******************************************************************
//
// License: MIT
//
// See LICENSE.txt file in the top level directory for more details.
//
// Description:
//
// Contains class declaration for ossimNormalizedU12RemapTable. Table for
// normalizing unsigned 11 bit data.
//
//*******************************************************************
// $Id: ossimNormalizedU12RemapTable.h 16034 2009-12-03 14:49:25Z dburken $
#ifndef ossimNormalizedU12RemapTable_HEADER
#define ossimNormalizedU12RemapTable_HEADER
#include <ossim/imaging/ossimNormalizedRemapTable.h>
#include <ossim/base/ossimCommon.h> /* for round */
/**
* @class ossimNormalizedU12RemapTable
*
* @brief Twelve bit normalized remap table to go to/from normalized value
* to pixel value.
*/
class OSSIM_DLL ossimNormalizedU12RemapTable : public ossimNormalizedRemapTable
{
public:
/** @brief default constructor */
ossimNormalizedU12RemapTable();
/** @brief virtual destructor */
virtual ~ossimNormalizedU12RemapTable();
enum
{
TABLE_ENTRIES = 4096 // 2^12
};
/**
* @brief Gets the number of table entries.
* @return The number of entries in a table.
*/
virtual ossim_int32 getEntries() const;
/**
* @brief Gets a normalized value (between '0.0' and '1.0') from
* a pixel value.
*
* @return Value between 0.0 and 1.0.
*/
virtual ossim_float64 operator[](ossim_int32 pix) const;
/**
* @brief Gets a normalized value (between '0.0' and '1.0') from
* a pixel value.
*
* @return Value between 0.0 and 1.0.
*/
virtual ossim_float64 normFromPix(ossim_int32 pix) const;
/**
* @brief Returns an pixel value as an int from a normalized value.
*
* @return Value between scalar range of remap table.
*/
virtual ossim_int32 pixFromNorm(ossim_float64 normPix) const;
private:
static ossim_float64 theTable[TABLE_ENTRIES];
static bool theTableIsInitialized;
};
inline ossim_int32 ossimNormalizedU12RemapTable::getEntries() const
{
return TABLE_ENTRIES;
}
inline ossim_float64 ossimNormalizedU12RemapTable::operator[](
ossim_int32 pix) const
{
return ( (pix < TABLE_ENTRIES) ? (pix >= 0 ? theTable[pix] : 0.0) : 1.0);
}
inline ossim_float64 ossimNormalizedU12RemapTable::normFromPix(
ossim_int32 pix) const
{
return ( (pix < TABLE_ENTRIES) ? (pix >= 0 ? theTable[pix] : 0.0) : 1.0);
}
inline ossim_int32 ossimNormalizedU12RemapTable::pixFromNorm(
ossim_float64 normPix) const
{
if(normPix <= 0.0) return 0;
// un-normalize...
ossim_float64 p = normPix * getNormalizer();
// Ensure pixel is in range.
p = ( (p < TABLE_ENTRIES) ? (p >= 0.0 ? p : 0.0) : getNormalizer());
// Since going from double to int round...
p = ossim::round<ossim_int32>(p);
if(p == 0.0)
{
p = 1.0;
}
return static_cast<ossim_int32>(p);
}
#endif
|