# Dirac - A Video Codec

Created by the British Broadcasting Corporation.

wavelet_utils.h
Go to the documentation of this file.
1/* ***** BEGIN LICENSE BLOCK *****
2*
3* $Id: wavelet_utils.h,v 1.32 2008/10/20 04:21:02 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*
27* Alternatively, the contents of this file may be used under the terms of
28* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
29* Public License Version 2.1 (the "LGPL"), in which case the provisions of
30* the GPL or the LGPL are applicable instead of those above. If you wish to
31* allow use of your version of this file only under the terms of the either
32* the GPL or LGPL and not to allow others to use your version of this file
33* under the MPL, indicate your decision by deleting the provisions above
34* and replace them with the notice and other provisions required by the GPL
35* or LGPL. If you do not delete the provisions above, a recipient may use
36* your version of this file under the terms of any one of the MPL, the GPL
37* or the LGPL.
38* ***** END LICENSE BLOCK ***** */
39
40#ifndef _WAVELET_UTILS_H_
41#define _WAVELET_UTILS_H_
42
43#include <libdirac_common/arrays.h>
44#include <libdirac_common/common.h>
45#include <vector>
46#include <cmath>
47#include <iostream>
48
49//utilities for subband and wavelet transforms
50//Includes fast transform using lifting
51
52 namespace dirac
53{
54
55 class PicArray;
56 class Subband;
57
59 class CodeBlock
60 {
61
62 friend class Subband;
63
64 public:
66 /*
67 Default constructor - sets all dimensions to zero
68 */
69 CodeBlock();
70
72 /*
73 Initialise the code block
74 \param xstart the x-coord of the first coefficient in the block
75 \param xend one past the last coefficient, horizontally
76 \param ystart the y-coord of the first coefficient in the block
77 \param yend one past the last coefficient, vertically
78 */
79 CodeBlock( const int xstart , const int ystart , const int xend , const int yend);
80
82 int Xstart() const { return m_xstart; }
83
85 int Ystart() const { return m_ystart; }
86
88 int Xend() const { return m_xend; }
89
91 int Yend() const { return m_yend; }
92
94 int Xl() const { return m_xl; }
95
97 int Yl() const { return m_yl; }
98
100 int QuantIndex() const{ return m_quantindex; }
101
103 bool Skipped() const { return m_skipped; }
104
106 void SetQuantIndex( const int quantindex ){ m_quantindex = quantindex; }
107
109 void SetSkip( bool skip ){ m_skipped = skip; }
110
111 private:
112
114 /*
115 Initialise the code block
116 \param xstart the x-coord of the first coefficient in the block
117 \param xend one past the last coefficient, horizontally
118 \param ystart the y-coord of the first coefficient in the block
119 \param yend one past the last coefficient, vertically
120 */
121 void Init( const int xstart , const int ystart , const int xend , const int yend );
122
123 private:
124
125 int m_xstart;
126 int m_ystart;
127 int m_xend;
128 int m_yend;
129 int m_xl;
130 int m_yl;
131
132 int m_quantindex;
133
134 bool m_skipped;
135 };
136
137
139 class Subband
140 {
141 public:
142
144 Subband();
145
147
155 Subband(int xpos, int ypos, int xlen, int ylen);
156
158
167 Subband(int xpos, int ypos, int xlen, int ylen, int d);
168
170 ~Subband();
171
172 //Default (shallow) copy constructor and operator= used
173
175 int Xl() const {return m_xl;}
176
178 int Xp() const {return m_xp;}
179
181 int Yl() const {return m_yl;}
182
184 int Yp() const {return m_yp;}
185
187 int Max() const {return m_max_bit;}
188
190 double Wt() const {return m_wt;}
191
193 int Depth() const {return m_depth;}
194
196 int Scale() const {return ( 1<<m_depth );}
197
199 int QuantIndex() const {return m_qindex;}
200
202 bool UsingMultiQuants() const {return m_multi_quants; }
203
205 int Parent() const {return m_parent;}
206
208 const std::vector<int>& Children() const {return m_children;}
209
211 int Child(const int n) const {return m_children[n];}
212
214 TwoDArray<CodeBlock>& GetCodeBlocks(){ return m_code_block_array; }
215
217 const TwoDArray<CodeBlock>& GetCodeBlocks() const { return m_code_block_array; }
218
220 bool Skipped() const { return m_skipped; }
221
223 void SetWt( const float w );
224
226 void SetParent( const int p ){ m_parent=p; }
227
229 void SetDepth( const int d ){ m_depth=d;}
230
232 void SetMax( const int m ){ m_max_bit=m; };
233
235 void SetNumBlocks( const int ynum , const int xnum );
236
238 void SetQuantIndex( const int idx){ m_qindex = idx; }
239
241 void SetUsingMultiQuants( const bool multi){ m_multi_quants = multi; }
242
244 void SetSkip(const bool skip ){ m_skipped = skip; }
245
246 private:
247 // subband bounds
248 int m_xp , m_yp , m_xl , m_yl;
249
250 // perceptual weight for quantisation
251 double m_wt;
252
253 // depth in the transform
254 int m_depth;
255
256 // quantiser index
257 int m_qindex;
258
259 // position of parent in a subband list
260 int m_parent;
261
262 // positions of children in the subband list
263 std::vector<int> m_children;
264
265 // position of the MSB of the largest absolute value
266 int m_max_bit;
267
268 // The code blocks
269 TwoDArray<CodeBlock> m_code_block_array;
270
271 // A flag indicating whether we're using one qf for each code block
272 bool m_multi_quants;
273
274 // Whether the subband is skipped or not
275 bool m_skipped;
276 };
277
279 class SubbandList
280 {
281 public:
283 SubbandList(){}
284
286 ~SubbandList(){}
287
288 //Default (shallow) copy constructor and operator= used
290 void Init(const int depth,const int xlen,const int ylen);
291
293 int Length() const {return bands.size();}
294
296 Subband& operator()(const int n){return bands[n-1];}
297
299 const Subband& operator()(const int n) const {return bands[n-1];}
300
302 void AddBand(const Subband& b){bands.push_back(b);}
303
305 void Clear(){bands.clear();}
306
307 private:
308
310 float PerceptualWeight( const float xf , const float yf , const CompSort cs);
311
312 private:
313 std::vector<Subband> bands;
314 };
315
316 class CoeffArray;
318 class VHFilter
319 {
320
321 public:
322
323 VHFilter(){}
324
325 virtual ~VHFilter(){}
326
328 virtual void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data)=0;
329
331 virtual void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data)=0;
332
334 virtual int GetShift() const =0;
335
336 protected:
337
339 inline void Interleave( const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data );
340
341
343 inline void DeInterleave( const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data );
344
346 void ShiftRowLeft(CoeffType *row, int length, int shift);
347
349 void ShiftRowRight(CoeffType *row, int length, int shift);
350 };
351
353 class VHFilterDAUB9_7 : public VHFilter
354 {
355
356 public:
357
359 void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
360
362 void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
363
365 int GetShift() const {return 1;}
366
367
368 };
369
371 class VHFilterLEGALL5_3 : public VHFilter
372 {
373
374 public:
375
377 void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
378
380 void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
381
383 int GetShift() const {return 1;}
384
385
386#ifdef HAVE_MMX
387 inline void HorizSynth (int xp, int xl, int ystart, int yend, CoeffArray &coeff_data);
388#endif
389
390 };
391
393 class VHFilterDD9_7 : public VHFilter
394 {
395
396 public:
397
399 void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
400
402 void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
403
405 int GetShift() const {return 1;}
406 };
407
408
410 class VHFilterDD13_7 : public VHFilter
411 {
412
413 public:
414
416 void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
417
419 void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
420
422 int GetShift() const {return 1;}
423
424 };
425
427 class VHFilterHAAR0 : public VHFilter
428 {
429
430 public:
431
433 void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
434
436 void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
437
439 int GetShift() const {return 0;}
440
441
442 };
443
445 class VHFilterHAAR1 : public VHFilter
446 {
447
448 public:
449
451 void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
452
454 void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
455
457 int GetShift() const {return 1;}
458
459 };
460
461
463 class VHFilterHAAR2 : public VHFilter
464 {
465
466 public:
467
469 void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
470
472 void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray& coeff_data);
473
475 double GetLowFactor() const { return 1.414213562;}
476
478 double GetHighFactor() const { return 0.707106781;}
479
481 int GetShift() const {return 2;}
482
483 };
484
485
486
487 // Lifting steps used in the filters
488
490 template<int shift>
491 class PredictStepShift
492 {
493
494 public:
495
497 PredictStepShift(){}
498
499 // Assume default copy constructor, assignment= and destructor //
500
502 /*
503 Do the filtering.
504 \param in_val the value being predicted
505 \param val1 the first value being used for prediction
506 \param val2 the second value being used for prediction
507 */
508 inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
509 {
510 in_val -= (( val1 + val2 + (1<<(shift-1)) ) >>shift );
511 }
512
513 };
514
516 template<int shift>
517 class UpdateStepShift
518 {
519
520 public:
522 UpdateStepShift(){}
523
525 /*
526 Do the filtering.
527 \param in_val the value being updated
528 \param val1 the first value being used for updating
529 \param val2 the second value being used for updating
530 */
531 inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
532 {
533 in_val += ( ( val1 + val2 + (1<<(shift-1)) ) >>shift );
534 }
535
536 };
537
539 template <int shift , int tap1, int tap2>
540 class PredictStepFourTap
541 {
542 public:
543
545 PredictStepFourTap(){}
546
547 // Assume default copy constructor, assignment= and destructor //
548
550 inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2 ,
551 const CoeffType& val3, const CoeffType& val4 ) const
552 {
553 in_val -= ( tap1*( val1 + val2 ) + tap2*( val3 + val4 ) + (1<<(shift-1)))>>shift;
554 }
555 };
556
558 template <int shift , int tap1 , int tap2>
559 class UpdateStepFourTap
560 {
561
562 public:
564 UpdateStepFourTap(){}
565
567 inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2 ,
568 const CoeffType& val3, const CoeffType& val4 ) const
569 {
570 in_val += ( tap1*( val1 + val2 ) + tap2*( val3 + val4 ) + (1<<(shift-1)) )>>shift;
571 }
572 };
573
575 template <int gain> class PredictStep97
576 {
577 public:
578
580 PredictStep97(){}
581
582 // Assume default copy constructor, assignment= and destructor //
583
585 /*
586 Do the filtering.
587 \param in_val the value being predicted
588 \param val1 the first value being used for prediction
589 \param val2 the second value being used for prediction
590 */
591 inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
592 {
593 in_val -= static_cast< CoeffType >( (gain * static_cast< int >( val1 + val2 )) >>12 );
594 }
595 };
596
598 template <int gain> class UpdateStep97
599 {
600
601 public:
603 UpdateStep97(){}
604
606 /*
607 Do the filtering.
608 \param in_val the value being updated
609 \param val1 the first value being used for updating
610 \param val2 the second value being used for updating
611 */
612 inline void Filter(CoeffType& in_val, const CoeffType& val1, const CoeffType& val2) const
613 {
614 in_val += static_cast< CoeffType >( (gain * static_cast< int >( val1 + val2 )) >>12 );
615 }
616 };
617
619
622 class CoeffArray: public TwoDArray<CoeffType>
623 {
624 public:
626
629 CoeffArray(): TwoDArray<CoeffType>(){}
630
632
636 CoeffArray(int height, int width, CompSort cs=Y_COMP):
637 TwoDArray<CoeffType>(height, width), m_csort(cs){}
638
639 //copy constructor and assignment= derived by inheritance
640
642 ~CoeffArray(){}
643
645 const CompSort& CSort() const {return m_csort;}
646
648 void SetCSort(const CompSort cs){ m_csort = cs; }
649
651 SubbandList& BandList(){return m_band_list;}
652
654 const SubbandList& BandList() const {return m_band_list;}
655
657
662 void SetBandWeights (const EncoderParams& encparams,
663 const PictureParams& pparams,
664 const CompSort csort,
665 const float cpd_scale_factor);
666
667 private:
668
669 CompSort m_csort;
670
671 // The subband list to be used for conventional transform apps
672 SubbandList m_band_list;
673
674 private:
675
677 float PerceptualWeight(float xf,float yf,CompSort cs);
678
679 };
680
682
686 class WaveletTransform
687 {
688 public:
690 WaveletTransform(int d = 4, WltFilter f = DAUB9_7);
691
693 virtual ~WaveletTransform();
694
696
702 void Transform(const Direction d, PicArray& pic_data, CoeffArray& coeff_data);
703
704 private:
705
706
707 private:
708
709 // Private variables
710
712 int m_depth;
713
715 WltFilter m_filt_sort;
716
718 VHFilter* m_vhfilter;
719
720 private:
721 // Private functions
723 WaveletTransform(const WaveletTransform& cpy);
724
726 WaveletTransform& operator=(const WaveletTransform& rhs);
727
728 };
729}// end namespace dirac
730
731#endif
arrays.h
WltFilter
WltFilter
Definition: common_types.h:62
DAUB9_7
@ DAUB9_7
Definition: common_types.h:69
common.h
dirac
Definition of class SequenceHeaderByteIO.
Definition: accessunit_byteio.h:52
dirac::CoeffType
int CoeffType
Type of wavelet coefficient data (should be larger than ValueType)
Definition: common.h:74
dirac::CompSort
CompSort
Types of picture component.
Definition: common.h:87
dirac::Y_COMP
@ Y_COMP
Definition: common.h:87
dirac::Direction
Direction
Forward or backward.
Definition: common.h:93
dirac::TwoDArray
A template class for two-dimensional arrays.
Definition: arrays.h:285
dirac::PictureParams
Parameters for initialising picture class objects.
Definition: common.h:533
dirac::PicArray
A class for picture component data.
Definition: common.h:719
dirac::EncoderParams
Parameters for the encoding process.
Definition: common.h:1280
dirac::CodeBlock
Class for encapsulating metadata concerning a block of coefficients in a subband.
Definition: wavelet_utils.h:60
dirac::CodeBlock::Skipped
bool Skipped() const
Returns true if the code-block is skipped, false if not.
Definition: wavelet_utils.h:103
dirac::CodeBlock::Xstart
int Xstart() const
Returns the horizontal start of the block.
Definition: wavelet_utils.h:82
dirac::CodeBlock::m_xl
int m_xl
Definition: wavelet_utils.h:129
dirac::CodeBlock::m_xend
int m_xend
Definition: wavelet_utils.h:127
dirac::CodeBlock::m_skipped
bool m_skipped
Definition: wavelet_utils.h:134
dirac::CodeBlock::m_quantindex
int m_quantindex
Definition: wavelet_utils.h:132
dirac::CodeBlock::Xl
int Xl() const
Returns the width of the code block.
Definition: wavelet_utils.h:94
dirac::CodeBlock::SetSkip
void SetSkip(bool skip)
Sets whether the code block is skipped or not.
Definition: wavelet_utils.h:109
dirac::CodeBlock::m_xstart
int m_xstart
Definition: wavelet_utils.h:125
dirac::CodeBlock::Init
void Init(const int xstart, const int ystart, const int xend, const int yend)
Initialise the code block.
dirac::CodeBlock::SetQuantIndex
void SetQuantIndex(const int quantindex)
Sets the quantisation index.
Definition: wavelet_utils.h:106
dirac::CodeBlock::Ystart
int Ystart() const
Returns the vertical start of the block.
Definition: wavelet_utils.h:85
dirac::CodeBlock::m_yl
int m_yl
Definition: wavelet_utils.h:130
dirac::CodeBlock::QuantIndex
int QuantIndex() const
Returns the quantisation index associated to the code block.
Definition: wavelet_utils.h:100
dirac::CodeBlock::m_ystart
int m_ystart
Definition: wavelet_utils.h:126
dirac::CodeBlock::CodeBlock
CodeBlock()
Constructor.
dirac::CodeBlock::m_yend
int m_yend
Definition: wavelet_utils.h:128
dirac::CodeBlock::Xend
int Xend() const
Returns one past the last coefficient coord, horizontally.
Definition: wavelet_utils.h:88
dirac::CodeBlock::Yend
int Yend() const
Returns one past the last coefficient coord, vertically.
Definition: wavelet_utils.h:91
dirac::CodeBlock::Yl
int Yl() const
Returns the height of the code block.
Definition: wavelet_utils.h:97
dirac::CodeBlock::CodeBlock
CodeBlock(const int xstart, const int ystart, const int xend, const int yend)
Constructor.
dirac::Subband
Class encapsulating all the metadata relating to a wavelet subband.
Definition: wavelet_utils.h:140
dirac::Subband::Yl
int Yl() const
Return the height of the subband.
Definition: wavelet_utils.h:181
dirac::Subband::m_yl
int m_yl
Definition: wavelet_utils.h:248
dirac::Subband::Subband
Subband(int xpos, int ypos, int xlen, int ylen)
Constructor.
dirac::Subband::m_depth
int m_depth
Definition: wavelet_utils.h:254
dirac::Subband::Parent
int Parent() const
Return the index of the parent subband.
Definition: wavelet_utils.h:205
dirac::Subband::Subband
Subband()
Default constructor.
dirac::Subband::SetMax
void SetMax(const int m)
Set the index of the maximum bit of the largest coefficient.
Definition: wavelet_utils.h:232
dirac::Subband::Xp
int Xp() const
Return the horizontal position of the subband.
Definition: wavelet_utils.h:178
dirac::Subband::GetCodeBlocks
TwoDArray< CodeBlock > & GetCodeBlocks()
Return the code blocks.
Definition: wavelet_utils.h:214
dirac::Subband::m_yp
int m_yp
Definition: wavelet_utils.h:248
dirac::Subband::SetParent
void SetParent(const int p)
Set the parent index.
Definition: wavelet_utils.h:226
dirac::Subband::m_qindex
int m_qindex
Definition: wavelet_utils.h:257
dirac::Subband::m_wt
double m_wt
Definition: wavelet_utils.h:251
dirac::Subband::SetQuantIndex
void SetQuantIndex(const int idx)
Set the quantisation index.
Definition: wavelet_utils.h:238
dirac::Subband::m_max_bit
int m_max_bit
Definition: wavelet_utils.h:266
dirac::Subband::Skipped
bool Skipped() const
Returns true if subband is skipped, false if not.
Definition: wavelet_utils.h:220
dirac::Subband::Max
int Max() const
Return the index of the maximum bit of the largest coefficient.
Definition: wavelet_utils.h:187
dirac::Subband::m_skipped
bool m_skipped
Definition: wavelet_utils.h:275
dirac::Subband::SetNumBlocks
void SetNumBlocks(const int ynum, const int xnum)
Set the number of (spatial) quantisers in the subband. Creates code block structure.
dirac::Subband::m_children
std::vector< int > m_children
Definition: wavelet_utils.h:263
dirac::Subband::Child
int Child(const int n) const
Return the index of a specific child band.
Definition: wavelet_utils.h:211
dirac::Subband::Xl
int Xl() const
Return the width of the subband.
Definition: wavelet_utils.h:175
dirac::Subband::SetDepth
void SetDepth(const int d)
Set the subband depth.
Definition: wavelet_utils.h:229
dirac::Subband::m_xl
int m_xl
Definition: wavelet_utils.h:248
dirac::Subband::m_multi_quants
bool m_multi_quants
Definition: wavelet_utils.h:272
dirac::Subband::Scale
int Scale() const
Return the scale of the subband, viewed as a subsampled version of the picture.
Definition: wavelet_utils.h:196
dirac::Subband::GetCodeBlocks
const TwoDArray< CodeBlock > & GetCodeBlocks() const
Return the code blocks.
Definition: wavelet_utils.h:217
dirac::Subband::Children
const std::vector< int > & Children() const
Return the indices of any child subbands.
Definition: wavelet_utils.h:208
dirac::Subband::SetUsingMultiQuants
void SetUsingMultiQuants(const bool multi)
Set the number of (spatial) quantisers in the subband. Creates code block structure.
Definition: wavelet_utils.h:241
dirac::Subband::m_code_block_array
TwoDArray< CodeBlock > m_code_block_array
Definition: wavelet_utils.h:269
dirac::Subband::UsingMultiQuants
bool UsingMultiQuants() const
Return a flag indicating whether we have separate quantisers for each code block.
Definition: wavelet_utils.h:202
dirac::Subband::~Subband
~Subband()
Destructor.
dirac::Subband::QuantIndex
int QuantIndex() const
Return a quantisation index.
Definition: wavelet_utils.h:199
dirac::Subband::Yp
int Yp() const
Return the vertical position of the subband.
Definition: wavelet_utils.h:184
dirac::Subband::m_xp
int m_xp
Definition: wavelet_utils.h:248
dirac::Subband::SetSkip
void SetSkip(const bool skip)
Set whether the subband is skipped or not.
Definition: wavelet_utils.h:244
dirac::Subband::Wt
double Wt() const
Return the subband perceptual weight.
Definition: wavelet_utils.h:190
dirac::Subband::Depth
int Depth() const
Return the depth of the subband in the transform.
Definition: wavelet_utils.h:193
dirac::Subband::m_parent
int m_parent
Definition: wavelet_utils.h:260
dirac::Subband::Subband
Subband(int xpos, int ypos, int xlen, int ylen, int d)
Constructor.
dirac::Subband::SetWt
void SetWt(const float w)
Set the perceptual weight.
dirac::SubbandList
A class encapulating all the subbands produced by a transform.
Definition: wavelet_utils.h:280
dirac::SubbandList::bands
std::vector< Subband > bands
Definition: wavelet_utils.h:313
dirac::SubbandList::PerceptualWeight
float PerceptualWeight(const float xf, const float yf, const CompSort cs)
Given x and y spatial frequencies in cycles per degree, returns a weighting value.
dirac::SubbandList::AddBand
void AddBand(const Subband &b)
Add a band to the list.
Definition: wavelet_utils.h:302
dirac::SubbandList::SubbandList
SubbandList()
Constructor.
Definition: wavelet_utils.h:283
dirac::SubbandList::Length
int Length() const
Return the length of the subband list.
Definition: wavelet_utils.h:293
dirac::SubbandList::operator()
Subband & operator()(const int n)
Return the subband at position n (1<=n<=length)
Definition: wavelet_utils.h:296
dirac::SubbandList::Init
void Init(const int depth, const int xlen, const int ylen)
Initialise the list.
dirac::SubbandList::operator()
const Subband & operator()(const int n) const
Return the subband at position n (1<=n<=length)
Definition: wavelet_utils.h:299
dirac::SubbandList::~SubbandList
~SubbandList()
Destructor.
Definition: wavelet_utils.h:286
dirac::SubbandList::Clear
void Clear()
Remove all the bands from the list.
Definition: wavelet_utils.h:305
dirac::VHFilter
A virtual parent class to do vertical and horizontal splitting with wavelet filters.
Definition: wavelet_utils.h:319
dirac::VHFilter::Split
virtual void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)=0
Split a subband into 4.
dirac::VHFilter::GetShift
virtual int GetShift() const =0
Return the value of the additional bitshift.
dirac::VHFilter::Interleave
void Interleave(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Interleave data from separate subbands into even and odd positions for in-place calculation - called ...
dirac::VHFilter::~VHFilter
virtual ~VHFilter()
Definition: wavelet_utils.h:325
dirac::VHFilter::Synth
virtual void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)=0
Create a single band from 4 quadrant bands.
dirac::VHFilter::DeInterleave
void DeInterleave(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
De-interleave data even and odd positions into separate subbands - called by Split.
dirac::VHFilter::ShiftRowLeft
void ShiftRowLeft(CoeffType *row, int length, int shift)
Shift all vals in Row by 'shift' bits to the left to increase accuracy by 'shift' bits....
dirac::VHFilter::ShiftRowRight
void ShiftRowRight(CoeffType *row, int length, int shift)
Shift all vals in Row by 'shift' bits to the right to counter the shift in the Analysis stage....
dirac::VHFilter::VHFilter
VHFilter()
Definition: wavelet_utils.h:323
dirac::VHFilterDAUB9_7
Class to do Daubechies (9,7) filtering operations.
Definition: wavelet_utils.h:354
dirac::VHFilterDAUB9_7::Split
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
dirac::VHFilterDAUB9_7::Synth
void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Create a single band from 4 quadrant bands.
dirac::VHFilterDAUB9_7::GetShift
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:365
dirac::VHFilterLEGALL5_3
Class to do (5,3) wavelet filtering operations.
Definition: wavelet_utils.h:372
dirac::VHFilterLEGALL5_3::GetShift
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:383
dirac::VHFilterLEGALL5_3::Synth
void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Create a single band from 4 quadrant bands.
dirac::VHFilterLEGALL5_3::Split
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
dirac::VHFilterDD9_7
A short filter that's actually close to Daubechies (9,7) but with just two lifting steps.
Definition: wavelet_utils.h:394
dirac::VHFilterDD9_7::GetShift
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:405
dirac::VHFilterDD9_7::Split
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
dirac::VHFilterDD9_7::Synth
void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Create a single band from 4 quadrant bands.
dirac::VHFilterDD13_7
An extension of DD9_7, with a better low-pass filter but more computation.
Definition: wavelet_utils.h:411
dirac::VHFilterDD13_7::Split
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
dirac::VHFilterDD13_7::GetShift
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:422
dirac::VHFilterDD13_7::Synth
void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Create a single band from 4 quadrant bands.
dirac::VHFilterHAAR0
Class to do Haar wavelet filtering operations.
Definition: wavelet_utils.h:428
dirac::VHFilterHAAR0::Split
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
dirac::VHFilterHAAR0::GetShift
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:439
dirac::VHFilterHAAR0::Synth
void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Create a single band from 4 quadrant bands.
dirac::VHFilterHAAR1
Class to do Haar wavelet filtering operations with a single shift per level.
Definition: wavelet_utils.h:446
dirac::VHFilterHAAR1::GetShift
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:457
dirac::VHFilterHAAR1::Split
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
dirac::VHFilterHAAR1::Synth
void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Create a single band from 4 quadrant bands.
dirac::VHFilterHAAR2
Class to do Haar wavelet filtering operations with a double shift per level.
Definition: wavelet_utils.h:464
dirac::VHFilterHAAR2::Synth
void Synth(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Create a single band from 4 quadrant bands.
dirac::VHFilterHAAR2::GetHighFactor
double GetHighFactor() const
Return a correction factor to compensate for non-unity power gain of high-pass filter.
Definition: wavelet_utils.h:478
dirac::VHFilterHAAR2::Split
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
dirac::VHFilterHAAR2::GetLowFactor
double GetLowFactor() const
Return a correction factor to compensate for non-unity power gain of low-pass filter.
Definition: wavelet_utils.h:475
dirac::VHFilterHAAR2::GetShift
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:481
dirac::PredictStepShift
Class to do two-tap prediction lifting step.
Definition: wavelet_utils.h:492
dirac::PredictStepShift::Filter
void Filter(CoeffType &in_val, const CoeffType &val1, const CoeffType &val2) const
Do the filtering.
Definition: wavelet_utils.h:508
dirac::PredictStepShift::PredictStepShift
PredictStepShift()
Constructor.
Definition: wavelet_utils.h:497
dirac::UpdateStepShift
Class to do two-tap updating lifting step.
Definition: wavelet_utils.h:518
dirac::UpdateStepShift::UpdateStepShift
UpdateStepShift()
Constructor.
Definition: wavelet_utils.h:522
dirac::UpdateStepShift::Filter
void Filter(CoeffType &in_val, const CoeffType &val1, const CoeffType &val2) const
Do the filtering.
Definition: wavelet_utils.h:531
dirac::PredictStepFourTap
Class to do symmetric four-tap prediction lifting step.
Definition: wavelet_utils.h:541
dirac::PredictStepFourTap::Filter
void Filter(CoeffType &in_val, const CoeffType &val1, const CoeffType &val2, const CoeffType &val3, const CoeffType &val4) const
Do the filtering.
Definition: wavelet_utils.h:550
dirac::PredictStepFourTap::PredictStepFourTap
PredictStepFourTap()
Constructor.
Definition: wavelet_utils.h:545
dirac::UpdateStepFourTap
Class to do symmetric four-tap update lifting step.
Definition: wavelet_utils.h:560
dirac::UpdateStepFourTap::UpdateStepFourTap
UpdateStepFourTap()
Constructor.
Definition: wavelet_utils.h:564
dirac::UpdateStepFourTap::Filter
void Filter(CoeffType &in_val, const CoeffType &val1, const CoeffType &val2, const CoeffType &val3, const CoeffType &val4) const
Do the filtering.
Definition: wavelet_utils.h:567
dirac::PredictStep97
Class to do two-tap prediction lifting step for Daubechies (9,7)
Definition: wavelet_utils.h:576
dirac::PredictStep97::PredictStep97
PredictStep97()
Constructor.
Definition: wavelet_utils.h:580
dirac::PredictStep97::Filter
void Filter(CoeffType &in_val, const CoeffType &val1, const CoeffType &val2) const
Do the filtering.
Definition: wavelet_utils.h:591
dirac::UpdateStep97
Class to do two-tap update lifting step for Daubechies (9,7)
Definition: wavelet_utils.h:599
dirac::UpdateStep97::Filter
void Filter(CoeffType &in_val, const CoeffType &val1, const CoeffType &val2) const
Do the filtering.
Definition: wavelet_utils.h:612
dirac::UpdateStep97::UpdateStep97
UpdateStep97()
Constructor.
Definition: wavelet_utils.h:603
dirac::CoeffArray
A class for wavelet coefficient data.
Definition: wavelet_utils.h:623
dirac::CoeffArray::m_band_list
SubbandList m_band_list
Definition: wavelet_utils.h:672
dirac::CoeffArray::m_csort
CompSort m_csort
Definition: wavelet_utils.h:669
dirac::CoeffArray::SetBandWeights
void SetBandWeights(const EncoderParams &encparams, const PictureParams &pparams, const CompSort csort, const float cpd_scale_factor)
Sets the subband weights.
dirac::CoeffArray::SetCSort
void SetCSort(const CompSort cs)
Set the type of component being stored.
Definition: wavelet_utils.h:648
dirac::CoeffArray::BandList
const SubbandList & BandList() const
Returns the set of subbands.
Definition: wavelet_utils.h:654
dirac::CoeffArray::BandList
SubbandList & BandList()
Returns the set of subbands.
Definition: wavelet_utils.h:651
dirac::CoeffArray::CoeffArray
CoeffArray(int height, int width, CompSort cs=Y_COMP)
Constructor.
Definition: wavelet_utils.h:636
dirac::CoeffArray::PerceptualWeight
float PerceptualWeight(float xf, float yf, CompSort cs)
Given x and y spatial frequencies in cycles per degree, returns a weighting value.
dirac::CoeffArray::CoeffArray
CoeffArray()
Default constructor.
Definition: wavelet_utils.h:629
dirac::CoeffArray::~CoeffArray
~CoeffArray()
Destructor.
Definition: wavelet_utils.h:642
dirac::CoeffArray::CSort
const CompSort & CSort() const
Return which component is stored.
Definition: wavelet_utils.h:645
dirac::WaveletTransform
A class to do wavelet transforms.
Definition: wavelet_utils.h:687
dirac::WaveletTransform::~WaveletTransform
virtual ~WaveletTransform()
Destructor.
dirac::WaveletTransform::Transform
void Transform(const Direction d, PicArray &pic_data, CoeffArray &coeff_data)
Transforms the data to and from the wavelet domain.
dirac::WaveletTransform::operator=
WaveletTransform & operator=(const WaveletTransform &rhs)
Private, bodyless copy operator=: class should not be assigned.
dirac::WaveletTransform::m_depth
int m_depth
Depth of the transform.
Definition: wavelet_utils.h:712
dirac::WaveletTransform::m_filt_sort
WltFilter m_filt_sort
The (vertical and horizontal) wavelet filter set to be used.
Definition: wavelet_utils.h:715
dirac::WaveletTransform::WaveletTransform
WaveletTransform(const WaveletTransform &cpy)
Private, bodyless copy constructor: class should not be copied.
dirac::WaveletTransform::WaveletTransform
WaveletTransform(int d=4, WltFilter f=DAUB9_7)
Constructor.
dirac::WaveletTransform::m_vhfilter
VHFilter * m_vhfilter
A class to do the vertical and horizontal filtering required.
Definition: wavelet_utils.h:718

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