Dirac - A Video Codec

Created by the British Broadcasting Corporation.


picture_compress.h

Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002 *
00003 * $Id: picture_compress.h,v 1.7 2008/08/14 02:30:50 asuraparaju Exp $ $Name: Dirac_1_0_2 $
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 _PICTURE_COMPRESS_H_
00043 #define _PICTURE_COMPRESS_H_
00044 
00045 #include <libdirac_encoder/enc_queue.h>
00046 #include <libdirac_common/common.h>
00047 #include <libdirac_common/motion.h>
00048 #include <libdirac_byteio/picture_byteio.h>
00049 
00050 namespace dirac
00051 {
00052 
00053     class MvData;
00054 
00056 
00061     class PictureCompressor
00062     {
00063     public:
00065 
00071         PictureCompressor( EncoderParams& encp ); 
00072 
00074         ~PictureCompressor( );
00075 
00077         void PixelME( EncQueue& my_buffer , int pnum );
00078 
00080     void CalcComplexity( EncQueue& my_buffer, int pnum , const OLBParams& olbparams );
00081     void CalcComplexity2( EncQueue& my_buffer, int pnum );
00082 
00084     void NormaliseComplexity( EncQueue& my_buffer, int pnum );
00085 
00087         void SubPixelME( EncQueue& my_buffer , int pnum );
00088 
00090         void ModeDecisionME( EncQueue& my_buffer, int pnum );
00091 
00093         void IntraModeAnalyse( EncQueue& my_buffer, int pnum );
00094 
00096         void MotionCompensate( EncQueue& my_buffer, int pnum, AddOrSub dirn );
00097 
00099         void Prefilter( EncQueue& my_buffer, int pnum );
00100 
00102         void DoDWT( EncQueue& my_buffer , int pnum, Direction dirn );
00103 
00105 
00111         void CodeResidue(  EncQueue& my_pbuffer , int pnum , PictureByteIO* pic_byteio);
00112 
00114         void CodeMVData( EncQueue& my_buffer, int pnum, PictureByteIO* pic_byteio);
00115         
00117         bool IsSkipped(){ return m_skipped; }
00118 
00120         bool IsMEDataAvail() const { return m_medata_avail; }
00121 
00123         const MEData* GetMEData() const;
00124 
00125     private:
00127 
00131         PictureCompressor( const PictureCompressor& cpy );
00132 
00134 
00138         PictureCompressor& operator=(const PictureCompressor& rhs);
00139 
00141         void InitCoeffData( CoeffArray& coeff_data, const int xl, const int yl );
00142 
00144         float GetCompLambda( const EncPicture& my_picture,
00145                              const CompSort csort );
00146 
00147         void SelectQuantisers( CoeffArray& coeff_data , 
00148                                SubbandList& bands ,
00149                                const float lambda,
00150                                OneDArray<unsigned int>& est_counts,
00151                                const CodeBlockMode cb_mode,
00152                                const PictureParams& pp,
00153                                const CompSort csort );
00154 
00155         int SelectMultiQuants( CoeffArray& coeff_data , 
00156                                SubbandList& bands , 
00157                                const int band_num,
00158                                const float lambda,
00159                                const PictureParams& pp, 
00160                                const CompSort csort );
00161 
00162         void SetupCodeBlocks( SubbandList& bands );
00163 
00164 
00165         void AddSubAverage(CoeffArray& coeff_data,int xl,int yl,AddOrSub dirn);
00166 
00167     private:
00168 
00169         //member variables
00170         // a local copy of the encoder params
00171         EncoderParams& m_encparams;
00172      
00173         // True if the picture has been skipped, false otherwise
00174         bool m_skipped;                
00175 
00176         // True if we use global motion vectors, false otherwise
00177         bool m_use_global;
00178 
00179         // True if we use block motion vectors, false otherwise
00180         bool m_use_block_mv;
00181         
00182         // Prediction mode to use if we only have global motion vectors
00183         PredMode m_global_pred_mode;
00184        
00185         // A pointer to the current picture motion vector data
00186     MEData* m_me_data;
00187 
00188         // True if motion estimation data is available
00189         bool m_medata_avail;
00190 
00191         // True if we have detected a cut
00192         bool m_is_a_cut;
00193 
00194         // The original MV precision type
00195         MVPrecisionType m_orig_prec;
00196 
00197     };
00198 
00199 } // namespace dirac
00200 
00201 #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.