mxm_jpeg.h

00001 //           ///          //                                  C++ Cross Platform
00002 //          /////        ////
00003 //         /// XXX     XXX ///            ///////////   /////////     ///   ///
00004 //        ///    XXX XXX    ///         ///             ///    ///   ///  ///
00005 //       ///       XXX       ///         /////////     ///      //  //////
00006 //      ///      XXX XXX      ///               ///   ///    ///   ///  ///
00007 //     ////    XXX     XXX    ////    ////////////  //////////    ///   ///
00008 //    ////                     ////
00009 //   ////  M  O  B  O  T  I  X  ////////////////////////////////////////////////
00010 //  //// Security Vision Systems //////////////////////////////////////////////
00011 //
00012 //  $Author: khe_admin $
00013 //  $LastChangedBy: khe_admin $
00014 //  $LastChangedDate: 2007-06-29 12:31:37 +0200 (Fri, 29 Jun 2007) $
00015 //  $HeadURL: http://svn.mobotix.net/svn/mxsdk/src/mxm/trunk/include/mxm/core/mxm_jpeg.h $
00016 //
00018      //
00019      //  MOBOTIX MxPEG SDK
00020      //
00021      //  This file belongs to the C++ library released as part of the MxPEG SDK.
00022      //
00023      //  This software is licenced under the BSD licence,
00024      //  http://www.opensource.org/licenses/bsd-license.php
00025      //
00026      //  Copyright (c) 2005 - 2007, MOBOTIX AG
00027      //  All rights reserved.
00028      //
00029      //  Redistribution and use in source and binary forms, with or without
00030      //  modification, are permitted provided that the following conditions are
00031      //  met:
00032      //
00033      //  - Redistributions of source code must retain the above copyright
00034      //    notice, this list of conditions and the following disclaimer.
00035      //
00036      //  - Redistributions in binary form must reproduce the above copyright
00037      //    notice, this list of conditions and the following disclaimer in the
00038      //    documentation and/or other materials provided with the distribution.
00039      //
00040      //  - Neither the name of MOBOTIX AG nor the names of its contributors may
00041      //    be used to endorse or promote products derived from this software
00042      //    without specific prior written permission.
00043      //
00044      //  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00045      //  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00046      //  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00047      //  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00048      //  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00049      //  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00050      //  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00051      //  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00052      //  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00053      //  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00054      //  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00055      //
00057 
00058 
00059 
00060 #ifndef __MXM_JPEG_H__
00061 #define __MXM_JPEG_H__
00062 
00063 
00064 
00065 #include <mxm/core/mxm_types.h>
00066 
00067 
00068 
00069 namespace mxm {
00070   
00072   namespace JPEG {
00073     
00074     const u8 SOI   = 0xd8;
00075     const u8 APP0  = 0xe0;
00076     const u8 COM   = 0xfe;
00077     const u8 DQT   = 0xdb;
00078     const u8 DHT   = 0xc4;
00079     const u8 DRI   = 0xdd;
00080     const u8 SOF0  = 0xc0;
00081     const u8 SOS   = 0xda;
00082     const u8 EOI   = 0xd9;
00083     const u8 APP13 = 0xed;
00084      
00085 #ifdef _MSC_VER
00086     #pragma pack(push,1)
00087 #endif
00088     
00090     typedef struct {
00091       
00092       mxm::u8 ff;               // Marker-leadin
00093       mxm::u8 app0_marker;      // APP0-Marker
00094       mxm::u8 len_hi, len_lo;   // Length of APP0 block (2 bytes)
00095       char id[5];               // Block ID (4 bytes - ASCII "JFIF" + \0)
00096       mxm::u8 major_vers, minor_vers;
00097                                 // Version Major,Minor (2 bytes - major first)
00098       mxm::u8 units;            // Units (1 byte - 0x00 = none,
00099                                 //                 0x01 = inch,
00100                                 //                 0x02 = cm)
00101       mxm::u8 xdpu_hi, xdpu_lo; // Xdpu (2 bytes - dots per unit horizontal)
00102       mxm::u8 ydpu_hi, ydpu_lo; // Ydpu (2 bytes - dots per unit vertical)
00103       mxm::u8 thumbnail_x;      // Thumbnail X size (1 byte)
00104       mxm::u8 thumbnail_y;      // Thumbnail Y size (1 byte)
00105     }
00106 #ifndef _MSC_VER
00107     __attribute__ ((packed))
00108 #endif
00109     MarkerLayoutAPP0;
00110     
00112     typedef struct {
00113       
00114       mxm::u8 ff;
00115       mxm::u8 marker;
00116       mxm::u8 len_hi, len_lo;
00117       mxm::u8 data_precision;
00118       mxm::u8 y_sz_hi, y_sz_lo;
00119       mxm::u8 x_sz_hi, x_sz_lo;
00120       mxm::u8 num_components;
00121       struct {
00122         mxm::u8 component_id;
00123         mxm::u8 sampl_fact;
00124         mxm::u8 quant_tbl_no;
00125       }
00126 #ifndef _MSC_VER
00127       __attribute__ ((packed))
00128 #endif
00129       components[3];
00130     }
00131 #ifndef _MSC_VER
00132     __attribute__ ((packed))
00133 #endif
00134     MarkerLayoutSOF0;
00135     
00137     typedef struct {
00138       
00139       mxm::u8 ff;
00140       mxm::u8 sos_marker;
00141       mxm::u8 sz_hi;
00142       mxm::u8 sz_lo;
00143       mxm::u8 comps_in_scan;
00144       struct {
00145         mxm::u8 comp_id;
00146         mxm::u8 td_ta;
00147       }
00148  #ifndef _MSC_VER
00149       __attribute__ ((packed))
00150 #endif
00151       components[3];
00152       
00153       mxm::u8 Ss;
00154       mxm::u8 Se;
00155       mxm::u8 Ah_Al;
00156     }
00157 #ifndef _MSC_VER
00158     __attribute__ ((packed))
00159 #endif
00160     MarkerLayoutSOS;
00161 
00162 #ifdef _MSC_VER
00163     #pragma pack(pop)
00164 #endif
00165   
00166   };
00167 };
00168 
00169 
00170 
00171 #endif   // __MXM_JPEG_H__

Generated on Fri Jun 29 17:21:04 2007 for MxPEG SDK by  doxygen 1.4.6