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_opcodes.h00001 /*****************************************************************************/ 00002 // Copyright 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_opcodes.h#15 $ */ 00010 /* $DateTime: 2009/05/19 11:15:50 $ */ 00011 /* $Change: 566868 $ */ 00012 /* $Author: stern $ */ 00013 00014 /*****************************************************************************/ 00015 00016 #ifndef __dng_opcodes__ 00017 #define __dng_opcodes__ 00018 00019 /*****************************************************************************/ 00020 00021 #include "dng_auto_ptr.h" 00022 #include "dng_classes.h" 00023 #include "dng_rect.h" 00024 #include "dng_types.h" 00025 00026 /*****************************************************************************/ 00027 00028 enum dng_opcode_id 00029 { 00030 00031 // Internal use only opcode. Never written to DNGs. 00032 00033 dngOpcode_Private = 0, 00034 00035 // Warp image to correct distortion and lateral chromatic aberration for 00036 // rectilinear lenses. 00037 00038 dngOpcode_WarpRectilinear = 1, 00039 00040 // Warp image to correction distortion for fisheye lenses (i.e., map the 00041 // fisheye projection to a perspective projection). 00042 00043 dngOpcode_WarpFisheye = 2, 00044 00045 // Radial vignette correction. 00046 00047 dngOpcode_FixVignetteRadial = 3, 00048 00049 // Patch bad Bayer pixels which are marked with a special value in the image. 00050 00051 dngOpcode_FixBadPixelsConstant = 4, 00052 00053 // Patch bad Bayer pixels/rectangles at a list of specified coordinates. 00054 00055 dngOpcode_FixBadPixelsList = 5, 00056 00057 // Trim image to specified bounds. 00058 00059 dngOpcode_TrimBounds = 6, 00060 00061 // Map an area through a 16-bit LUT. 00062 00063 dngOpcode_MapTable = 7, 00064 00065 // Map an area using a polynomial function. 00066 00067 dngOpcode_MapPolynomial = 8, 00068 00069 // Apply a gain map to an area. 00070 00071 dngOpcode_GainMap = 9, 00072 00073 // Apply a per-row delta to an area. 00074 00075 dngOpcode_DeltaPerRow = 10, 00076 00077 // Apply a per-column delta to an area. 00078 00079 dngOpcode_DeltaPerColumn = 11, 00080 00081 // Apply a per-row scale to an area. 00082 00083 dngOpcode_ScalePerRow = 12, 00084 00085 // Apply a per-column scale to an area. 00086 00087 dngOpcode_ScalePerColumn = 13 00088 00089 }; 00090 00091 /*****************************************************************************/ 00092 00093 class dng_opcode 00094 { 00095 00096 public: 00097 00098 enum 00099 { 00100 kFlag_None = 0, 00101 kFlag_Optional = 1, 00102 kFlag_SkipIfPreview = 2 00103 }; 00104 00105 private: 00106 00107 uint32 fOpcodeID; 00108 00109 uint32 fMinVersion; 00110 00111 uint32 fFlags; 00112 00113 bool fWasReadFromStream; 00114 00115 uint32 fStage; 00116 00117 protected: 00118 00119 dng_opcode (uint32 opcodeID, 00120 uint32 minVersion, 00121 uint32 flags); 00122 00123 dng_opcode (uint32 opcodeID, 00124 dng_stream &stream, 00125 const char *name); 00126 00127 public: 00128 00129 virtual ~dng_opcode (); 00130 00131 uint32 OpcodeID () const 00132 { 00133 return fOpcodeID; 00134 } 00135 00136 uint32 MinVersion () const 00137 { 00138 return fMinVersion; 00139 } 00140 00141 uint32 Flags () const 00142 { 00143 return fFlags; 00144 } 00145 00146 bool Optional () const 00147 { 00148 return (Flags () & kFlag_Optional) != 0; 00149 } 00150 00151 bool SkipIfPreview () const 00152 { 00153 return (Flags () & kFlag_SkipIfPreview) != 0; 00154 } 00155 00156 bool WasReadFromStream () const 00157 { 00158 return fWasReadFromStream; 00159 } 00160 00161 uint32 Stage () const 00162 { 00163 return fStage; 00164 } 00165 00166 void SetStage (uint32 stage) 00167 { 00168 fStage = stage; 00169 } 00170 00171 virtual bool IsNOP () const 00172 { 00173 return false; 00174 } 00175 00176 virtual bool IsValidForNegative (const dng_negative & /* negative */) const 00177 { 00178 return true; 00179 } 00180 00181 virtual void PutData (dng_stream &stream) const; 00182 00183 bool AboutToApply (dng_host &host, 00184 dng_negative &negative); 00185 00186 virtual void Apply (dng_host &host, 00187 dng_negative &negative, 00188 AutoPtr<dng_image> &image) = 0; 00189 00190 }; 00191 00192 /*****************************************************************************/ 00193 00194 class dng_opcode_Unknown: public dng_opcode 00195 { 00196 00197 private: 00198 00199 AutoPtr<dng_memory_block> fData; 00200 00201 public: 00202 00203 dng_opcode_Unknown (dng_host &host, 00204 uint32 opcodeID, 00205 dng_stream &stream); 00206 00207 virtual void PutData (dng_stream &stream) const; 00208 00209 virtual void Apply (dng_host &host, 00210 dng_negative &negative, 00211 AutoPtr<dng_image> &image); 00212 00213 }; 00214 00215 /*****************************************************************************/ 00216 00217 class dng_filter_opcode: public dng_opcode 00218 { 00219 00220 protected: 00221 00222 dng_filter_opcode (uint32 opcodeID, 00223 uint32 minVersion, 00224 uint32 flags); 00225 00226 dng_filter_opcode (uint32 opcodeID, 00227 dng_stream &stream, 00228 const char *name); 00229 00230 public: 00231 00232 virtual uint32 BufferPixelType (uint32 imagePixelType) 00233 { 00234 return imagePixelType; 00235 } 00236 00237 virtual dng_rect ModifiedBounds (const dng_rect &imageBounds) 00238 { 00239 return imageBounds; 00240 } 00241 00242 virtual dng_point SrcRepeat () 00243 { 00244 return dng_point (1, 1); 00245 } 00246 00247 virtual dng_rect SrcArea (const dng_rect &dstArea, 00248 const dng_rect & /* imageBounds */) 00249 { 00250 return dstArea; 00251 } 00252 00253 virtual dng_point SrcTileSize (const dng_point &dstTileSize, 00254 const dng_rect &imageBounds) 00255 { 00256 return SrcArea (dng_rect (dstTileSize), 00257 imageBounds).Size (); 00258 } 00259 00260 virtual void Prepare (dng_negative & /* negative */, 00261 uint32 /* threadCount */, 00262 const dng_point & /* tileSize */, 00263 const dng_rect & /* imageBounds */, 00264 uint32 /* imagePlanes */, 00265 uint32 /* bufferPixelType */, 00266 dng_memory_allocator & /* allocator */) 00267 { 00268 } 00269 00270 virtual void ProcessArea (dng_negative &negative, 00271 uint32 threadIndex, 00272 dng_pixel_buffer &srcBuffer, 00273 dng_pixel_buffer &dstBuffer, 00274 const dng_rect &dstArea, 00275 const dng_rect &imageBounds) = 0; 00276 00277 virtual void Apply (dng_host &host, 00278 dng_negative &negative, 00279 AutoPtr<dng_image> &image); 00280 00281 }; 00282 00283 /*****************************************************************************/ 00284 00285 class dng_inplace_opcode: public dng_opcode 00286 { 00287 00288 protected: 00289 00290 dng_inplace_opcode (uint32 opcodeID, 00291 uint32 minVersion, 00292 uint32 flags); 00293 00294 dng_inplace_opcode (uint32 opcodeID, 00295 dng_stream &stream, 00296 const char *name); 00297 00298 public: 00299 00300 virtual uint32 BufferPixelType (uint32 imagePixelType) 00301 { 00302 return imagePixelType; 00303 } 00304 00305 virtual dng_rect ModifiedBounds (const dng_rect &imageBounds) 00306 { 00307 return imageBounds; 00308 } 00309 00310 virtual void Prepare (dng_negative & /* negative */, 00311 uint32 /* threadCount */, 00312 const dng_point & /* tileSize */, 00313 const dng_rect & /* imageBounds */, 00314 uint32 /* imagePlanes */, 00315 uint32 /* bufferPixelType */, 00316 dng_memory_allocator & /* allocator */) 00317 { 00318 } 00319 00320 virtual void ProcessArea (dng_negative &negative, 00321 uint32 threadIndex, 00322 dng_pixel_buffer &buffer, 00323 const dng_rect &dstArea, 00324 const dng_rect &imageBounds) = 0; 00325 00326 virtual void Apply (dng_host &host, 00327 dng_negative &negative, 00328 AutoPtr<dng_image> &image); 00329 00330 }; 00331 00332 /*****************************************************************************/ 00333 00334 #endif 00335 00336 /*****************************************************************************/ |