MxPEGScanToJPEGConverterIPP.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/IPPAcceleratedMxPEGComponent/trunk/include/MxPEGScanToJPEGConverterIPP.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 licensed 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 __MX_MXPEGSCANTOJPEGCONVERTERIPP_H__
00061 #define __MX_MXPEGSCANTOJPEGCONVERTERIPP_H__
00062 
00063 
00064 
00065 #define MX_MXPEGSCANTOJPEGCONVERTERIPP_ID \
00066          "MxPEGScanToJPEGConverterIPP"
00067 
00068 
00069 
00070 #include "MxPEGScanDecoderIPPCore.h"
00071 
00072 #include <interfaces/IComponent.h>
00073 #include <interfaces/IComponentInvoker.h>
00074 #include <interfaces/IMxPEGScanToJPEGConverter.h>
00075 
00076 #include <Framework/Framework.h>
00077 
00078 #include <mxm/core/mxmString.h>
00079 #include <mxm/core/mxmStringList.h>
00080 #include <mxm/core/mxm_jpeg.h>
00081 
00082 
00083 
00084 class mxmUndecodedMxPEGFrameDescriptor;
00085 
00086 
00087 
00088 namespace mx {
00089   
00090   class ISegmentedStreamReceiver;
00091   
00094 
00102   class MxPEGScanToJPEGConverterIPP
00103          : public MxPEGScanDecoderIPPCore,
00104            public virtual IComponent,
00105            public virtual IMxPEGScanToJPEGConverter {
00106     
00110    private:
00111     static mxm::smart<mxmStringList> _enumerateInterfaces() {
00112       return(new mxmStringList(
00113                    (mxmString(MX_MXPEGSCANTOJPEGCONVERTERIPP_ID),
00114                     MX_ICOMPONENT_ID,
00115                     MX_IMXPEGSCANTOJPEGCONVERTER_ID,
00116                     MX_IUNDECODEDMXPEGFRAMERECEIVER_ID,
00117                     MX_ISENDSSEGMENTEDSTREAM_ID,
00118                     MX_IERRORSTATE_ID)));
00119     }
00120     static mxm::smart<mxmStringList> _enumerateCapabilities(
00121                                         const mxmString &interface_id) {
00122       if(interface_id == mx::Framework::IdHintKey)
00123        return(new mxmStringList(MX_MXPEGSCANTOJPEGCONVERTERIPP_ID));
00124       if(interface_id == mx::Framework::ObsoletesHintKey)
00125        return(new mxmStringList("MxPEGScanToJPEGConverterSoftwareOnly"));
00126       else
00127       return(new mxmStringList());
00128     }
00129    private:
00130     class Invoker : public mxmObject, public virtual IComponentInvoker {
00131      public:
00132       mxm::smart<mxmStringList> enumerateInterfaces() {
00133         return(_enumerateInterfaces());
00134       }
00135       mxm::smart<mxmStringList> enumerateCapabilities(
00136                                   const mxmString &interface_id) {
00137         return(_enumerateCapabilities(interface_id));
00138       }
00139       IComponent *newComponent() {
00140         return(new MxPEGScanToJPEGConverterIPP());
00141       }
00142     };
00143    public:
00145     static IComponentInvoker *newInvoker() {
00146       return(new Invoker());
00147     }
00148     
00149    private:
00150     static const int BitstreamBufferSize = 512;
00151    private:
00152     static const unsigned char ZigZag_StoreMap[64];
00153     static const mxm::u8 HuffmanTable_Y_DC[],
00154                          HuffmanTable_Y_AC[],
00155                          HuffmanTable_UV_DC[],
00156                          HuffmanTable_UV_AC[];
00157     
00158    private:
00159     ISegmentedStreamReceiver *JPEGReceiver;
00160     Ipp16u                *ForwardQuantizationTables[4];
00161     Ipp16s *CoeffBuffer;
00162     int TileNumX, TileNumY;
00163     IppiEncodeHuffmanSpec *HuffmanEncodeSpec_Y_DC,
00164                           *HuffmanEncodeSpec_Y_AC,
00165                           *HuffmanEncodeSpec_UV_DC,
00166                           *HuffmanEncodeSpec_UV_AC;
00167     mxm::JPEG::MarkerLayoutAPP0 APP0_Block;
00168     mxm::JPEG::MarkerLayoutSOF0 SOF0_Block;
00169     mxm::JPEG::MarkerLayoutSOS  SOS_Block;
00170     int FramesProcessed;
00171     bool ErrorEncountered;
00172     
00173     // only valid while receiveUndecodedMxPEGFrame() executes...
00174     Ipp16u *ForwardQuantTableForMCU[MaxMCUsPerTile];
00175     
00176    public:
00177     MxPEGScanToJPEGConverterIPP();
00178     ~MxPEGScanToJPEGConverterIPP();
00179     
00180    public:
00182     mxm::smart<mxmStringList> enumerateInterfaces();
00184     mxm::smart<mxmStringList> enumerateCapabilities(
00185                                 const mxmString &interface);
00186     
00188     void receiveUndecodedMxPEGFrame(mxmUndecodedMxPEGFrameDescriptor
00189                                      *frame_descriptor);
00191     void receiveMxPEGAudioFrame(const mxmAudioBlockInfo &audio_info,
00192                                 const mxm::u8 *sample_data);
00194     void setQuantizationTable(int target_table,
00195                               mxm::u8 *data_bytes);
00196     
00198     void setSegmentedStreamReceiver(ISegmentedStreamReceiver *receiver);
00199     
00201     bool errorState();
00203     void setErrorState();
00204   };
00205 };
00206 
00207 
00208 
00209 #endif   // __MX_MXPEGSCANTOJPEGCONVERTERIPP_H__

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