Fixed #2984304. Fix compilation errors reported by gcc 4.5.0.
[dirac-research.git] / libdirac_encoder / enc_picture.h
blob0fec28ba98a4c3770f1ba0e824d564a80dae21e4
1 /* ***** BEGIN LICENSE BLOCK *****
3 * $Id: enc_picture.h,v 1.1 2008/06/19 10:02:02 tjdwave Exp $ $Name: $
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 * The contents of this file are subject to the Mozilla Public License
8 * Version 1.1 (the "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
14 * the specific language governing rights and limitations under the License.
16 * The Original Code is BBC Research and Development code.
18 * The Initial Developer of the Original Code is the British Broadcasting
19 * Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2008.
21 * All Rights Reserved.
23 * Contributor(s): Thomas Davies (Original Author),
25 * Alternatively, the contents of this file may be used under the terms of
26 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
27 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
28 * the GPL or the LGPL are applicable instead of those above. If you wish to
29 * allow use of your version of this file only under the terms of the either
30 * the GPL or LGPL and not to allow others to use your version of this file
31 * under the MPL, indicate your decision by deleting the provisions above
32 * and replace them with the notice and other provisions required by the GPL
33 * or LGPL. If you do not delete the provisions above, a recipient may use
34 * your version of this file under the terms of any one of the MPL, the GPL
35 * or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef _ENC_PICTURE_H_
39 #define _ENC_PICTURE_H_
41 #include <libdirac_common/picture.h>
42 #include <libdirac_common/motion.h>
45 namespace dirac
47 static const unsigned int DONE_ME_INIT = 0x1;
48 static const unsigned int DONE_PEL_ME = 0x2;
49 static const unsigned int DONE_SUBPEL_ME = 0x4;
50 static const unsigned int DONE_ME_MODE_DECN = 0x8;
51 static const unsigned int DONE_MV_CODING = 0x10;
52 static const unsigned int DONE_MC = 0x20;
53 static const unsigned int DONE_DWT = 0x40;
54 static const unsigned int DONE_QUANT_SEL = 0x80;
55 static const unsigned int DONE_RES_CODING = 0x100;
56 static const unsigned int DONE_IDWT = 0x200;
57 static const unsigned int DONE_MC_BACK = 0x400;
58 static const unsigned int DONE_SET_PTYPE = 0x800;
59 static const unsigned int DONE_PIC_COMPLEXITY = 0x1000;
61 static const unsigned int ALL_ENC = 0xFFFFFFFF;
62 static const unsigned int NO_ENC = 0;
64 class EncPicture : public Picture
66 public:
67 EncPicture( const PictureParams& pp );
69 virtual ~EncPicture();
71 //! Initialise the motion estimation data arrays
72 void InitMEData( const PicturePredParams& predparams, const int num_refs);
74 //! Returns the motion data
75 MEData& GetMEData(){ return *m_me_data;}
77 //! Returns the motion data
78 const MEData& GetMEData() const { return *m_me_data;}
80 //! Drops a reference from the motion vector data
81 void DropRef( int rindex );
84 //! Returns a given component of the original data
85 const PicArray& OrigData(CompSort c) const { return *m_orig_data[(int) c];}
87 //! Returns a given upconverted component of the original data
88 const PicArray& UpOrigData(CompSort cs) const;
90 //! Initialises a copy of the data arrays into the original data
91 void SetOrigData();
93 //! Returns a version of the picture data suitable for motion estimation
94 const PicArray& DataForME(bool combined_me) const;
96 //! Returns a version of the picture data suitable for subpel motion estimation
97 const PicArray& UpDataForME(bool combined_me) const;
100 void UpdateStatus( const unsigned int mask ){ m_status |= mask; }
102 void FlipStatus( const unsigned int mask){ m_status ^= mask; }
104 void SetStatus( const int status ){ m_status = status; }
106 unsigned int GetStatus() const{ return m_status; }
109 double GetComplexity() const {return m_complexity; }
111 void SetComplexity(double c){ m_complexity = c; }
113 double GetNormComplexity() const { return m_norm_complexity; }
115 void SetNormComplexity( double c ){ m_norm_complexity = c; }
117 double GetPredBias() const { return m_pred_bias; }
119 void SetPredBias( double b ){ m_pred_bias = b; }
122 private:
124 virtual void ClearData();
126 //! Filters a (field) picture vertically to reduce aliasing for motion estimation purposes
127 void AntiAliasFilter( PicArray& out_data, const PicArray& in_data ) const;
129 //! Returns an anti-aliased version of the original data
130 const PicArray& FiltData(CompSort c) const;
132 const PicArray& CombinedData() const;
133 const PicArray& UpCombinedData() const;
134 void Combine( PicArray& comb_data, const PicArray& y_data,
135 const PicArray& u_data, const PicArray& v_data ) const;
137 //! Returns an upconverted anti-aliased version of the original data
138 const PicArray& UpFiltData(CompSort c) const;
141 void SetOrigData(const int c);
143 private:
145 PicArray* m_orig_data[3];
146 mutable PicArray* m_orig_up_data[3];
147 mutable PicArray* m_filt_data[3];
148 mutable PicArray* m_filt_up_data[3];
150 MEData* m_me_data;
152 unsigned int m_status;
154 double m_complexity;
155 double m_norm_complexity;
157 double m_pred_bias;
163 #endif