Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ODataFormats.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifdef PLATFORM_APERIOS
00003 #  include <OPENR/ODataFormats.h>
00004 #else
00005 #  ifndef INCLUDED_ODataFormats_h_
00006 #  define INCLUDED_ODataFormats_h_
00007 
00008 #include <stdlib.h>
00009 
00010 //! provides compatability with the OPEN-R type of the same name
00011 struct ODataVectorInfo {
00012   size_t numData;
00013 };
00014 
00015 typedef unsigned char byte;
00016 typedef unsigned short word;
00017 typedef unsigned int longword;
00018 typedef word OSoundFormat;
00019 const OSoundFormat osoundformatUNDEF     = 0;
00020 const OSoundFormat osoundformatPCM       = 1;
00021 const OSoundFormat osoundformatUSB_MIDI  = 2;
00022 const OSoundFormat osoundformatSMF       = 3; // STANDARD MIDI FILE
00023 
00024 
00025 typedef word OSoundChannel;
00026 const OSoundChannel osoundchannelUNDEF  = 0;
00027 const OSoundChannel osoundchannelMONO   = 1;
00028 const OSoundChannel osoundchannelSTEREO = 2;
00029 
00030 //! provides compatability with the OPEN-R type of the same name
00031 struct OSoundInfo {                    // 64 bytes (total)
00032   typedef int longword;
00033   typedef short word;
00034 
00035     longword             frameNumber;    //  4 bytes
00036     size_t               frameSize;      //  4 bytes
00037     size_t               dataOffset;   //  4 bytes
00038     size_t               maxDataSize;  //  4 bytes
00039     size_t               dataSize;       //  4 bytes
00040     OSoundFormat         format;         //  2 bytes
00041     OSoundChannel        channel;        //  2 bytes
00042     word                 samplingRate;   //  2 bytes
00043     word                 bitsPerSample;  //  2 bytes
00044     size_t               actualDataSize; //  4 bytes
00045     longword             padding[6];   // 24 bytes
00046 };
00047 
00048 //! provides compatability with the OPEN-R type of the same name
00049 struct OSoundVectorData {
00050     ODataVectorInfo  vectorInfo;
00051     OSoundInfo       info[1];
00052 
00053     void SetNumData(size_t ndata)  { vectorInfo.numData = ndata; }
00054     OSoundInfo* GetInfo(int index) { return &info[index];        }
00055     byte*       GetData(int index) {
00056         return ((byte*)&vectorInfo + info[index].dataOffset);
00057     }
00058 };
00059 
00060 //! provides compatability with the OPEN-R type of the same name
00061 struct OFbkImageInfo {          // 32 bytes (total)
00062     longword      frameNumber;  //  4 bytes
00063     size_t        dataOffset;   //  4 bytes
00064     size_t        dataSize;     //  4 bytes
00065     size_t        width;        //  4 bytes
00066     size_t        height;       //  4 bytes
00067     size_t        padding[1];   //  4 bytes
00068 };
00069 
00070 //! provides compatability with the OPEN-R type of the same name
00071 struct OFbkImageVectorData {
00072     ODataVectorInfo  vectorInfo;
00073     OFbkImageInfo    info[1];
00074 
00075     OFbkImageInfo* GetInfo(int index) { return &info[index]; }
00076     byte*          GetData(int index) {
00077         return ((byte*)&vectorInfo + info[index].dataOffset);
00078     }
00079 };
00080 
00081 typedef int OFbkImageLayer;
00082 const OFbkImageLayer ofbkimageLAYER_H = 0;
00083 const OFbkImageLayer ofbkimageLAYER_M = 1;
00084 const OFbkImageLayer ofbkimageLAYER_L = 2;
00085 const OFbkImageLayer ofbkimageLAYER_C = 3;
00086 
00087 const int ocdtNUM_CHANNELS  =  8;
00088 typedef longword OCdtChannel;
00089 const OCdtChannel ocdtCHANNEL_UNDEF = 0x00;
00090 const OCdtChannel ocdtCHANNEL0      = 0x01;
00091 const OCdtChannel ocdtCHANNEL1      = 0x02;
00092 const OCdtChannel ocdtCHANNEL2      = 0x04;
00093 const OCdtChannel ocdtCHANNEL3      = 0x08;
00094 const OCdtChannel ocdtCHANNEL4      = 0x10;
00095 const OCdtChannel ocdtCHANNEL5      = 0x20;
00096 const OCdtChannel ocdtCHANNEL6      = 0x40;
00097 const OCdtChannel ocdtCHANNEL7      = 0x80;
00098 
00099 const int ocdtMAX_Y_SEGMENT    = 32;
00100 const longword ocdtINIT        = 0x80808080;
00101 const longword ocdtCr_MAX_MASK = 0x0000ff00;
00102 const longword ocdtCr_MIN_MASK = 0x000000ff;
00103 const longword ocdtCb_MAX_MASK = 0xff000000;
00104 const longword ocdtCb_MIN_MASK = 0x00ff0000;
00105 
00106 struct OCdtInfo {                       // 144 bytes
00107     OCdtChannel   channel;                //   4 bytes
00108     longword      table[ocdtMAX_Y_SEGMENT]; // 128 bytes
00109     longword      padding;                //   4 bytes
00110     
00111     void Init(OCdtChannel chan) {
00112         channel     = chan;
00113         for (int i = 0; i < ocdtMAX_Y_SEGMENT; i++) table[i] = ocdtINIT;
00114     }
00115     void Set(int y_segment,byte cr_max, byte cr_min, byte cb_max, byte cb_min) {
00116         longword crMax = (longword)cr_max;
00117         longword crMin = (longword)cr_min;
00118         longword cbMax = (longword)cb_max;
00119         longword cbMin = (longword)cb_min;
00120         crMax = (crMax <<  8) & ocdtCr_MAX_MASK;
00121         crMin = (crMin      ) & ocdtCr_MIN_MASK;
00122         cbMax = (cbMax << 24) & ocdtCb_MAX_MASK;
00123         cbMin = (cbMin << 16) & ocdtCb_MIN_MASK;
00124         table[y_segment] =  crMax | crMin | cbMax | cbMin;
00125     }
00126 };
00127 
00128 struct OCdtVectorData{
00129     ODataVectorInfo  vectorInfo;
00130     OCdtInfo         info[ocdtNUM_CHANNELS];
00131 
00132     void SetNumData(size_t ndata) { vectorInfo.numData = ndata; }
00133     OCdtInfo* GetInfo(int index)  { return &info[index];        }
00134 };
00135 
00136 /*! @file
00137  * @brief Defines several data structures for compatability with OPEN-R
00138  * @author ejt (Creator)
00139  */
00140 
00141 #  endif
00142 #endif

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