Dirac - A Video Codec

Created by the British Broadcasting Corporation.


seq_compress.h
Go to the documentation of this file.
1/* ***** BEGIN LICENSE BLOCK *****
2*
3* $Id: seq_compress.h,v 1.33 2008/10/20 04:20:12 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#ifndef _SEQ_COMPRESS_H_
42#define _SEQ_COMPRESS_H_
43
45//-------------------------------------//
46//Class to manage compressing sequences//
47//-------------------------------------//
49
58
59#include <fstream>
60
61namespace dirac
62{
63
65
74 public:
76
85 EncoderParams& encp,
86 DiracByteStream& dirac_byte_stream);
87
89
93
95
103 virtual bool LoadNextFrame() = 0;
104
106
126
128 virtual void SetPicTypeAndRefs( PictureParams& pparams ) = 0;
129
132
134
136
141 bool Finished(){return m_all_done;}
142
144 void SignalEOS() { m_eos_signalled = true; }
145
147 int PTSOffset(){return m_delay;}
148
149 protected:
150
153
155
161 virtual int CodedToDisplay(const int pnum) = 0;
162
165
167 virtual void CleanBuffers();
168
170 //Purely virtual. The child class will have to define it.
171 virtual void UpdateCBRModel(EncPicture& my_picture, const PictureByteIO* picture_byteio) = 0;
172
174 void UpdateIntraPicCBRModel( const PictureParams& , const bool is_a_cut );
175
177 bool CanEncode();
178
181
183
189
192
195
198
201
204
207
210
213
216
219
222
223 //state variables for CompressNextPicture
224
227
230
233
236
239
242
245
248
251
254
257
258 private:
260
265
267
272
273
274 };
275
277
284 {
285 public:
287
297 EncoderParams& encp,
298 DiracByteStream& dirac_byte_stream);
299
301
305
307
313 virtual bool LoadNextFrame();
314
316 virtual void SetPicTypeAndRefs( PictureParams& pparams );
317
318protected:
319 virtual int CodedToDisplay(const int pnum);
320 virtual void UpdateCBRModel(EncPicture& my_picture, const PictureByteIO* picture_byteio);
321
322 };
323
325
332 {
333 public:
335
344 EncoderParams& encp,
345 DiracByteStream& dirac_byte_stream);
346
348
352
354
361 virtual bool LoadNextFrame();
362
363
365 virtual void SetPicTypeAndRefs( PictureParams& pparams );
366
367 protected:
368
369 virtual int CodedToDisplay(const int pnum);
370
371 virtual void UpdateCBRModel(EncPicture& my_picture, const PictureByteIO* picture_byteio);
372 private:
374
379
380 // Field1 bytes
382 // Field2 bytes
384 };
385} // namespace dirac
386
387#endif
Definition of class SequenceHeaderByteIO.
Definition accessunit_byteio.h:52
Class DiracByteStats - for collecting statistics on aspects of the Dirac byte-stream.
Definition dirac_byte_stats.h:71
Represents a series of bytes in the Dirac bytestream specfication format.
Definition dirac_byte_stream.h:61
A compressed picture in Dirac bytestream format.
Definition picture_byteio.h:61
Parameters relating to the source material being encoded/decoded.
Definition common.h:289
Parameters for initialising picture class objects.
Definition common.h:533
A class for picture component data.
Definition common.h:719
Parameters for overlapped block motion compensation.
Definition common.h:818
Structure to hold motion parameters when motion comp is used.
Definition common.h:968
Parameters for the encoding process.
Definition common.h:1280
Picture input class.
Definition pic_io.h:303
Definition enc_picture.h:65
Holds pictures both for reference and to overcome reordering delay.
Definition enc_queue.h:59
Compress a single image picture.
Definition picture_compress.h:62
Class to monitor the quality of pictures and adjust coding parameters appropriately.
Definition quality_monitor.h:49
A clas for allocation the bits to each and every types of frames in a GOP.
Definition rate_control.h:92
DiracByteStats EndSequence()
int m_delay
A delay so that we don't display what we haven't coded.
Definition seq_compress.h:241
PicturePredParams & m_predparams
The parameters used for ME/MC.
Definition seq_compress.h:209
const EncPicture * GetPictureEncoded()
Return a pointer to the most recent picture encoded.
EncoderParams & m_encparams
The parameters used for encoding.
Definition seq_compress.h:206
bool CanEncode()
Returns true if the encoder can encode a picture.
void SetMotionParameters()
Set up the motion block parameters.
virtual bool LoadNextFrame()=0
Load data.
void MakeSequenceReport()
Make a report to screen on the coding results for the whole sequence.
PictureCompressor m_pcoder
A class to hold the picture compressor object.
Definition seq_compress.h:250
SequenceCompressor & operator=(const SequenceCompressor &rhs)
Assignment = is private and body-less.
OLBParams * m_basic_olb_params0
A class to hold the basic block parameters.
Definition seq_compress.h:191
QualityMonitor m_qmonitor
A class for monitoring the quality of pictures and adjusting parameters appropriately.
Definition seq_compress.h:244
OLBParams * m_intra_olbp
A class to hold block parameters to use when there are lots of intra blocks.
Definition seq_compress.h:200
bool Finished()
Determine if compression is complete.
Definition seq_compress.h:141
void SignalEOS()
Signal end of sequence.
Definition seq_compress.h:144
PictureParams m_pparams
Generic picture parameters for initialising pictures.
Definition seq_compress.h:215
virtual void CleanBuffers()
Remove unwanted pictures from picture buffers.
const EncPicture * CompressNextPicture()
Compress the next picture in sequence.
bool m_eos_signalled
Flag to check if End of Sequence has been signalled by the end user.
Definition seq_compress.h:256
int m_L1_sep
The L1 separation currently in use.
Definition seq_compress.h:212
virtual void UpdateCBRModel(EncPicture &my_picture, const PictureByteIO *picture_byteio)=0
Update the CBR model based on the data we've compressed.
int m_show_pnum
The number of the picture which should be output for concurrent display or storage.
Definition seq_compress.h:232
int m_last_picture_read
The index, in display order, of the last picture read.
Definition seq_compress.h:235
void UpdateIntraPicCBRModel(const PictureParams &, const bool is_a_cut)
Update the parameters to be used in advance of coding an intra frame.
RateController * m_ratecontrol
A class for monitoring and controlling bit rate.
Definition seq_compress.h:247
SequenceCompressor(const SequenceCompressor &cpy)
Copy constructor is private and body-less.
bool m_all_done
Completion flag, returned via the Finished method.
Definition seq_compress.h:180
const OLBParams * m_basic_olb_params2
A class to hold the basic block parameters.
Definition seq_compress.h:197
virtual void SetPicTypeAndRefs(PictureParams &pparams)=0
Set up the appropriate prediction parameters for a picture.
StreamPicInput * m_pic_in
Pointer pointing at the picture input.
Definition seq_compress.h:218
int m_current_code_pnum
The number of the current picture to be coded, in coded order.
Definition seq_compress.h:229
EncQueue m_enc_pbuffer
A picture buffer used for local storage of pictures whilst pending re-ordering or being used for refe...
Definition seq_compress.h:221
bool m_just_finished
Flag indicating whether we've just finished.
Definition seq_compress.h:188
SourceParams & m_srcparams
The parameters of the input source.
Definition seq_compress.h:203
int PTSOffset()
The delay required for correct timestamps.
Definition seq_compress.h:147
virtual ~SequenceCompressor()
Destructor.
SequenceCompressor(StreamPicInput *pin, EncoderParams &encp, DiracByteStream &dirac_byte_stream)
Constructor.
OLBParams * m_basic_olb_params1
A class to hold the basic block parameters.
Definition seq_compress.h:194
virtual int CodedToDisplay(const int pnum)=0
Uses the GOP parameters to convert picture numbers in coded order to display order.
DiracByteStream & m_dirac_byte_stream
Output destination for compressed data in bitstream format.
Definition seq_compress.h:253
int m_current_display_pnum
The number of the current picture to be coded, in display order.
Definition seq_compress.h:226
int m_gop_start_num
The picture number of the last GOP start.
Definition seq_compress.h:238
virtual int CodedToDisplay(const int pnum)
Uses the GOP parameters to convert picture numbers in coded order to display order.
virtual ~FrameSequenceCompressor()
Destructor.
Definition seq_compress.h:304
virtual bool LoadNextFrame()
Load data.
FrameSequenceCompressor(StreamPicInput *pin, EncoderParams &encp, DiracByteStream &dirac_byte_stream)
Constructor.
virtual void SetPicTypeAndRefs(PictureParams &pparams)
Set up the appropriate prediction parameters for a picture.
virtual void UpdateCBRModel(EncPicture &my_picture, const PictureByteIO *picture_byteio)
Update the CBR model based on the data we've compressed.
virtual void SetPicTypeAndRefs(PictureParams &pparams)
Set up the appropriate prediction parameters for a picture.
int m_field1_bytes
Definition seq_compress.h:381
virtual int CodedToDisplay(const int pnum)
Uses the GOP parameters to convert picture numbers in coded order to display order.
virtual ~FieldSequenceCompressor()
Destructor.
void PreMotionEstmationFilter(PicArray &comp)
Filter fields.
int m_field2_bytes
Definition seq_compress.h:383
virtual bool LoadNextFrame()
Load data.
virtual void UpdateCBRModel(EncPicture &my_picture, const PictureByteIO *picture_byteio)
Update the CBR model based on the data we've compressed.
FieldSequenceCompressor(StreamPicInput *pin, EncoderParams &encp, DiracByteStream &dirac_byte_stream)
Constructor.

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