Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

OFbkImage.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifdef PLATFORM_APERIOS
00003 #  include <OPENR/OFbkImage.h>
00004 #else
00005 #  ifndef INCLUDED_OFbkImage_h_
00006 #  define INCLUDED_OFbkImage_h_
00007 
00008 #include "Shared/ODataFormats.h"
00009 
00010 typedef longword OFbkImageBand;
00011 const OFbkImageBand ofbkimageBAND_Y    = 0; // Y_LL
00012 const OFbkImageBand ofbkimageBAND_Cr   = 1;
00013 const OFbkImageBand ofbkimageBAND_Cb   = 2;
00014 const OFbkImageBand ofbkimageBAND_CDT  = 3;
00015 const OFbkImageBand ofbkimageBAND_Y_LH = 4;
00016 const OFbkImageBand ofbkimageBAND_Y_HL = 5;
00017 const OFbkImageBand ofbkimageBAND_Y_HH = 6;
00018 
00019 class OFbkImage {
00020 public:
00021   OFbkImage(OFbkImageInfo* /*info*/, byte* /*data*/, OFbkImageBand /*band*/) : image_(NULL), width_(0), height_(0), skip_(0) {}
00022   ~OFbkImage() {}
00023 
00024   bool   IsValid() const { return image_ != 0 ? true : false; }
00025   byte*  Pointer() const { return image_;    }
00026   int    Width()   const { return width_;    }
00027   int    Height()  const { return height_;   }
00028   int    Skip()  const { return skip_;     }
00029 
00030   inline byte Pixel(int x, int y) const;
00031 
00032   // Tag Information
00033   inline word FieldCounter() const;
00034   inline byte ColorFrequency(OCdtChannel chan) const;
00035 
00036 
00037 protected:
00038   byte* image_;
00039   int   width_;
00040   int   height_;
00041   int   skip_;
00042   
00043 private:
00044   OFbkImage(const OFbkImage&); //!< don't call
00045   OFbkImage& operator =(const OFbkImage& fbk_image); //!< don't call
00046 };
00047 
00048 byte
00049 OFbkImage::Pixel(int x, int y) const
00050 {
00051   return *(image_ + (width_ + skip_) * y + x);
00052 }
00053 
00054 word
00055 OFbkImage::FieldCounter() const
00056 {
00057   byte* tag = image_ + (width_ + skip_) * (height_ - 1) + 0;
00058   return ((word)tag[1] << 8) | (word)tag[0];
00059 }
00060 
00061 byte
00062 OFbkImage::ColorFrequency(OCdtChannel chan) const
00063 {
00064   byte freq;
00065   byte* tag = image_ + (width_ + skip_) * (height_ - 1) + 0;
00066 
00067   if (chan == ocdtCHANNEL0) {
00068     freq = tag[8];
00069   } else if (chan == ocdtCHANNEL1) {
00070     freq = tag[9];
00071   } else if (chan == ocdtCHANNEL2) {
00072     freq = tag[10];
00073   } else if (chan == ocdtCHANNEL3) {
00074     freq = tag[11];
00075   } else if (chan == ocdtCHANNEL4) {
00076     freq = tag[4];
00077   } else if (chan == ocdtCHANNEL5) {
00078     freq = tag[5];
00079   } else if (chan == ocdtCHANNEL6) {
00080     freq = tag[6];
00081   } else if (chan == ocdtCHANNEL7) {
00082     freq = tag[7];
00083   } else {
00084     freq = 0;
00085   }
00086 
00087   return freq;
00088 }
00089 
00090 #  endif
00091 #endif

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:45 2016 by Doxygen 1.6.3