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 
51 #include <libdirac_common/common.h>
53 #include <libdirac_common/pic_io.h>
58 
59 #include <fstream>
60 
61 namespace dirac
62 {
63 
65 
74  public:
76 
85  EncoderParams& encp,
86  DiracByteStream& dirac_byte_stream);
87 
89 
92  virtual ~SequenceCompressor();
93 
95 
103  virtual bool LoadNextFrame() = 0;
104 
106 
126 
128  virtual void SetPicTypeAndRefs( PictureParams& pparams ) = 0;
129 
131  const EncPicture *GetPictureEncoded();
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 
152  void SetMotionParameters();
153 
155 
161  virtual int CodedToDisplay(const int pnum) = 0;
162 
164  void MakeSequenceReport();
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 
212  int m_L1_sep;
213 
216 
219 
222 
223  //state variables for CompressNextPicture
224 
227 
230 
233 
236 
239 
241  int m_delay;
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 
318 protected:
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 
351  virtual ~FieldSequenceCompressor();
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 
378  void PreMotionEstmationFilter (PicArray& comp);
379 
380  // Field1 bytes
382  // Field2 bytes
384  };
385 } // namespace dirac
386 
387 #endif
OLBParams * m_intra_olbp
A class to hold block parameters to use when there are lots of intra blocks.
Definition: seq_compress.h:200
PictureParams m_pparams
Generic picture parameters for initialising pictures.
Definition: seq_compress.h:215
Definition of class SequenceHeaderByteIO.
Definition: accessunit_byteio.h:51
QualityMonitor m_qmonitor
A class for monitoring the quality of pictures and adjusting parameters appropriately.
Definition: seq_compress.h:244
virtual void SetPicTypeAndRefs(PictureParams &pparams)
Set up the appropriate prediction parameters for a picture.
int m_show_pnum
The number of the picture which should be output for concurrent display or storage.
Definition: seq_compress.h:232
virtual void SetPicTypeAndRefs(PictureParams &pparams)=0
Set up the appropriate prediction parameters for a picture.
virtual ~FrameSequenceCompressor()
Destructor.
Definition: seq_compress.h:304
int m_last_picture_read
The index, in display order, of the last picture read.
Definition: seq_compress.h:235
SourceParams & m_srcparams
The parameters of the input source.
Definition: seq_compress.h:203
virtual void CleanBuffers()
Remove unwanted pictures from picture buffers.
bool m_eos_signalled
Flag to check if End of Sequence has been signalled by the end user.
Definition: seq_compress.h:256
void SignalEOS()
Signal end of sequence.
Definition: seq_compress.h:144
int PTSOffset()
The delay required for correct timestamps.
Definition: seq_compress.h:147
void SetMotionParameters()
Set up the motion block parameters.
Parameters relating to the source material being encoded/decoded.
Definition: common.h:288
Represents a series of bytes in the Dirac bytestream specfication format.
Definition: dirac_byte_stream.h:60
virtual bool LoadNextFrame()
Load data.
int m_gop_start_num
The picture number of the last GOP start.
Definition: seq_compress.h:238
const OLBParams * m_basic_olb_params2
A class to hold the basic block parameters.
Definition: seq_compress.h:197
SequenceCompressor(StreamPicInput *pin, EncoderParams &encp, DiracByteStream &dirac_byte_stream)
Constructor.
void PreMotionEstmationFilter(PicArray &comp)
Filter fields.
Structure to hold motion parameters when motion comp is used.
Definition: common.h:967
Class to monitor the quality of pictures and adjust coding parameters appropriately.
Definition: quality_monitor.h:48
EncoderParams & m_encparams
The parameters used for encoding.
Definition: seq_compress.h:206
RateController * m_ratecontrol
A class for monitoring and controlling bit rate.
Definition: seq_compress.h:247
Picture input class.
Definition: pic_io.h:302
virtual int CodedToDisplay(const int pnum)
Uses the GOP parameters to convert picture numbers in coded order to display order.
virtual int CodedToDisplay(const int pnum)
Uses the GOP parameters to convert picture numbers in coded order to display order.
Parameters for overlapped block motion compensation.
Definition: common.h:817
FieldSequenceCompressor(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
Definition: enc_picture.h:64
Compresses a sequence of fields from a stream.
Definition: seq_compress.h:331
virtual void SetPicTypeAndRefs(PictureParams &pparams)
Set up the appropriate prediction parameters for a picture.
bool CanEncode()
Returns true if the encoder can encode a picture.
int m_current_display_pnum
The number of the current picture to be coded, in display order.
Definition: seq_compress.h:226
Parameters for the encoding process.
Definition: common.h:1279
OLBParams * m_basic_olb_params0
A class to hold the basic block parameters.
Definition: seq_compress.h:191
bool m_just_finished
Flag indicating whether we&#39;ve just finished.
Definition: seq_compress.h:188
DiracByteStream & m_dirac_byte_stream
Output destination for compressed data in bitstream format.
Definition: seq_compress.h:253
const EncPicture * GetPictureEncoded()
Return a pointer to the most recent picture encoded.
A class for picture component data.
Definition: common.h:718
virtual ~SequenceCompressor()
Destructor.
Class DiracByteStats - for collecting statistics on aspects of the Dirac byte-stream.
Definition: dirac_byte_stats.h:70
virtual void UpdateCBRModel(EncPicture &my_picture, const PictureByteIO *picture_byteio)
Update the CBR model based on the data we&#39;ve compressed.
DiracByteStats EndSequence()
virtual bool LoadNextFrame()
Load data.
bool Finished()
Determine if compression is complete.
Definition: seq_compress.h:141
FrameSequenceCompressor(StreamPicInput *pin, EncoderParams &encp, DiracByteStream &dirac_byte_stream)
Constructor.
virtual void UpdateCBRModel(EncPicture &my_picture, const PictureByteIO *picture_byteio)
Update the CBR model based on the data we&#39;ve compressed.
void UpdateIntraPicCBRModel(const PictureParams &, const bool is_a_cut)
Update the parameters to be used in advance of coding an intra frame.
A compressed picture in Dirac bytestream format.
Definition: picture_byteio.h:60
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
Compress a single image picture.
Definition: picture_compress.h:61
PicturePredParams & m_predparams
The parameters used for ME/MC.
Definition: seq_compress.h:209
Parameters for initialising picture class objects.
Definition: common.h:532
SequenceCompressor & operator=(const SequenceCompressor &rhs)
Assignment = is private and body-less.
int m_current_code_pnum
The number of the current picture to be coded, in coded order.
Definition: seq_compress.h:229
Compresses a sequence of frames/fields from a stream.
Definition: seq_compress.h:73
int m_field2_bytes
Definition: seq_compress.h:383
int m_field1_bytes
Definition: seq_compress.h:381
int m_delay
A delay so that we don&#39;t display what we haven&#39;t coded.
Definition: seq_compress.h:241
Holds pictures both for reference and to overcome reordering delay.
Definition: enc_queue.h:59
virtual bool LoadNextFrame()=0
Load data.
bool m_all_done
Completion flag, returned via the Finished method.
Definition: seq_compress.h:180
StreamPicInput * m_pic_in
Pointer pointing at the picture input.
Definition: seq_compress.h:218
virtual ~FieldSequenceCompressor()
Destructor.
PictureCompressor m_pcoder
A class to hold the picture compressor object.
Definition: seq_compress.h:250
A clas for allocation the bits to each and every types of frames in a GOP.
Definition: rate_control.h:91
const EncPicture * CompressNextPicture()
Compress the next picture in sequence.
Compresses a sequence of frames from a stream.
Definition: seq_compress.h:283
void MakeSequenceReport()
Make a report to screen on the coding results for the whole sequence.
virtual int CodedToDisplay(const int pnum)=0
Uses the GOP parameters to convert picture numbers in coded order to display order.
virtual void UpdateCBRModel(EncPicture &my_picture, const PictureByteIO *picture_byteio)=0
Update the CBR model based on the data we&#39;ve compressed.
int m_L1_sep
The L1 separation currently in use.
Definition: seq_compress.h:212

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