# 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
dirac::PredMode
PredMode
Prediction modes for blocks.
Definition: common.h:84
dirac::PictureCompressor::m_orig_prec
MVPrecisionType m_orig_prec
Definition: picture_compress.h:195
dirac::Direction
Direction
Forward or backward.
Definition: common.h:93
dirac::PictureCompressor
Compress a single image picture.
Definition: picture_compress.h:61
dirac::PictureCompressor::m_is_a_cut
bool m_is_a_cut
Definition: picture_compress.h:192
dirac::PictureCompressor::CalcComplexity
void CalcComplexity(EncQueue &my_buffer, int pnum, const OLBParams &olbparams)
Calculate the complexity of a picture.
dirac::PictureCompressor::ModeDecisionME
void ModeDecisionME(EncQueue &my_buffer, int pnum)
Do mode decision based on sub-pel vectors.
dirac::PictureCompressor::InitCoeffData
void InitCoeffData(CoeffArray &coeff_data, const int xl, const int yl)
Initialise the coefficient data array for holding wavelet coefficients.
dirac::EncPicture
Definition: enc_picture.h:64
CodeBlockMode
CodeBlockMode
Definition: common_types.h:198
dirac::CoeffArray
A class for wavelet coefficient data.
Definition: wavelet_utils.h:622
MVPrecisionType
MVPrecisionType
Definition: common_types.h:189
dirac::OneDArray
A template class for one-dimensional arrays.
Definition: arrays.h:89
dirac::PictureCompressor::SetupCodeBlocks
void SetupCodeBlocks(SubbandList &bands)
dirac::PictureCompressor::m_me_data
MEData * m_me_data
Definition: picture_compress.h:186
common.h
dirac::SubbandList
A class encapulating all the subbands produced by a transform.
Definition: wavelet_utils.h:279
motion.h
dirac::PictureCompressor::SelectQuantisers
void SelectQuantisers(CoeffArray &coeff_data, SubbandList &bands, const float lambda, OneDArray< unsigned int > &est_counts, const CodeBlockMode cb_mode, const PictureParams &pp, const CompSort csort)
dirac::PictureCompressor::AddSubAverage
void AddSubAverage(CoeffArray &coeff_data, int xl, int yl, AddOrSub dirn)
dirac::PictureCompressor::CalcComplexity2
void CalcComplexity2(EncQueue &my_buffer, int pnum)
dirac::EncoderParams
Parameters for the encoding process.
Definition: common.h:1279
dirac::PictureCompressor::MotionCompensate
void MotionCompensate(EncQueue &my_buffer, int pnum, AddOrSub dirn)
Does motion compensation on picture pnum (forward or backward)
dirac::PictureByteIO
A compressed picture in Dirac bytestream format.
Definition: picture_byteio.h:60
enc_queue.h
dirac::PictureCompressor::DoDWT
void DoDWT(EncQueue &my_buffer, int pnum, Direction dirn)
Do the DWT on a given picture.
dirac::PictureCompressor::m_use_global
bool m_use_global
Definition: picture_compress.h:177
dirac::OLBParams
Parameters for overlapped block motion compensation.
Definition: common.h:817
dirac::PictureParams
Parameters for initialising picture class objects.
Definition: common.h:532
dirac::PictureCompressor::SelectMultiQuants
int SelectMultiQuants(CoeffArray &coeff_data, SubbandList &bands, const int band_num, const float lambda, const PictureParams &pp, const CompSort csort)
dirac::PictureCompressor::m_global_pred_mode
PredMode m_global_pred_mode
Definition: picture_compress.h:183
dirac::MEData
Class for all the motion estimation data.
Definition: motion.h:313
dirac::PictureCompressor::IntraModeAnalyse
void IntraModeAnalyse(EncQueue &my_buffer, int pnum)
Detect cuts in the current picture.
dirac::PictureCompressor::NormaliseComplexity
void NormaliseComplexity(EncQueue &my_buffer, int pnum)
Normalise picture complexity with respect to others in the queue.
dirac::PictureCompressor::IsMEDataAvail
bool IsMEDataAvail() const
Returns true if Motion estimation data is available.
Definition: picture_compress.h:120
dirac::PictureCompressor::m_encparams
EncoderParams & m_encparams
Definition: picture_compress.h:171
dirac::PictureCompressor::PictureCompressor
PictureCompressor(EncoderParams &encp)
Constructor.
picture_byteio.h
dirac::PictureCompressor::~PictureCompressor
~PictureCompressor()
Destructor.
dirac::PictureCompressor::CodeResidue
void CodeResidue(EncQueue &my_pbuffer, int pnum, PictureByteIO *pic_byteio)
Compress a specific picture within a group of pictures (GOP)
dirac
Definition of class SequenceHeaderByteIO.
Definition: accessunit_byteio.h:51
dirac::AddOrSub
AddOrSub
Addition or subtraction.
Definition: common.h:90
dirac::PictureCompressor::IsSkipped
bool IsSkipped()
Returns true if the picture has been skipped rather than coded normally.
Definition: picture_compress.h:117
dirac::PictureCompressor::Prefilter
void Prefilter(EncQueue &my_buffer, int pnum)
Prefilter if required.
dirac::PictureCompressor::operator=
PictureCompressor & operator=(const PictureCompressor &rhs)
Assignment = is private and body-less.
dirac::EncQueue
Holds pictures both for reference and to overcome reordering delay.
Definition: enc_queue.h:59
dirac::PictureCompressor::CodeMVData
void CodeMVData(EncQueue &my_buffer, int pnum, PictureByteIO *pic_byteio)
Compresses the motion vector data.
dirac::PictureCompressor::GetMEData
const MEData * GetMEData() const
Returns the motion estimation data.
dirac::CompSort
CompSort
Types of picture component.
Definition: common.h:87
dirac::PictureCompressor::SubPixelME
void SubPixelME(EncQueue &my_buffer, int pnum)
Do subpixel accurate motion vector refinement.
dirac::PictureCompressor::m_medata_avail
bool m_medata_avail
Definition: picture_compress.h:189
dirac::PictureCompressor::m_use_block_mv
bool m_use_block_mv
Definition: picture_compress.h:180
dirac::PictureCompressor::PixelME
void PixelME(EncQueue &my_buffer, int pnum)
Do pixel accurate motion estimate.
dirac::PictureCompressor::GetCompLambda
float GetCompLambda(const EncPicture &my_picture, const CompSort csort)
Returns the value lambda according to picture and component type.
dirac::PictureCompressor::m_skipped
bool m_skipped
Definition: picture_compress.h:174

© 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.