DocumentationOverviewBuilding ASL Documentation Library Wiki Docs Indices Browse Perforce More InfoRelease NotesWiki Site Search License Success Stories Contributors MediaDownloadPerforce Depots SupportASL SourceForge HomeMailing Lists Discussion Forums Report Bugs Suggest Features Contribute to ASL RSSShort-text newsFull-text news File releases Other Adobe ProjectsAdobe AirAdobe GIL Adobe Labs Adobe Media Gallery Adobe XMP Tamarin project (Mozilla Foundation) Other ResourcesBoostRIAForge SGI STL |
dng_1d_table.hGo to the documentation of this file.00001 /*****************************************************************************/ 00002 // Copyright 2006-2008 Adobe Systems Incorporated 00003 // All Rights Reserved. 00004 // 00005 // NOTICE: Adobe permits you to use, modify, and distribute this file in 00006 // accordance with the terms of the Adobe license agreement accompanying it. 00007 /*****************************************************************************/ 00008 00009 /* $Id: //mondo/workarea/stern/camera_raw/dng_sdk/source/dng_1d_table.h#12 $ */ 00010 /* $DateTime: 2009/01/04 08:52:38 $ */ 00011 /* $Change: 529402 $ */ 00012 /* $Author: stern $ */ 00013 00018 /*****************************************************************************/ 00019 00020 #ifndef __dng_1d_table__ 00021 #define __dng_1d_table__ 00022 00023 /*****************************************************************************/ 00024 00025 #include "dng_assertions.h" 00026 #include "dng_auto_ptr.h" 00027 #include "dng_classes.h" 00028 #include "dng_types.h" 00029 00030 /*****************************************************************************/ 00031 00033 00034 class dng_1d_table 00035 { 00036 00037 public: 00038 00040 00041 enum 00042 { 00043 kTableBits = 12, //< Table is always a power of 2 in size. This is log2(kTableSize). 00044 kTableSize = (1 << kTableBits) //< Number of entries in table. 00045 }; 00046 00047 protected: 00048 00049 AutoPtr<dng_memory_block> fBuffer; 00050 00051 real32 *fTable; 00052 00053 public: 00054 00055 dng_1d_table (); 00056 00057 virtual ~dng_1d_table (); 00058 00064 00065 void Initialize (dng_memory_allocator &allocator, 00066 const dng_1d_function &function, 00067 bool subSample = false); 00068 00072 00073 real32 Interpolate (real32 x) const 00074 { 00075 00076 real32 y = x * (real32) kTableSize; 00077 00078 int32 index = (int32) y; 00079 00080 DNG_ASSERT (index >= 0 && index <= kTableSize, 00081 "dng_1d_table::Interpolate parameter out of range"); 00082 00083 real32 z = (real32) index; 00084 00085 real32 fract = y - z; 00086 00087 return fTable [index ] * (1.0f - fract) + 00088 fTable [index + 1] * ( fract); 00089 00090 } 00091 00093 00094 const real32 * Table () const 00095 { 00096 return fTable; 00097 } 00098 00100 00101 void Expand16 (uint16 *table16) const; 00102 00103 private: 00104 00105 void SubDivide (const dng_1d_function &function, 00106 uint32 lower, 00107 uint32 upper, 00108 real32 maxDelta); 00109 00110 // Hidden copy constructor and assignment operator. 00111 00112 dng_1d_table (const dng_1d_table &table); 00113 00114 dng_1d_table & operator= (const dng_1d_table &table); 00115 00116 }; 00117 00118 /*****************************************************************************/ 00119 00120 #endif 00121 00122 /*****************************************************************************/ |