jpegbase.h
Go to the documentation of this file.
00001 /*
00002 //
00003 //               INTEL CORPORATION PROPRIETARY INFORMATION
00004 //  This software is supplied under the terms of a license agreement or
00005 //  nondisclosure agreement with Intel Corporation and may not be copied
00006 //  or disclosed except in accordance with the terms of that agreement.
00007 //    Copyright (c) 2001-2004 Intel Corporation. All Rights Reserved.
00008 //
00009 //  Intel® Integrated Performance Primitives JPEG Viewer Sample for Windows*
00010 //
00011 //  By downloading and installing this sample, you hereby agree that the
00012 //  accompanying Materials are being provided to you under the terms and
00013 //  conditions of the End User License Agreement for the Intel® Integrated
00014 //  Performance Primitives product previously accepted by you. Please refer
00015 //  to the file ipplic.htm located in the root directory of your Intel® IPP product
00016 //  installation for more information.
00017 //
00018 //  JPEG is an international standard promoted by ISO/IEC and other organizations.
00019 //  Implementations of these standards, or the standard enabled platforms may
00020 //  require licenses from various entities, including Intel Corporation.
00021 //
00022 //
00023 */
00024 
00025 #ifndef __JPEGBASE_H__
00026 #define __JPEGBASE_H__
00027 
00028 //#include <iostream.h>
00029 #ifndef __IPPDEFS_H__
00030 #include "ippdefs.h"
00031 #endif
00032 #ifndef __IPPCORE_H__
00033 #include "ippcore.h"
00034 #endif
00035 #ifndef __IPPS_H__
00036 #include "ipps.h"
00037 #endif
00038 #ifndef __IPPI_H__
00039 #include "ippi.h"
00040 #endif
00041 #ifndef __IPPJ_H__
00042 #include "ippj.h"
00043 #endif
00044 
00045 
00046 #ifdef _DEBUG
00047 #define ENABLE_TRACING
00048 #endif
00049 #undef ENABLE_ERROR_LOGGING
00050 //#define ENABLE_ERROR_LOGGING
00051 
00052 
00053 #define OWN_ALIGN_PTR(ptr,align) \
00054   ippAlignPtr(ptr,align)
00055 
00056 
00057 #define DIB_ALIGN (sizeof(int) - 1)
00058 
00059 #define DIB_UWIDTH(width,nchannels) \
00060   ((width) * (nchannels))
00061 
00062 #define DIB_AWIDTH(width,nchannels) \
00063   ( ((DIB_UWIDTH(width,nchannels) + DIB_ALIGN) & (~DIB_ALIGN)) )
00064 
00065 #define DIB_PAD_BYTES(width,nchannels) \
00066   ( DIB_AWIDTH(width,nchannels) - DIB_UWIDTH(width,nchannels) )
00067 
00068 
00069 
00070 #undef ENABLE_TRACING
00071 #ifdef ENABLE_TRACING
00072 
00073 #define TRC(msg) \
00074   cout << (msg)
00075 
00076 #define TRC0(msg) \
00077   cout << (msg) << endl
00078 
00079 #define TRC1(msg,p1) \
00080   cout << (msg) << (p1) << endl
00081 
00082 #else
00083 
00084 #define TRC(msg)
00085 #define TRC0(msg)
00086 #define TRC1(msg,p1)
00087 
00088 #endif
00089 
00090 
00091 #ifdef ENABLE_ERROR_LOGGING
00092 
00093 #define LOG(msg) \
00094   cout << (msg)
00095 
00096 #define LOG0(msg) \
00097   cout << (msg) << endl
00098 
00099 #define LOG1(msg,p1) \
00100   cout << (msg) << (p1) << endl
00101 
00102 #else
00103 
00104 #define LOG(msg)
00105 #define LOG0(msg)
00106 #define LOG1(msg,p1)
00107 
00108 #endif
00109 
00110 
00111 typedef enum _JPEG_MODE
00112 {
00113   JPEG_BASELINE    = 0,
00114   JPEG_PROGRESSIVE = 1,
00115   JPEG_LOSSLESS    = 2
00116 
00117 } JMODE;
00118 
00119 
00120 typedef enum _JPEG_OPERATION
00121 {
00122   JO_READ_HEADER = 0,
00123   JO_READ_DATA   = 1
00124 
00125 } JOPERATION;
00126 
00127 
00128 typedef enum _JPEG_COLOR
00129 {
00130   JC_UNKNOWN = 0,
00131   JC_GRAY    = 1,
00132   JC_RGB     = 2,
00133   JC_BGR     = 3,
00134   JC_YCBCR   = 4,
00135   JC_CMYK    = 5,
00136   JC_YCCK    = 6
00137 
00138 } JCOLOR;
00139 
00140 
00141 typedef enum _JPEG_SAMPLING
00142 {
00143   JS_444   = 0,
00144   JS_422   = 1,
00145   JS_411   = 2,
00146   JS_OTHER = 3
00147 
00148 } JSS;
00149 
00150 
00151 typedef enum _JPEG_MARKER
00152 {
00153   JM_NONE  = 0,
00154   JM_SOI   = 0xd8, /* start of image */
00155   JM_EOI   = 0xd9, /* end of image */
00156 
00157   /* start of frame */
00158   JM_SOF0  = 0xc0, /* Nondifferential Huffman-coding Baseline DCT */
00159   JM_SOF1  = 0xc1, /* Nondifferential Huffman-coding Extended sequental DCT */
00160   JM_SOF2  = 0xc2, /* Nondifferential Huffman-coding Progressive DCT */
00161   JM_SOF3  = 0xc3, /* Nondifferential Huffman-coding Lossless (sequental) */
00162 
00163   JM_SOF5  = 0xc5, /* Differential Huffman-coding Sequental DCT */
00164   JM_SOF6  = 0xc6, /* Differential Huffman-coding Progressive DCT */
00165   JM_SOF7  = 0xc7, /* Differential Lossless */
00166 
00167   JM_SOF9  = 0xc9, /* Nondifferential arithmetic-coding Extended sequental DCT */
00168   JM_SOFA  = 0xca, /* Nondifferential arithmetic-coding Progressive DCT */
00169   JM_SOFB  = 0xcb, /* Nondifferential arithmetic-coding Lossless (sequental) */
00170 
00171   JM_SOFD  = 0xcd, /* Differential arithmetic-coding Sequental DCT */
00172   JM_SOFE  = 0xce, /* Differential arithmetic-coding Progressive DCT */
00173   JM_SOFF  = 0xcf, /* Differential arithmetic-coding Lossless */
00174 
00175   JM_SOS   = 0xda, /* start of scan */
00176   JM_DQT   = 0xdb, /* define quantization table(s) */
00177   JM_DHT   = 0xc4, /* define Huffman table(s) */
00178   JM_APP0  = 0xe0, /* APP0 */
00179   JM_APP1  = 0xe1,
00180   JM_APP2  = 0xe2,
00181   JM_APP3  = 0xe3,
00182   JM_APP4  = 0xe4,
00183   JM_APP5  = 0xe5,
00184   JM_APP6  = 0xe6,
00185   JM_APP7  = 0xe7,
00186   JM_APP8  = 0xe8,
00187   JM_APP9  = 0xe9,
00188   JM_APP10 = 0xea,
00189   JM_APP11 = 0xeb,
00190   JM_APP12 = 0xec,
00191   JM_APP13 = 0xed,
00192   JM_APP14 = 0xee, /* APP14 */
00193   JM_APP15 = 0xef,
00194   JM_RST0  = 0xd0, /* restart with modulo 8 counter 0 */
00195   JM_RST1  = 0xd1, /* restart with modulo 8 counter 1 */
00196   JM_RST2  = 0xd2, /* restart with modulo 8 counter 2 */
00197   JM_RST3  = 0xd3, /* restart with modulo 8 counter 3 */
00198   JM_RST4  = 0xd4, /* restart with modulo 8 counter 4 */
00199   JM_RST5  = 0xd5, /* restart with modulo 8 counter 5 */
00200   JM_RST6  = 0xd6, /* restart with modulo 8 counter 6 */
00201   JM_RST7  = 0xd7, /* restart with modulo 8 counter 7 */
00202   JM_DRI   = 0xdd, /* define restart interval */
00203   JM_COM   = 0xfe  /* comment */
00204 
00205 } JMARKER;
00206 
00207 
00208 typedef enum _JPEG_ERROR
00209 {
00210   JPEG_OK                 =   0,
00211   JPEG_NOT_IMPLEMENTED    =  -1,
00212   JPEG_INTERNAL_ERROR     =  -2,
00213   JPEG_BUFF_TOO_SMALL     =  -3,
00214   JPEG_OUT_OF_MEMORY      =  -4,
00215   JPEG_BAD_SEGMENT_LENGTH =  -5,
00216   JPEG_BAD_HUFF_TBL       =  -6,
00217   JPEG_BAD_QUANT_SEGMENT  =  -7,
00218   JPEG_BAD_SCAN_SEGMENT   =  -8,
00219   JPEG_BAD_FRAME_SEGMENT  =  -9,
00220   JPEG_BAD_COMPONENT_ID   = -10,
00221   JPEG_BAD_SAMPLING       = -11,
00222   JPEG_BAD_RESTART        = -12
00223 
00224 } JERRCODE;
00225 
00226 
00227 typedef struct _image
00228 {
00229   union
00230   {
00231     Ipp8u*  Data8u;
00232     Ipp16s* Data16s;
00233   } p;
00234 
00235   int    width;
00236   int    height;
00237   int    lineStep;
00238   int    precision;
00239   int    nChannels;
00240   JCOLOR color;
00241 } IMAGE;
00242 
00243 
00244 typedef struct _bitstream
00245 {
00246   Ipp8u* pData;
00247   int    DataLen;
00248   int    currPos;
00249 
00250   JERRCODE _WRITE_BYTE(int byte);
00251   JERRCODE _WRITE_WORD(int word);
00252   JERRCODE _READ_BYTE(int* byte);
00253   JERRCODE _READ_WORD(int* word);
00254 } BITSTREAM;
00255 
00256 
00257 const int CPU_CACHE_LINE      = 32;
00258 const int DCTSIZE2            = 64;
00259 const int MAX_QUANT_TABLES    = 4;
00260 const int MAX_HUFF_TABLES     = 4;
00261 const int MAX_COMPS_PER_SCAN  = 4;
00262 const int MAX_COMPS_PER_FRAME = 255;
00263 const int MAX_HUFF_BITS       = 16;
00264 const int MAX_HUFF_VALS       = 256;
00265 const int MAX_BLOCKS_PER_MCU  = 10;
00266 const int MAX_BYTES_PER_MCU   = DCTSIZE2*sizeof(Ipp16s)*MAX_BLOCKS_PER_MCU;
00267 
00268 
00269 extern const Ipp8u DefaultLuminanceQuant[64];
00270 extern const Ipp8u DefaultChrominanceQuant[64];
00271 
00272 extern const Ipp8u DefaultLuminanceDCBits[];
00273 extern const Ipp8u DefaultLuminanceDCValues[];
00274 extern const Ipp8u DefaultChrominanceDCBits[];
00275 extern const Ipp8u DefaultChrominanceDCValues[];
00276 extern const Ipp8u DefaultLuminanceACBits[];
00277 extern const Ipp8u DefaultLuminanceACValues[];
00278 extern const Ipp8u DefaultChrominanceACBits[];
00279 extern const Ipp8u DefaultChrominanceACValues[];
00280 
00281 const char* GetErrorStr(JERRCODE code);
00282 
00283 
00284 #endif // __JPEGBASE_H__
00285 
00286 


canon_vbc50i
Author(s): Cedric Pradalier
autogenerated on Sun Oct 5 2014 23:47:45