Author: post
Date: 2010-04-25 22:06:19 +0200 (Sun, 25 Apr 2010)
New Revision: 231

Modified:
   RawSpeed/RawDecoder.h
Log:
Document RawDecoder functions - make a few functions protected.

Modified: RawSpeed/RawDecoder.h
===================================================================
--- RawSpeed/RawDecoder.h       2010-04-25 19:43:36 UTC (rev 230)
+++ RawSpeed/RawDecoder.h       2010-04-25 20:06:19 UTC (rev 231)
@@ -32,6 +32,7 @@
 
 class RawDecoder;
 
+/* Class with information delivered to RawDecoder::decodeThreaded() */
 class RawDecoderThread
 {
   public:
@@ -46,23 +47,85 @@
 class RawDecoder 
 {
 public:
+  /* Construct decoder instance - FileMap is a filemap of the file to be 
decoded */
+  /* The FileMap is not owned by this class, will not be deleted, and must 
remain */
+  /* valid while this object exists */
   RawDecoder(FileMap* file);
   virtual ~RawDecoder(void);
+
+  /* Check if the decoder can decode the image from this camera */
+  /* A RawDecoderException will be thrown if the camera isn't supported */
+  /* Unknown cameras does NOT generate any specific feedback */
+  /* This function must be overridden by actual decoders */
+  virtual void checkSupport(CameraMetaData *meta) = 0;
+
+  /* Attempt to decode the image */
+  /* A RawDecoderException will be thrown if the image cannot be decoded, */
+  /* and there will not be any data in the mRaw image. */
+  /* This function must be overridden by actual decoders. */
   virtual RawImage decodeRaw() = 0;
-  virtual void checkSupport(CameraMetaData *meta) = 0;
+
+  /* This will apply metadata information from the camera database, */
+  /* such as crop, black+white level, etc. */
+  /* This function is expected to use the protected "setMetaData" */
+  /* after retrieving make, model and mode if applicate. */
+  /* If meta-data is set during load, this function can be empty. */
+  /* The image is expected to be cropped after this, but black/whitelevel */
+  /* compensation is not expected to be applied to the image */
   virtual void decodeMetaData(CameraMetaData *meta) = 0;
+
+  /* Called function for filters that are capable of doing simple 
multi-threaded decode */
+  /* The delivered class gives information on what part of the image should be 
decoded. */
   virtual void decodeThreaded(RawDecoderThread* t);
-  FileMap *mFile; 
-  void readUncompressedRaw(ByteStream &input, iPoint2D& size, iPoint2D& 
offset, int inputPitch, int bitPerPixel, gboolean MSBOrder);
+
+  /* The decoded image - undefined if image has not or could not be decoded. */
+  /* Remember this is automatically refcounted, so a reference is retained 
until this class is destroyed */
   RawImage mRaw; 
+
+  /* Vector containing silent errors that occurred doing decoding, that may 
have lead to */
+  /* an incomplete image. */
   vector<const char*> errors;
+
+
 protected:
+  /* Helper function for decoders - splits the image vertically and starts of 
decoder threads */
+  /* The function returns when all threads are done */
+  /* All errors are silently pushed into the "errors" array.*/
+  /* If all threads report an error an exception will be thrown*/
   void startThreads();
+
+  /* Check the camera and mode against the camera database. */
+  /* A RawDecoderException will be thrown if the camera isn't supported */
+  /* Unknown cameras does NOT generate any errors */
   void checkCameraSupported(CameraMetaData *meta, string make, string model, 
string mode);
+
+  /* Helper function for decodeMetaData(), that find the camera in the 
CameraMetaData DB */
+  /* and sets common settings such as crop, black- white level, and sets CFA 
information */
   virtual void setMetaData(CameraMetaData *meta, string make, string model, 
string mode);
+
+  /* Helper function for decoders, that will unpack uncompressed image data */
+  /* input: Input image, positioned at first pixel */
+  /* size: Size of the image to decode in pixels */
+  /* offset: offset to write the data into the final image */
+  /* inputPitch: Number of bytes between each line in the input image */
+  /* bitPerPixel: Number of bits to read for each input pixel. */
+  /* MSBOrder: true -  bits are read from MSB (JPEG style) False: Read from 
LSB. */
+  void readUncompressedRaw(ByteStream &input, iPoint2D& size, iPoint2D& 
offset, int inputPitch, int bitPerPixel, gboolean MSBOrder);
+
+  /* Faster version for unpacking 12 bit LSB data */
   void Decode12BitRaw(ByteStream &input, guint w, guint h);
+
+  /* Remove all spaces at the end of a string */
   void TrimSpaces( string& str);
-  gint getDecoderVersion() {return decoderVersion;};
+
+  /* The Raw input file to be decoded */
+  FileMap *mFile; 
+
+  /* Decoder version - defaults to 0, but can be overridden by decoders */
+  /* This can be used to avoid newer version of an xml file to indicate that a 
file */
+  /* can be decoded, when a specific version of the code is needed */
+  /* Higher number in camera xml file: Files for this camera will not be 
decoded */
+  /* Higher number in code than xml: Image will be decoded. */
   gint decoderVersion;
 };
 


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to