# Dirac - A Video Codec

Created by the British Broadcasting Corporation.

# dirac::MotionCompensator Class Reference

Abstract Motion compensator class. More...

`#include <mot_comp.h>`

Inheritance diagram for dirac::MotionCompensator:

[legend]
Collaboration diagram for dirac::MotionCompensator:

[legend]
List of all members.

## Public Member Functions

- MotionCompensator (const CodecParams &cp)
    Constructor.
- virtual ~MotionCompensator ()
    Destructor.
- void CompensateFrame (const AddOrSub direction, FrameBuffer &my_buffer, int fnum, const MvData &mv_data)
    Compensate a frame.

## Static Public Member Functions

- static void CompensateFrame (const CodecParams &cp, const AddOrSub direction, FrameBuffer &buffer, const int fnum, const MvData &mv_data)
    Convenience function to perform motion compensation on a frame.

## Protected Attributes

- CodecParams m_cparams
    The codec parameters.
- ChromaFormat m_cformat
    The chroma format.
- bool luma_or_chroma
- AddOrSub m_add_or_sub
- OLBParams m_bparams
- TwoDArray< ValueType > * m_block_weights
- TwoDArray< ValueType > * m_half_block_weights
- TwoDArray< ValueType > * m_macro_block_weights
- TwoDArray< ValueType > * m_half_macro_block_weights
- TwoDArray< ValueType > * m_sub_block_weights
- TwoDArray< ValueType > * m_half_sub_block_weights

## Private Member Functions

- MotionCompensator (const MotionCompensator &cpy)
- MotionCompensator & operator= (const MotionCompensator &rhs)
- void CompensateComponent (Frame &picframe, const Frame &ref1frame, const Frame &ref2frame, const MvData &mv_data, const CompSort cs)
    Motion-compensate a component.
- void DCBlock (TwoDArray< CalcValueType > &pic_data, const ImageCoords &orig_pic_size, const ValueType dc, const ImageCoords &Pos, const TwoDArray< ValueType > &Weights)
    Recalculate the weight matrix and store other key block related parameters.
- void ReConfig ()
- float RaisedCosine (float t, float B)
- float Linear (float t, float B)
- void CreateBlock (int xblen, int yblen, int xbsep, int ybsep, bool FullX, bool FullY, TwoDArray< ValueType > &WeightArray)
    Calculates a weighting block.
- void FlipX (const TwoDArray< ValueType > &Original, int xblen, int yblen, TwoDArray< ValueType > &Flipped)
    Flips the values in an array in the x direction.
- void FlipY (const TwoDArray< ValueType > &Original, int xblen, int yblen, TwoDArray< ValueType > &Flipped)
    Flips the values in an array in the y direction.
- virtual void CompensateBlock (TwoDArray< CalcValueType > &pic_data, const ImageCoords &orig_pic_size, const PicArray &refup_data, const MVector &Vec, const ImageCoords &Pos, const TwoDArray< ValueType > &Weights)=0
    Motion-compensate a block. Pure virtual. SubClasses need to define it.

## Detailed Description

Motion compensator class, for doing motion compensation with two references and overlapped blocks, using raised-cosine roll-off. This is an abstract class. It must be sub-classed and the CompensateBlock must be defined in the sub-classes.

## Constructor & Destructor Documentation

dirac::MotionCompensator::MotionCompensator | ( | const CodecParams & | cp | ) |

Constructor initialises using codec parameters.

virtual dirac::MotionCompensator::~MotionCompensator | ( |  | ) | `[virtual]`

dirac::MotionCompensator::MotionCompensator | ( | const MotionCompensator & | cpy | ) | `[private]`

## Member Function Documentation

virtual void dirac::MotionCompensator::CompensateBlock | ( | TwoDArray< CalcValueType > & | pic_data,
|  | const ImageCoords & | orig_pic_size,
|  | const PicArray & | refup_data,
|  | const MVector & | Vec,
|  | const ImageCoords & | Pos,
|  | const TwoDArray< ValueType > & | Weights |
| ) |  |  | `[private, pure virtual]`

Implemented in dirac::MotionCompensator_Pixel, dirac::MotionCompensator_HalfPixel, dirac::MotionCompensator_QuarterPixel, and dirac::MotionCompensator_EighthPixel.

