Dirac - A Video Codec
Created by the British Broadcasting Corporation.
Go to the documentation of this file.
40 #ifndef _WAVELET_UTILS_H_
41 #define _WAVELET_UTILS_H_
79 CodeBlock(
const int xstart ,
const int ystart ,
const int xend ,
const int yend);
121 void Init(
const int xstart ,
const int ystart ,
const int xend ,
const int yend );
155 Subband(
int xpos,
int ypos,
int xlen,
int ylen);
167 Subband(
int xpos,
int ypos,
int xlen,
int ylen,
int d);
223 void SetWt(
const float w );
290 void Init(
const int depth,
const int xlen,
const int ylen);
328 virtual void Split(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data)=0;
331 virtual void Synth(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data)=0;
339 inline void Interleave(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data );
343 inline void DeInterleave(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data );
359 void Split(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
362 void Synth(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
377 void Split(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
380 void Synth(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
387 inline void HorizSynth (
int xp,
int xl,
int ystart,
int yend,
CoeffArray &coeff_data);
399 void Split(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
402 void Synth(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
416 void Split(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
419 void Synth(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
433 void Split(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
436 void Synth(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
451 void Split(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
454 void Synth(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
469 void Split(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
472 void Synth(
const int xp,
const int yp,
const int xl,
const int yl,
CoeffArray& coeff_data);
510 in_val -= (( val1 + val2 + (1<<(shift-1)) ) >>shift );
533 in_val += ( ( val1 + val2 + (1<<(shift-1)) ) >>shift );
539 template <
int shift ,
int tap1,
int tap2>
553 in_val -= ( tap1*( val1 + val2 ) + tap2*( val3 + val4 ) + (1<<(shift-1)))>>shift;
558 template <
int shift ,
int tap1 ,
int tap2>
570 in_val += ( tap1*( val1 + val2 ) + tap2*( val3 + val4 ) + (1<<(shift-1)) )>>shift;
593 in_val -=
static_cast< CoeffType >( (gain *
static_cast< int >( val1 + val2 )) >>12 );
614 in_val +=
static_cast< CoeffType >( (gain *
static_cast< int >( val1 + val2 )) >>12 );
665 const float cpd_scale_factor);
int m_quantindex
Definition: wavelet_utils.h:132
SubbandList m_band_list
Definition: wavelet_utils.h:672
void Transform(const Direction d, PicArray &pic_data, CoeffArray &coeff_data)
Transforms the data to and from the wavelet domain.
int m_parent
Definition: wavelet_utils.h:260
A class for picture component data.
Definition: common.h:718
Class encapsulating all the metadata relating to a wavelet subband.
Definition: wavelet_utils.h:139
void SetBandWeights(const EncoderParams &encparams, const PictureParams &pparams, const CompSort csort, const float cpd_scale_factor)
Sets the subband weights.
void SetSkip(bool skip)
Sets whether the code block is skipped or not.
Definition: wavelet_utils.h:109
~SubbandList()
Destructor.
Definition: wavelet_utils.h:286
~CoeffArray()
Destructor.
Definition: wavelet_utils.h:642
Class to do Haar wavelet filtering operations.
Definition: wavelet_utils.h:427
PredictStepFourTap()
Constructor.
Definition: wavelet_utils.h:545
UpdateStep97()
Constructor.
Definition: wavelet_utils.h:603
int Xl() const
Returns the width of the code block.
Definition: wavelet_utils.h:94
Class to do (5,3) wavelet filtering operations.
Definition: wavelet_utils.h:371
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
Direction
Forward or backward.
Definition: common.h:93
int CoeffType
Type of wavelet coefficient data (should be larger than ValueType)
Definition: common.h:74
int Length() const
Return the length of the subband list.
Definition: wavelet_utils.h:293
bool UsingMultiQuants() const
Return a flag indicating whether we have separate quantisers for each code block.
Definition: wavelet_utils.h:202
double Wt() const
Return the subband perceptual weight.
Definition: wavelet_utils.h:190
Definition of class SequenceHeaderByteIO.
Definition: accessunit_byteio.h:51
int m_yl
Definition: wavelet_utils.h:130
int Yl() const
Return the height of the subband.
Definition: wavelet_utils.h:181
A virtual parent class to do vertical and horizontal splitting with wavelet filters.
Definition: wavelet_utils.h:318
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.
Parameters for initialising picture class objects.
Definition: common.h:532
A class for wavelet coefficient data.
Definition: wavelet_utils.h:622
Class for encapsulating metadata concerning a block of coefficients in a subband.
Definition: wavelet_utils.h:59
A template class for two-dimensional arrays.
Definition: arrays.h:284
Class to do symmetric four-tap update lifting step.
Definition: wavelet_utils.h:559
void SetDepth(const int d)
Set the subband depth.
Definition: wavelet_utils.h:229
void Init(const int xstart, const int ystart, const int xend, const int yend)
Initialise the code block.
int Xl() const
Return the width of the subband.
Definition: wavelet_utils.h:175
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:365
void AddBand(const Subband &b)
Add a band to the list.
Definition: wavelet_utils.h:302
int QuantIndex() const
Returns the quantisation index associated to the code block.
Definition: wavelet_utils.h:100
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:405
void Filter(CoeffType &in_val, const CoeffType &val1, const CoeffType &val2) const
Do the filtering.
Definition: wavelet_utils.h:531
int m_xl
Definition: wavelet_utils.h:129
void Filter(CoeffType &in_val, const CoeffType &val1, const CoeffType &val2) const
Do the filtering.
Definition: wavelet_utils.h:612
bool Skipped() const
Returns true if the code-block is skipped, false if not.
Definition: wavelet_utils.h:103
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
Class to do two-tap updating lifting step.
Definition: wavelet_utils.h:517
int Child(const int n) const
Return the index of a specific child band.
Definition: wavelet_utils.h:211
CompSort m_csort
Definition: wavelet_utils.h:669
int m_xp
Definition: wavelet_utils.h:248
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:383
int m_xstart
Definition: wavelet_utils.h:125
int Yend() const
Returns one past the last coefficient coord, vertically.
Definition: wavelet_utils.h:91
bool Skipped() const
Returns true if subband is skipped, false if not.
Definition: wavelet_utils.h:220
void SetUsingMultiQuants(const bool multi)
Set the number of (spatial) quantisers in the subband. Creates code block structure.
Definition: wavelet_utils.h:241
WaveletTransform(int d=4, WltFilter f=DAUB9_7)
Constructor.
double GetLowFactor() const
Return a correction factor to compensate for non-unity power gain of low-pass filter.
Definition: wavelet_utils.h:475
WltFilter
Definition: common_types.h:61
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.
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.
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.
int Parent() const
Return the index of the parent subband.
Definition: wavelet_utils.h:205
int Yp() const
Return the vertical position of the subband.
Definition: wavelet_utils.h:184
WltFilter m_filt_sort
The (vertical and horizontal) wavelet filter set to be used.
Definition: wavelet_utils.h:715
virtual void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)=0
Split a subband into 4.
float PerceptualWeight(float xf, float yf, CompSort cs)
Given x and y spatial frequencies in cycles per degree, returns a weighting value.
int m_xl
Definition: wavelet_utils.h:248
void SetParent(const int p)
Set the parent index.
Definition: wavelet_utils.h:226
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:457
VHFilter * m_vhfilter
A class to do the vertical and horizontal filtering required.
Definition: wavelet_utils.h:718
int m_max_bit
Definition: wavelet_utils.h:266
int Depth() const
Return the depth of the subband in the transform.
Definition: wavelet_utils.h:193
SubbandList()
Constructor.
Definition: wavelet_utils.h:283
void Init(const int depth, const int xlen, const int ylen)
Initialise the list.
const CompSort & CSort() const
Return which component is stored.
Definition: wavelet_utils.h:645
Class to do two-tap update lifting step for Daubechies (9,7)
Definition: wavelet_utils.h:598
int m_depth
Definition: wavelet_utils.h:254
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:422
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.
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
PredictStep97()
Constructor.
Definition: wavelet_utils.h:580
virtual int GetShift() const =0
Return the value of the additional bitshift.
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.
int m_depth
Depth of the transform.
Definition: wavelet_utils.h:712
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
TwoDArray< CodeBlock > & GetCodeBlocks()
Return the code blocks.
Definition: wavelet_utils.h:214
void SetNumBlocks(const int ynum, const int xnum)
Set the number of (spatial) quantisers in the subband. Creates code block structure.
void Filter(CoeffType &in_val, const CoeffType &val1, const CoeffType &val2) const
Do the filtering.
Definition: wavelet_utils.h:508
Parameters for the encoding process.
Definition: common.h:1279
Class to do Haar wavelet filtering operations with a single shift per level.
Definition: wavelet_utils.h:445
@ DAUB9_7
Definition: common_types.h:69
A class to do wavelet transforms.
Definition: wavelet_utils.h:686
const std::vector< int > & Children() const
Return the indices of any child subbands.
Definition: wavelet_utils.h:208
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:439
Class to do two-tap prediction lifting step for Daubechies (9,7)
Definition: wavelet_utils.h:575
void SetQuantIndex(const int idx)
Set the quantisation index.
Definition: wavelet_utils.h:238
void Filter(CoeffType &in_val, const CoeffType &val1, const CoeffType &val2) const
Do the filtering.
Definition: wavelet_utils.h:591
An extension of DD9_7, with a better low-pass filter but more computation.
Definition: wavelet_utils.h:410
std::vector< int > m_children
Definition: wavelet_utils.h:263
double m_wt
Definition: wavelet_utils.h:251
Class to do Daubechies (9,7) filtering operations.
Definition: wavelet_utils.h:353
Class to do symmetric four-tap prediction lifting step.
Definition: wavelet_utils.h:540
int Scale() const
Return the scale of the subband, viewed as a subsampled version of the picture.
Definition: wavelet_utils.h:196
WaveletTransform & operator=(const WaveletTransform &rhs)
Private, bodyless copy operator=: class should not be assigned.
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.
const Subband & operator()(const int n) const
Return the subband at position n (1<=n<=length)
Definition: wavelet_utils.h:299
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
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.
int Xstart() const
Returns the horizontal start of the block.
Definition: wavelet_utils.h:82
void SetSkip(const bool skip)
Set whether the subband is skipped or not.
Definition: wavelet_utils.h:244
CoeffArray(int height, int width, CompSort cs=Y_COMP)
Constructor.
Definition: wavelet_utils.h:636
bool m_skipped
Definition: wavelet_utils.h:275
const SubbandList & BandList() const
Returns the set of subbands.
Definition: wavelet_utils.h:654
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
A class encapulating all the subbands produced by a transform.
Definition: wavelet_utils.h:279
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....
int m_ystart
Definition: wavelet_utils.h:126
int Xend() const
Returns one past the last coefficient coord, horizontally.
Definition: wavelet_utils.h:88
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.
int GetShift() const
Return the value of the additional bitshift.
Definition: wavelet_utils.h:481
UpdateStepFourTap()
Constructor.
Definition: wavelet_utils.h:564
int Ystart() const
Returns the vertical start of the block.
Definition: wavelet_utils.h:85
int m_yend
Definition: wavelet_utils.h:128
UpdateStepShift()
Constructor.
Definition: wavelet_utils.h:522
Subband & operator()(const int n)
Return the subband at position n (1<=n<=length)
Definition: wavelet_utils.h:296
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.
CompSort
Types of picture component.
Definition: common.h:87
void SetQuantIndex(const int quantindex)
Sets the quantisation index.
Definition: wavelet_utils.h:106
Class to do two-tap prediction lifting step.
Definition: wavelet_utils.h:491
int m_yl
Definition: wavelet_utils.h:248
void SetMax(const int m)
Set the index of the maximum bit of the largest coefficient.
Definition: wavelet_utils.h:232
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....
int QuantIndex() const
Return a quantisation index.
Definition: wavelet_utils.h:199
int m_xend
Definition: wavelet_utils.h:127
void SetWt(const float w)
Set the perceptual weight.
int m_qindex
Definition: wavelet_utils.h:257
bool m_skipped
Definition: wavelet_utils.h:134
SubbandList & BandList()
Returns the set of subbands.
Definition: wavelet_utils.h:651
double GetHighFactor() const
Return a correction factor to compensate for non-unity power gain of high-pass filter.
Definition: wavelet_utils.h:478
int Max() const
Return the index of the maximum bit of the largest coefficient.
Definition: wavelet_utils.h:187
@ Y_COMP
Definition: common.h:87
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 ...
void SetCSort(const CompSort cs)
Set the type of component being stored.
Definition: wavelet_utils.h:648
std::vector< Subband > bands
Definition: wavelet_utils.h:313
CoeffArray()
Default constructor.
Definition: wavelet_utils.h:629
PredictStepShift()
Constructor.
Definition: wavelet_utils.h:497
Subband()
Default constructor.
A short filter that's actually close to Daubechies (9,7) but with just two lifting steps.
Definition: wavelet_utils.h:393
virtual ~WaveletTransform()
Destructor.
void Split(const int xp, const int yp, const int xl, const int yl, CoeffArray &coeff_data)
Split a subband into 4.
bool m_multi_quants
Definition: wavelet_utils.h:272
virtual ~VHFilter()
Definition: wavelet_utils.h:325
int Yl() const
Returns the height of the code block.
Definition: wavelet_utils.h:97
int m_yp
Definition: wavelet_utils.h:248
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
void Clear()
Remove all the bands from the list.
Definition: wavelet_utils.h:305
VHFilter()
Definition: wavelet_utils.h:323
TwoDArray< CodeBlock > m_code_block_array
Definition: wavelet_utils.h:269
Class to do Haar wavelet filtering operations with a double shift per level.
Definition: wavelet_utils.h:463
int Xp() const
Return the horizontal position of the subband.
Definition: wavelet_utils.h:178
const TwoDArray< CodeBlock > & GetCodeBlocks() const
Return the code blocks.
Definition: wavelet_utils.h:217
© 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.