Dirac - A Video Codec

Created by the British Broadcasting Corporation.


frame_compress.h

Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002 *
00003 * $Id: frame_compress.h,v 1.16 2007/12/12 14:01:51 tjdwave Exp $ $Name: Dirac_0_9_1 $
00004 *
00005 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006 *
00007 * The contents of this file are subject to the Mozilla Public License
00008 * Version 1.1 (the "License"); you may not use this file except in compliance
00009 * with the License. You may obtain a copy of the License at
00010 * http://www.mozilla.org/MPL/
00011 *
00012 * Software distributed under the License is distributed on an "AS IS" basis,
00013 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
00014 * the specific language governing rights and limitations under the License.
00015 *
00016 * The Original Code is BBC Research and Development code.
00017 *
00018 * The Initial Developer of the Original Code is the British Broadcasting
00019 * Corporation.
00020 * Portions created by the Initial Developer are Copyright (C) 2004.
00021 * All Rights Reserved.
00022 *
00023 * Contributor(s): Thomas Davies (Original Author),
00024 *                 Scott R Ladd,
00025 *                 Anuradha Suraparaju
00026 *                 Andrew Kennedy
00027 *
00028 * Alternatively, the contents of this file may be used under the terms of
00029 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
00030 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
00031 * the GPL or the LGPL are applicable instead of those above. If you wish to
00032 * allow use of your version of this file only under the terms of the either
00033 * the GPL or LGPL and not to allow others to use your version of this file
00034 * under the MPL, indicate your decision by deleting the provisions above
00035 * and replace them with the notice and other provisions required by the GPL
00036 * or LGPL. If you do not delete the provisions above, a recipient may use
00037 * your version of this file under the terms of any one of the MPL, the GPL
00038 * or the LGPL.
00039 * ***** END LICENSE BLOCK ***** */
00040 
00041 
00042 #ifndef _FRAME_COMPRESS_H_
00043 #define _FRAME_COMPRESS_H_
00044 
00045 #include <libdirac_common/frame_buffer.h>
00046 #include <libdirac_common/common.h>
00047 #include <libdirac_common/motion.h>
00048 #include <libdirac_byteio/frame_byteio.h>
00049 
00050 namespace dirac
00051 {
00052 
00053     class MvData;
00054 
00056 
00061     class FrameCompressor
00062     {
00063     public:
00065 
00071         FrameCompressor( EncoderParams& encp ); 
00072 
00074         ~FrameCompressor( );
00075 
00077 
00082         bool MotionEstimate( const FrameBuffer& my_fbuffer, 
00083                                         int fnum); 
00084 
00086 
00092         FrameByteIO* Compress(  FrameBuffer& my_fbuffer , 
00093                                 int fnum );
00094 
00096         bool IsSkipped(){ return m_skipped; }
00097 
00099         bool IsMEDataAvail() const { return m_medata_avail; }
00100 
00102         const MEData* GetMEData() const;
00103 
00104     private:
00106 
00110         FrameCompressor( const FrameCompressor& cpy );
00111 
00113 
00117         FrameCompressor& operator=(const FrameCompressor& rhs);
00118 
00120         void AnalyseMEData( const MEData& );
00121         
00123         void CompressMVData(MvDataByteIO* mv_data);
00124         
00126         float GetCompLambda( const FrameParams& fparams,
00127                              const CompSort csort );
00128 
00129         void SelectQuantisers( CoeffArray& coeff_data , 
00130                                SubbandList& bands ,
00131                                const float lambda,
00132                                OneDArray<unsigned int>& est_counts,
00133                                const CodeBlockMode cb_mode,
00134                                const FrameSort fsort,
00135                                const CompSort csort );
00136 
00137         int SelectMultiQuants( CoeffArray& coeff_data , 
00138                                SubbandList& bands , 
00139                                const int band_num,
00140                                const float lambda,
00141                                const FrameSort fsort, 
00142                                const CompSort csort );
00143 
00144         void SetupCodeBlocks( SubbandList& bands );
00145 
00146 
00147         void AddSubAverage(CoeffArray& coeff_data,int xl,int yl,AddOrSub dirn);
00148 
00149     private:
00150 
00151         //member variables
00152         // a local copy of the encoder params
00153         EncoderParams& m_encparams;
00154      
00155         // Pointer to the motion vector data
00156         MEData* m_me_data;
00157 
00158         // True if the frame has been skipped, false otherwise
00159         bool m_skipped;                
00160 
00161         // True if we use global motion vectors, false otherwise
00162         bool m_use_global;
00163 
00164         // True if we use block motion vectors, false otherwise
00165         bool m_use_block_mv;
00166         
00167         // Prediction mode to use if we only have global motion vectors
00168         PredMode m_global_pred_mode;
00169         
00170         // True if motion estimation data is available
00171         bool m_medata_avail;
00172 
00173         // True if we have detected a cut
00174         bool m_is_a_cut;
00175 
00176         // The proportion of intra blocks that motion estimation has found
00177         double m_intra_ratio;
00178     };
00179 
00180 } // namespace dirac
00181 
00182 #endif

© 2004 British Broadcasting Corporation. Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.