encoder.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 __ENCODER_H__
00026 #define __ENCODER_H__
00027 
00028 #ifndef __IPPS_H__
00029 #include "ipps.h"
00030 #endif
00031 #ifndef __IPPI_H__
00032 #include "ippi.h"
00033 #endif
00034 #ifndef __IPPJ_H__
00035 #include "ippj.h"
00036 #endif
00037 #ifndef __JPEGBASE_H__
00038 #include "jpegbase.h"
00039 #endif
00040 #ifndef __ENCQTBL_H__
00041 #include "encqtbl.h"
00042 #endif
00043 #ifndef __ENCHTBL_H__
00044 #include "enchtbl.h"
00045 #endif
00046 #ifndef __COLORCOMP_H__
00047 #include "colorcomp.h"
00048 #endif
00049 
00050 
00051 
00052 
00053 typedef struct _JPEG_SCAN
00054 {
00055   int ncomp;
00056   int id[MAX_COMPS_PER_SCAN];
00057   int Ss;
00058   int Se;
00059   int Ah;
00060   int Al;
00061 } JPEG_SCAN;
00062 
00063 
00064 class CJPEGEncoder
00065 {
00066 public:
00067 
00068   CJPEGEncoder(void);
00069   virtual ~CJPEGEncoder(void);
00070 
00071   JERRCODE SetSource(
00072     Ipp8u*   pSrc,
00073     int      srcStep,
00074     IppiSize srcSize,
00075     int      srcChannels,
00076     JCOLOR   srcColor);
00077 
00078   JERRCODE SetDestination(
00079     Ipp8u*   pDst,
00080     int      dstSize,
00081     int      dstQuality,
00082     JSS      dstSampling,
00083     JCOLOR   dstColor,
00084     JMODE    dstMode = JPEG_BASELINE,
00085     int      dstRestartInt = 0);
00086 
00087 //  JERRCODE WriteHeader();
00088 
00089 //  JERRCODE WriteData();
00090 
00091   JERRCODE WriteImageBaseline();
00092 
00093   JERRCODE WriteImageProgressive();
00094 
00095   JERRCODE WriteImageLossless();
00096 
00097   IMAGE      m_src;
00098   BITSTREAM  m_dst;
00099   
00100   int        m_jpeg_ncomp;
00101   int        m_jpeg_precision;
00102   JSS        m_jpeg_sampling;
00103   JCOLOR     m_jpeg_color;
00104   int        m_jpeg_quality;
00105   int        m_jpeg_restart_interval;
00106   JMODE      m_jpeg_mode;
00107   
00108   int        m_numxMCU;
00109   int        m_numyMCU;
00110   int        m_mcuWidth;
00111   int        m_mcuHeight;
00112   int        m_ccWidth;
00113   int        m_ccHeight;
00114   int        m_xPadding;
00115   int        m_yPadding;
00116   int        m_restarts_to_go;
00117   int        m_next_restart_num;
00118   int        m_scan_count;
00119   int        m_ss;
00120   int        m_se;
00121   int        m_al;
00122   int        m_ah;
00123   int        m_predictor;
00124   int        m_pt;
00125   JPEG_SCAN* m_scan_script;
00126   Ipp16s*    m_coefbuf;
00127 
00128   CJPEGColorComponent*       m_ccomp[MAX_COMPS_PER_SCAN];
00129   CJPEGEncoderQuantTable     m_qntbl[MAX_QUANT_TABLES];
00130   CJPEGEncoderHuffmanTable   m_dctbl[MAX_HUFF_TABLES];
00131   CJPEGEncoderHuffmanTable   m_actbl[MAX_HUFF_TABLES];
00132   CJPEGEncoderHuffmanState   m_state;
00133 
00134   JERRCODE Init(void);
00135   JERRCODE Clean(void);
00136   JERRCODE ColorConvert(void);
00137   JERRCODE ColorConvert(int nMCURow);
00138   JERRCODE DownSampling(void);
00139   JERRCODE DownSampling(int nMCURow);
00140   JERRCODE PerformDCT(void);
00141   JERRCODE EncodeScan(int ncomp,int id[MAX_COMPS_PER_SCAN],int Ss,int Se,int Ah,int Al);
00142   JERRCODE SelectScanScripts(void);
00143   JERRCODE GenerateHuffmanTables(int ncomp,int id[MAX_COMPS_PER_SCAN],int Ss,int Se,int Ah,int Al);
00144 
00145   JERRCODE WriteSOI(void);
00146   JERRCODE WriteEOI(void);
00147   JERRCODE WriteAPP0(void);
00148   JERRCODE WriteAPP14(void);
00149   JERRCODE WriteSOF0(void);
00150   JERRCODE WriteSOF1(void);
00151   JERRCODE WriteSOF2(void);
00152   JERRCODE WriteSOF3(void);
00153   JERRCODE WriteDRI(int restart_interval);
00154   JERRCODE WriteRST(int next_restart_num);
00155   JERRCODE WriteSOS(void);
00156   JERRCODE WriteSOS(int ncomp,int id[MAX_COMPS_PER_SCAN],int Ss,int Se,int Ah,int Al);
00157   JERRCODE WriteDQT(CJPEGEncoderQuantTable* tbl);
00158   JERRCODE WriteDHT(CJPEGEncoderHuffmanTable* tbl);
00159   JERRCODE WriteCOM(char* comment = 0);
00160 
00161   JERRCODE ProcessRestart(int id[MAX_COMPS_PER_SCAN],int Ss,int Se,int Ah,int Al);
00162   JERRCODE ProcessRestart(int stat[2][256],int id[MAX_COMPS_PER_SCAN],int Ss,int Se,int Ah,int Al);
00163 
00164 };
00165 
00166 
00167 #endif // __ENCODER_H__
00168 


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