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_bad_pixels.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_bad_pixels.h#5 $ */ 00010 /* $DateTime: 2009/02/02 11:37:36 $ */ 00011 /* $Change: 537208 $ */ 00012 /* $Author: stern $ */ 00013 00014 /*****************************************************************************/ 00015 00016 #ifndef __dng_bad_pixels__ 00017 #define __dng_bad_pixels__ 00018 00019 /*****************************************************************************/ 00020 00021 #include "dng_opcodes.h" 00022 00023 #include <vector> 00024 00025 /*****************************************************************************/ 00026 00027 class dng_opcode_FixBadPixelsConstant: public dng_filter_opcode 00028 { 00029 00030 private: 00031 00032 uint32 fConstant; 00033 00034 uint32 fBayerPhase; 00035 00036 public: 00037 00038 dng_opcode_FixBadPixelsConstant (uint32 constant, 00039 uint32 bayerPhase); 00040 00041 dng_opcode_FixBadPixelsConstant (dng_stream &stream); 00042 00043 virtual void PutData (dng_stream &stream) const; 00044 00045 virtual dng_point SrcRepeat (); 00046 00047 virtual dng_rect SrcArea (const dng_rect &dstArea, 00048 const dng_rect &imageBounds); 00049 00050 virtual void Prepare (dng_negative &negative, 00051 uint32 threadCount, 00052 const dng_point &tileSize, 00053 const dng_rect &imageBounds, 00054 uint32 imagePlanes, 00055 uint32 bufferPixelType, 00056 dng_memory_allocator &allocator); 00057 00058 virtual void ProcessArea (dng_negative &negative, 00059 uint32 threadIndex, 00060 dng_pixel_buffer &srcBuffer, 00061 dng_pixel_buffer &dstBuffer, 00062 const dng_rect &dstArea, 00063 const dng_rect &imageBounds); 00064 00065 protected: 00066 00067 bool IsGreen (int32 row, int32 col) const 00068 { 00069 return ((row + col + fBayerPhase + (fBayerPhase >> 1)) & 1) == 0; 00070 } 00071 00072 }; 00073 00074 /*****************************************************************************/ 00075 00076 class dng_bad_pixel_list 00077 { 00078 00079 public: 00080 00081 enum 00082 { 00083 kNoIndex = 0xFFFFFFFF 00084 }; 00085 00086 private: 00087 00088 // List of bad single pixels. 00089 00090 std::vector<dng_point> fBadPoints; 00091 00092 // List of bad rectangles (usually single rows or columns). 00093 00094 std::vector<dng_rect> fBadRects; 00095 00096 public: 00097 00098 dng_bad_pixel_list (); 00099 00100 uint32 PointCount () const 00101 { 00102 return (uint32) fBadPoints.size (); 00103 } 00104 00105 const dng_point & Point (uint32 index) const 00106 { 00107 return fBadPoints [index]; 00108 } 00109 00110 uint32 RectCount () const 00111 { 00112 return (uint32) fBadRects.size (); 00113 } 00114 00115 const dng_rect & Rect (uint32 index) const 00116 { 00117 return fBadRects [index]; 00118 } 00119 00120 bool IsEmpty () const 00121 { 00122 return PointCount () == 0 && 00123 RectCount () == 0; 00124 } 00125 00126 bool NotEmpty () const 00127 { 00128 return !IsEmpty (); 00129 } 00130 00131 void AddPoint (const dng_point &pt); 00132 00133 void AddRect (const dng_rect &r); 00134 00135 void Sort (); 00136 00137 bool IsPointIsolated (uint32 index, 00138 uint32 radius) const; 00139 00140 bool IsRectIsolated (uint32 index, 00141 uint32 radius) const; 00142 00143 bool IsPointValid (const dng_point &pt, 00144 const dng_rect &imageBounds, 00145 uint32 index = kNoIndex) const; 00146 00147 }; 00148 00149 /*****************************************************************************/ 00150 00151 class dng_opcode_FixBadPixelsList: public dng_filter_opcode 00152 { 00153 00154 protected: 00155 00156 enum 00157 { 00158 kBadPointPadding = 2, 00159 kBadRectPadding = 4 00160 }; 00161 00162 private: 00163 00164 AutoPtr<dng_bad_pixel_list> fList; 00165 00166 uint32 fBayerPhase; 00167 00168 public: 00169 00170 dng_opcode_FixBadPixelsList (AutoPtr<dng_bad_pixel_list> &list, 00171 uint32 bayerPhase); 00172 00173 dng_opcode_FixBadPixelsList (dng_stream &stream); 00174 00175 virtual void PutData (dng_stream &stream) const; 00176 00177 virtual dng_point SrcRepeat (); 00178 00179 virtual dng_rect SrcArea (const dng_rect &dstArea, 00180 const dng_rect &imageBounds); 00181 00182 virtual void Prepare (dng_negative &negative, 00183 uint32 threadCount, 00184 const dng_point &tileSize, 00185 const dng_rect &imageBounds, 00186 uint32 imagePlanes, 00187 uint32 bufferPixelType, 00188 dng_memory_allocator &allocator); 00189 00190 virtual void ProcessArea (dng_negative &negative, 00191 uint32 threadIndex, 00192 dng_pixel_buffer &srcBuffer, 00193 dng_pixel_buffer &dstBuffer, 00194 const dng_rect &dstArea, 00195 const dng_rect &imageBounds); 00196 00197 protected: 00198 00199 bool IsGreen (int32 row, int32 col) const 00200 { 00201 return ((row + col + fBayerPhase + (fBayerPhase >> 1)) & 1) == 0; 00202 } 00203 00204 virtual void FixIsolatedPixel (dng_pixel_buffer &buffer, 00205 dng_point &badPoint); 00206 00207 virtual void FixClusteredPixel (dng_pixel_buffer &buffer, 00208 uint32 pointIndex, 00209 const dng_rect &imageBounds); 00210 00211 virtual void FixSingleColumn (dng_pixel_buffer &buffer, 00212 const dng_rect &badRect); 00213 00214 virtual void FixSingleRow (dng_pixel_buffer &buffer, 00215 const dng_rect &badRect); 00216 00217 virtual void FixClusteredRect (dng_pixel_buffer &buffer, 00218 const dng_rect &badRect, 00219 const dng_rect &imageBounds); 00220 00221 }; 00222 00223 /*****************************************************************************/ 00224 00225 #endif 00226 00227 /*****************************************************************************/ |