Main Page | Namespace List | Compound List | File List | Compound Members | File Members

datatype.h

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------
00002  *
00003  * (C) Copyright Koninklijke Philips Electronics NV 2006. 
00004  * All rights reserved. This software is licensed under the terms of
00005  * version 2.1 of the GNU Lesser General Public License as published 
00006  * by the Free Software Foundation. For licensing and warranty
00007  * information, see the file COPYING in the main directory.
00008  *
00009  *------------------------------------------------------------------*/
00010 
00011 #ifndef DATA_H
00012 #define DATA_H
00013 
00014 #include <stdio.h>
00015 
00016 #define first_quad(c)   ((c)>>4)        /* first 4 bits in file order */
00017 #define second_quad(c)  ((c)&15)
00018 
00019 #define ceil_div(N, D)  ( (N>(D*(N/D)))? (N/D)+1 : N/D )
00020 #define floor_div(N, D) ( (N<(D*(N/D)))? (N/D)-1 : N/D )
00021 
00022 /*--------------------------------------*/
00023 /* JPEG data types      */
00024 /*--------------------------------------*/
00025 
00026 typedef unsigned char VYAimageComponent;
00027 typedef unsigned char VYAimageDepth;
00028 typedef unsigned int  VYAimageH;
00029 typedef unsigned int  VYAimageV;
00030 typedef unsigned int  VYAimageX;
00031 typedef unsigned int  VYAimageY;
00032 typedef unsigned char VYAid;
00033 typedef unsigned char VYAbyte;
00034 
00035 typedef unsigned char Bits;
00036 typedef unsigned int  Marker;
00037 
00038 /*--------------------------------------*/
00039 /* JPEG format parsing markers    */
00040 /*--------------------------------------*/
00041 
00042 const Marker SOI_MK=0xFFD8;   /* start of image   */
00043 const Marker COM_MK=0xFFFE;   /* comment segment    */
00044 const Marker APP_MK=0xFFE0;   /* application data     */
00045 const Marker DQT_MK=0xFFDB;   /* quantization table   */
00046 const Marker SOF_MK=0xFFC0;   /* start of frame   */
00047 const Marker DHT_MK=0xFFC4;   /* Huffman table    */
00048 const Marker SOS_MK=0xFFDA;   /* start of data    */
00049 const Marker DRI_MK=0xFFDD;   /* define restart interval  */
00050 const Marker EOI_MK=0xFFD9;   /* end of image     */
00051 
00052 const Marker MK_MSK=0xFFF0;   /* marker mask */
00053 #define RST_MK(x) ( (0xFFF8&(x)) == 0xFFD0 )
00054       /* is x a restart interval ? */
00055 
00056 
00057 /*--------------------------------------*/
00058 /* Image component      */
00059 /*--------------------------------------*/
00060 
00061 struct ImageComponent
00062 {
00063   unsigned char CID;          /* component ID     */
00064   unsigned char IDX;          /* index of first block in MCU  */
00065 
00066   unsigned char HS;         /* sampling factors     */
00067   unsigned char VS;
00068   unsigned char HDIV;         /* sample width ratios    */
00069   unsigned char VDIV; 
00070 
00071   char QT;                  /* QTable index, 2bits    */
00072   char DC_HT;                 /* DC table index, 1bit   */
00073   char AC_HT;                 /* AC table index, 1bit   */
00074   int  PRED;                  /* DC predictor value     */
00075 }; 
00076 
00077 #if defined(WIN32)
00078 template<class T>
00079 T min(const T& a, const T& b)
00080 {
00081   return a < b ? a : b;
00082 }
00083 #else
00084 using std::min;
00085 #endif
00086 
00087 #endif

Generated on Wed Feb 15 14:52:45 2006 for jpegdec by doxygen 1.3.2