void dirac::MotionCompensator::CompensateComponent | ( | Frame & | picframe,
|  | const Frame & | ref1frame,
|  | const Frame & | ref2frame,
|  | const MvData & | mv_data,
|  | const CompSort | cs |
| ) |  |  | `[private]`

void dirac::MotionCompensator::CompensateFrame | ( | const AddOrSub | direction,
|  | FrameBuffer & | my_buffer,
|  | int | fnum,
|  | const MvData & | mv_data |
| ) |  |  |

Perform motion compensated addition/subtraction on a frame using parameters

Parameters:

  | direction | whether we're subtracting or adding
  | fnum | number of frame in the frame buffer to be compensated
  | my_buffer | the FrameBuffer object containing the frame and the reference frames `
  | mv_data | the motion vector data

static void dirac::MotionCompensator::CompensateFrame | ( | const CodecParams & | cp,
|  | const AddOrSub | direction,
|  | FrameBuffer & | buffer,
|  | const int | fnum,
|  | const MvData & | mv_data |
| ) |  |  | `[static]`

Static function that motion compensates a frame. It uses the MV precision value in the CodecParams to instantiate the appropriate MotionCompensation sub-class.

Parameters:

  | cp | Encoder/decoder parameters
  | direction | whether we're subtracting or adding
  | buffer | the FrameBuffer object containing the frame and the reference frames
  | fnum | number of frame in the frame buffer to be compensated `
  | mv_data | the motion vector data

void dirac::MotionCompensator::CreateBlock | ( | int | xblen,
|  | int | yblen,
|  | int | xbsep,
|  | int | ybsep,
|  | bool | FullX,
|  | bool | FullY,
|  | TwoDArray< ValueType > & | WeightArray |
| ) |  |  | `[private]`

Params defines the block parameters so the relevant weighting arrays can be created. FullX and FullY refer to whether the weight should be adjusted for the edge of an image. eg. 1D Weighting shapes in x direction FullX true FullX false ******** * * * * * *

void dirac::MotionCompensator::DCBlock | ( | TwoDArray< CalcValueType > & | pic_data,
|  | const ImageCoords & | orig_pic_size,
|  | const ValueType | dc,
|  | const ImageCoords & | Pos,
|  | const TwoDArray< ValueType > & | Weights |
| ) |  |  | `[private]`

DC-compensate an individual block

void dirac::MotionCompensator::FlipX | ( | const TwoDArray< ValueType > & | Original,
|  | int | xblen,
|  | int | yblen,
|  | TwoDArray< ValueType > & | Flipped |
| ) |  |  | `[private]`

void dirac::MotionCompensator::FlipY | ( | const TwoDArray< ValueType > & | Original,
|  | int | xblen,
|  | int | yblen,
|  | TwoDArray< ValueType > & | Flipped |
| ) |  |  | `[private]`

float dirac::MotionCompensator::Linear | ( | float | t,
|  | float | B |
| ) |  |  | `[private]`

MotionCompensator& dirac::MotionCompensator::operator= | ( | const MotionCompensator & | rhs | ) | `[private]`

float dirac::MotionCompensator::RaisedCosine | ( | float | t,
|  | float | B |
| ) |  |  | `[private]`

void dirac::MotionCompensator::ReConfig | ( |  | ) | `[private]`

## Member Data Documentation

bool dirac::MotionCompensator::luma_or_chroma`[protected]`

AddOrSub dirac::MotionCompensator::m_add_or_sub`[protected]`

TwoDArray<ValueType>* dirac::MotionCompensator::m_block_weights`[protected]`

OLBParams dirac::MotionCompensator::m_bparams`[protected]`

ChromaFormat dirac::MotionCompensator::m_cformat`[protected]`

CodecParams dirac::MotionCompensator::m_cparams`[protected]`

TwoDArray<ValueType>* dirac::MotionCompensator::m_half_block_weights`[protected]`

TwoDArray<ValueType>* dirac::MotionCompensator::m_half_macro_block_weights`[protected]`

TwoDArray<ValueType>* dirac::MotionCompensator::m_half_sub_block_weights`[protected]`

TwoDArray<ValueType>* dirac::MotionCompensator::m_macro_block_weights`[protected]`

TwoDArray<ValueType>* dirac::MotionCompensator::m_sub_block_weights`[protected]`

The documentation for this class was generated from the following file:

- mot_comp.h

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