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.2 2008/04/29 08:51:52 tjdwave Exp $ $Name: Dirac_0_10_0 $
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_common/picture_buffer.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 
00082         bool MotionEstimate( const PictureBuffer& my_fbuffer, 
00083                                         int fnum); 
00084 
00086 
00092         PictureByteIO* Compress(  PictureBuffer& 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         PictureCompressor( const PictureCompressor& cpy );
00111 
00113 
00117         PictureCompressor& operator=(const PictureCompressor& rhs);
00118 
00120         void InitCoeffData( CoeffArray& coeff_data, const int xl, const int yl );
00121 
00123         void AnalyseMEData( const MEData& );
00124         
00126         void CompressMVData(MvDataByteIO* mv_data);
00127         
00129         float GetCompLambda( const PictureParams& fparams,
00130                              const CompSort csort );
00131 
00132         void SelectQuantisers( CoeffArray& coeff_data , 
00133                                SubbandList& bands ,
00134                                const float lambda,
00135                                OneDArray<unsigned int>& est_counts,
00136                                const CodeBlockMode cb_mode,
00137                                const PictureParams& pp,
00138                                const CompSort csort );
00139 
00140         int SelectMultiQuants( CoeffArray& coeff_data , 
00141                                SubbandList& bands , 
00142                                const int band_num,
00143                                const float lambda,
00144                                const PictureParams& pp, 
00145                                const CompSort csort );
00146 
00147         void SetupCodeBlocks( SubbandList& bands );
00148 
00149 
00150         void AddSubAverage(CoeffArray& coeff_data,int xl,int yl,AddOrSub dirn);
00151 
00152     private:
00153 
00154         //member variables
00155         // a local copy of the encoder params
00156         EncoderParams& m_encparams;
00157      
00158         // Pointer to the motion vector data
00159         MEData* m_me_data;
00160 
00161         // True if the picture has been skipped, false otherwise
00162         bool m_skipped;                
00163 
00164         // True if we use global motion vectors, false otherwise
00165         bool m_use_global;
00166 
00167         // True if we use block motion vectors, false otherwise
00168         bool m_use_block_mv;
00169         
00170         // Prediction mode to use if we only have global motion vectors
00171         PredMode m_global_pred_mode;
00172         
00173         // True if motion estimation data is available
00174         bool m_medata_avail;
00175 
00176         // True if we have detected a cut
00177         bool m_is_a_cut;
00178 
00179         // The proportion of intra blocks that motion estimation has found
00180         double m_intra_ratio;
00181     };
00182 
00183 } // namespace dirac
00184 
00185 #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.