# Dirac - A Video Codec

Created by the British Broadcasting Corporation.

picture_compress.h
Go to the documentation of this file.
1 /* ***** BEGIN LICENSE BLOCK *****
2 *
3 * $Id: picture_compress.h,v 1.7 2008/08/14 02:30:50 asuraparaju Exp $ $Name: Dirac_1_0_2 $
4 *
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 *
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/
11 *
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.
15 *
16 * The Original Code is BBC Research and Development code.
17 *
18 * The Initial Developer of the Original Code is the British Broadcasting
19 * Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2004.
21 * All Rights Reserved.
22 *
23 * Contributor(s): Thomas Davies (Original Author),
24 * Scott R Ladd,
25 * Anuradha Suraparaju
26 * Andrew Kennedy
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
30 * Public License Version 2.1 (the "LGPL"), in which case the provisions of
31 * the GPL or the LGPL are applicable instead of those above. If you wish to
32 * allow use of your version of this file only under the terms of the either
33 * the GPL or LGPL and not to allow others to use your version of this file
34 * under the MPL, indicate your decision by deleting the provisions above
35 * and replace them with the notice and other provisions required by the GPL
36 * or LGPL. If you do not delete the provisions above, a recipient may use
37 * your version of this file under the terms of any one of the MPL, the GPL
38 * or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
40
41
42 #ifndef _PICTURE_COMPRESS_H_
43 #define _PICTURE_COMPRESS_H_
44
45 #include <libdirac_encoder/enc_queue.h>
46 #include <libdirac_common/common.h>
47 #include <libdirac_common/motion.h>
48 #include <libdirac_byteio/picture_byteio.h>
49
50 namespace dirac
51 {
52
53 class MvData;
54
56
61 class PictureCompressor
62 {
63 public:
65
71 PictureCompressor( EncoderParams& encp );
72
74 ~PictureCompressor( );
75
77 void PixelME( EncQueue& my_buffer , int pnum );
78
80 void CalcComplexity( EncQueue& my_buffer, int pnum , const OLBParams& olbparams );
81 void CalcComplexity2( EncQueue& my_buffer, int pnum );
82
84 void NormaliseComplexity( EncQueue& my_buffer, int pnum );
85
87 void SubPixelME( EncQueue& my_buffer , int pnum );
88
90 void ModeDecisionME( EncQueue& my_buffer, int pnum );
91
93 void IntraModeAnalyse( EncQueue& my_buffer, int pnum );
94
96 void MotionCompensate( EncQueue& my_buffer, int pnum, AddOrSub dirn );
97
99 void Prefilter( EncQueue& my_buffer, int pnum );
100
102 void DoDWT( EncQueue& my_buffer , int pnum, Direction dirn );
103
105
111 void CodeResidue( EncQueue& my_pbuffer , int pnum , PictureByteIO* pic_byteio);
112
114 void CodeMVData( EncQueue& my_buffer, int pnum, PictureByteIO* pic_byteio);
115
117 bool IsSkipped(){ return m_skipped; }
118
120 bool IsMEDataAvail() const { return m_medata_avail; }
121
123 const MEData* GetMEData() const;
124
125 private:
127
131 PictureCompressor( const PictureCompressor& cpy );
132
134
138 PictureCompressor& operator=(const PictureCompressor& rhs);
139
141 void InitCoeffData( CoeffArray& coeff_data, const int xl, const int yl );
142
144 float GetCompLambda( const EncPicture& my_picture,
145 const CompSort csort );
146
147 void SelectQuantisers( CoeffArray& coeff_data ,
148 SubbandList& bands ,
149 const float lambda,
150 OneDArray<unsigned int>& est_counts,
151 const CodeBlockMode cb_mode,
152 const PictureParams& pp,
153 const CompSort csort );
154
155 int SelectMultiQuants( CoeffArray& coeff_data ,
156 SubbandList& bands ,
157 const int band_num,
158 const float lambda,
159 const PictureParams& pp,
160 const CompSort csort );
161
162 void SetupCodeBlocks( SubbandList& bands );
163
164
165 void AddSubAverage(CoeffArray& coeff_data,int xl,int yl,AddOrSub dirn);
166
167 private:
168
169 //member variables
170 // a local copy of the encoder params
171 EncoderParams& m_encparams;
172
173 // True if the picture has been skipped, false otherwise
174 bool m_skipped;
175
176 // True if we use global motion vectors, false otherwise
177 bool m_use_global;
178
179 // True if we use block motion vectors, false otherwise
180 bool m_use_block_mv;
181
182 // Prediction mode to use if we only have global motion vectors
183 PredMode m_global_pred_mode;
184
185 // A pointer to the current picture motion vector data
186 MEData* m_me_data;
187
188 // True if motion estimation data is available
189 bool m_medata_avail;
190
191 // True if we have detected a cut
192 bool m_is_a_cut;
193
194 // The original MV precision type
195 MVPrecisionType m_orig_prec;
196
197 };
198
199 } // namespace dirac
200
201 #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.